[Haskell-cafe] MTL vs Free-monads, what are your experiences
Alberto G. Corona
agocorona at gmail.com
Sun Oct 16 08:48:11 UTC 2016
There may be another third way to encode effects:
Maybe it is possible to demonstrate that every effect may be a combination
of state (data) and continuations (processing). I donĀ“t know if this is
true, but it is very likely.
If a monad can handle user defined states (in a pure way, like the state
monad) and continuations, then the programmer can implement any new effect
by combining them.
With continuation effect I mean that each monadic statement can inspect
and make use of his own computation in which it is inserted (his closure)
and his continuation.
The effects are added by creating new primitives, instead of aggregating
new monad transformers (mtl) or declaring new effects (the free monad).
I implemented reactivity, backtracking, streaming and other high level
effects besides readers, writers and other conventional effects using this
approach, in the package transient.
The advantage is Expressive power (high level effects), composability,
simple type signatures, and extensibility by means of a single expression.
It may be necessary to have more than one monad when we want to enforce
certain effects that are performed when one monad is converted into to
another, trough the type system
2016-10-16 2:28 GMT+02:00 John Wiegley <johnw at newartisans.com>:
> >>>>> "O" == Oleg <oleg at okmij.org> writes:
>
> O> and require the boilerplate of writing functor instances
>
> Just note, since DeriveFunctor there is almost never any such boilerplate
> in
> these cases.
>
> --
> John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F
> http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2
> _______________________________________________
> 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.
>
--
Alberto.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20161016/000a62ed/attachment.html>
More information about the Haskell-Cafe
mailing list