I just noticed that I can mark a function that does no effects as effectful
pureFunc! : _ => Str
pureFunc! =\a-> "hi $(a)"
At which point the compiler thinks it's effectful and will show warnings for code like this
pureFunc2 : Str -> Str
pureFunc2 = \a ->pureFunc! a
What do we all think about this?
I think the first one should be allowed for things we expose to the host (and probably also stuff exposed from a module), and disallowed otherwise. The second one is good though IMO
I remember we have this general convention of believing the type signature, which I assume is for a good reason
I think in the static dispatch world, we'll want to "implement an interface" by exposing functions from a module. I don't think that implementing an effectful interface should always require an actual effect to be performed
For example, what if my tracing framework takes any function that's effectful: can I not trace any pure functions?
Sam Mohr said:
For example, what if my tracing framework takes any function that's effectful: can I not trace any pure functions?
That's a very compelling argument. Implementing an interface that's effectful in a pure way, makes perfect sense to me.
A pure function can always be promoted to effectful. So that shouldn't be an issue
@Eli Dowling with your original comment:
I think pureFunc! should give a warning for being incorrectly labelled as effectful.
pureFunc2 should also give a warning for calling an effectful function but not being effectful
At the same time, it is important to remember that pure functions can always unify to effectful.
So this code should be warning free
runStrEffect! : ({} => Str) => Str
runStrEffect! = \fn! -> fn! {}
pureStrFn : {} -> Str
pureStrFn = \{} -> "output"
runStrEffect! pureStrFn
This is how I would expect many potentially effectful interfaces to be written via static dispatch.
Brendan Hansknecht said:
Eli Dowling with your original comment:
I thinkpureFunc!should give a warning for being incorrectly labelled as effectful.
yeah kinda like unused arguments - "this isn't going to break anything, but fyi you have an opportunity to simplify this function"
Last updated: Jun 16 2026 at 16:19 UTC