2 ms·
Yeah for some reason this explanation which should be simple just blows my mind. I’m probably too experienced in imperative languages. It took me a long time to
by quickthrower2 5y ago
Yeah for some reason this explanation which should be simple just blows my mind. I’m probably too experienced in imperative languages. It took me a long time to grok plain old monads. And when you get those GHC compiler errors from heavily stacked up types I find it very hard to work out what went wrong. For practical purposes I prefer OO even though it might be more limited in some regards.
- mjburgess 5y agop = newPerson(); w = walk(p); t = talk(p, w); s = shout(p, t); becomes, seq(shout, seq(talk, seq(walk, seq(newPerson()))) "infix", newPerson() seq walk seq talk seq shout The operations `newPerson` and `seq` form a monad. If you can omit `w =`, `t=`, and `s=` you have an applicative, rather than a monad. Ie., the operations being sequenced are independent.