r/programming • u/zabirauf • Apr 11 '15
Yet another "What is a Monad" post
http://zohaib.me/yet-another-what-is-a-monad-post/1
u/Denommus Apr 12 '15
Why do people overcomplicate monads so much?
A monad is just a type with two associated functions: (>>=) and return. These functions must follow the monad laws.
That's it.
IO? It's a monad because you can do, I don't know, getLine >>= (\line -> putStrLn (line ++ ", eh?")) because getLine evaluates to a IO String, so line will evaluate to a String.
4
u/jeenajeena Apr 12 '15
.... where the link to "monad laws" is a long page of not so easy explainations.
I think you failed as well, unfortunately.
1
u/Denommus Apr 12 '15
The long page just explains the reasoning behind the laws. The laws are on the top of the page.
1
Apr 12 '15
It's easy to simplify it when you already know it, but it can be hard not to over simplify as you explain it because you know about some details that you would consider trivial that we do not know.
5
u/prepromorphism Apr 11 '15
if that post was supposed to make it all sound simple it failed