Hi, I'm learning Haskell, and I'm currently stuck on monads and monad (categorical) theory. Can someone write a paragraph of what exactly is a monad is haskell, in simple english? Or at least link to a good monad tutorial. Thank you.
I still couldn't write a paragraph in plain english on what they are, but I think I have a feel for them now.
Name:
Anonymous2007-07-25 19:04 ID:/kGBSc3M
Basically, it's some kind of type that somehow encapsulates another type (like the list or the maybe monads). It can contain "additional" data (i.e. state, like the IO monad, that contains the state of the world).
Using a special syntax (do) or operator (>>=), one can then apply functions on the contained value(s), such that the result is still encapsulated, and any state (possibly) preserved.
(>>=) :: (Monad m) => m a -> (a -> m b) -> m b
The type of (>>=) shows that, given a function (a -> M b), such as return, it can transform an M-monad value from type a to type b.
The do-syntax just makes it more pretty and less transparent.
Name:
Anonymous2007-07-25 19:16 ID:yMekHun8
Haskell is insane. All that fappery. When you need side effects, you have them. Shoving FP up your anus and making things complicated because of it is about as stupid as shoving OOP up your anus (as in Java). Right tool for the right job motherfuckers.
Name:
Anonymous2007-07-25 19:31 ID:I7LL+wCk
Monads = typed pipes. Think of doStuff >>= doMoreStuff as being basically the same sort of operation as cat foo | bar and you'll be happy.