[Haskell-cafe] MTL vs Free-monads, what are your experiences

Julian hasufell at hasufell.de
Mon Oct 17 18:06:31 UTC 2016


On 15/10/16 15:49, Joachim Breitner wrote:
> Hi,
> 
> Am Freitag, den 14.10.2016, 17:35 +0200 schrieb Damian Nadales:
>> Do you have
>> any experience using any of these approaches. If so would you mind
>> sharing? ;)
> 
> I don’t have an answer to contribute, but I would be very interested in
> hearing about experiences in terms of their relative runtime
> performance.
> 
> My gut feeling is that an an indirect function call for every (>>=),
> with many calls to `lift` each time, would make a deep monad
> transformer stack much more expensive. A free monad approach seems to
> be more sensible to me. But maybe GHC is doing a better job optimizing
> this than I would think?
> 
> So if you have any number-supported evidence about this, possibly from
> a real-world application where you tried to use one or the other,
> please share it with us!
> 

There's a paper from Oleg discussing "Freer Monads, More Extensible
Effects": http://okmij.org/ftp/Haskell/extensible/more.pdf

The conclusion there seems to be that the EE approach is more
"efficient". But you'll have to look at the concrete performance cases
and data yourself to make a judgement.



More information about the Haskell-Cafe mailing list