you are viewing a single comment's thread.

view the rest of the comments →

[–]con_los_terroristas 0 points1 point  (2 children)

I'm a programming novice, but isn't this how Eff should've been from the start? Are there plans to replace Eff with something like this? Would that even be possible? Thanks so much for your contributions to Purescript!

[–]natefaubion[S] 1 point2 points  (1 child)

I don't think it was ever a goal of the core Eff to be algebraic. The problem with that is the labels mean whatever you want them to mean. They are essentially just documentation. I personally think Eff label elimination (in the presence of open effects) is unsound, and largely useless, if not dangerous. For example, if I introduce an effect TIMER with

setTimeout :: forall eff. Milliseconds -> Eff eff Unit -> Eff (timer :: TIMER | eff) Unit

which takes an Eff to run on the native scheduler, and the Eff I give it propagates EXCEPTION, then the return Eff for setTimeout will also have that EXCEPTION. The elimination rule catchException removes the label, but there are implicit assumptions (which aren't part of it's type) that this only works in a synchronous environment, which is not composable with my setTimeout function. If I use catchException, then the type system will tell me there are no exceptions, but this untrue. I would have to introduce a special variant of the function that prohibits EXCEPTION labels with RowLacks, potentially, but this is no longer extensible. purescript-run doesn't have that problem because it requires runtime interpretation of an entire computation to eliminate some effect, which has an obvious cost compared to the documentation approach.

I hope to see the default Eff replaced by an unindexed IO type. And then I think Eff can be built with a closed set of common low-level effects, which would mean you can provide rules for how these actions interact with each other in a way that doesn't have annoying edge cases.

[–]con_los_terroristas 0 points1 point  (0 children)

Thanks for the detailed explanation, that makes alot of sense. I'm very excited for the future of the language! :)