4 ms·
Make an interactive tutorial for monads. After 5 articles about it, who were all very different, I still don't know how to code one.
by sek 14y ago
Make an interactive tutorial for monads. After 5 articles about it, who were all very different, I still don't know how to code one.
- merijnv 14y agoThe majority of monad "tutorials" are notoriously terrible. Have you read "You Could Have Invented Monads! (And Maybe You Already Have.)"? If no, you should try it, it's a rather nice article. If yes, where did you get stuck with trying to implement your own?
- merijnv 14y agoBah, I just noticed I completely forgot to include the link for the lazy: http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html http://blog.sigfpe.com/2006/08/you-could-have-invented-monad...
- tinco 14y agoWhy do you want to code one? Monads are a class of solutions to certain problems. Look at your problem and solve it using regular haskell. Now look at your solution, it might be that the set of functions that define your solution describe a monad. Is this relevant? Usually not, unless you are developing a highly reusable library. An example: almost every FP course has the students define the Maybe datatype with its accompanying functions. In Haskell Maybe is an instance of Monad, but you don't need to know that to use or make Maybe, it just turns out that the Maybe solution is in that class of Monads.
- nilkn 14y agoLook at Parsec to see how powerful monadic code can be. That single-handedly cleared up the issue for me when I was learning Haskell.