Great presentation! I finally got the pain of stacking multiple(>2) monads with concrete example, and motivation for mtl (or eff).
@mircea_h
4 жыл бұрын
Nice presentation, thank you ! One other aspect is monad transformer performance hit. They are known to be quite slow once you begin to stack them. MTL helps here too.
@guillaumebogard5880
4 жыл бұрын
I am glad you liked it :) It's true monad transformers come at the cost of *some* overhead. But so far I haven't witnessed an application where the cost of transformers would be too much of an issue. I believe for most applications this cost will be negligible, as other factors such as external IO (databases, web services etc) are most likely to be your bottleneck. I wouldn't worry too much about it unless your application is more CPU-bound (the applications I've worked on so far are mostly IO bound), and even then, optimizing your algorithms and fine tuning the JVM can get you performance boosts than *sort-of* mitigate the cost of transformers. I guess, like most things, that transformers shouldn't be overused though :)
@daniellopes6874
4 жыл бұрын
Monads don't compose, that is the reason we need Monad Transformers and MTL. flatMap describes sequential computation, not composition in the functional sense, I guess.
Пікірлер: 4