
It seems that there are several advantages to the Purescript approach.
For example, this
catchException :: forall a e . (Error -> Eff e a) -> Eff (err :: EXCEPTION | e) a -> Eff e a
would be unwieldy to express using typeclasses, requiring at least three constraints. I also find this style easier to read than constraints, as it requires no mental substitution. E.g. if I see
(Foo m, Bar m, Bar n) => Baz ->
On Oct 19, 2016, at 12:26, Christopher Allen
wrote: It's not really more direct. It's an unordered collection of effects you can use. IME it's a less efficient mtl-style, but YMMV.
Taking an example from a PureScript tutorial:
func :: Eff (console :: CONSOLE, random :: RANDOM) Unit
Can just as easily be:
func :: (MonadConsole m, MonadGimmeRandom m) => m ()
(mangled name so it doesn't overlap with a real class)
There are other differences, but they haven't amounted to much for me yet.
Kmett's Quine has a good example of some homespun mtl-style: https://github.com/ekmett/quine
On Wed, Oct 19, 2016 at 12:17 PM, Will Yager
wrote: Can anyone comment on the use of Purescript-style effect monads as compared to MTL and Free? While I have not used them in practice, they seem to express the "intent" of monad composition a bit more directly than the approaches we use in Haskell. Cheers, Will _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
-- Chris Allen Currently working on http://haskellbook.com