4 ms·
And monads.
by sdegutis 10y ago
And monads.
- bertiewhykovich 10y agoMy suspicion is that no one wants to explain monads because if they did it would be painfully obvious that they're a purgatorial way of getting around the basic mismatch between functional purity and actual computers.
- kazagistar 10y agoNaw, everyone who understands monads wants nothing more then to explain it. Hence the profusion of tutorials and over-focusing on the concept.
- lmm 10y agoMonads for all your I/O yeah, probably kind of dumb. Monads as a tool for dealing with cross-cutting concerns? Ridiculously useful. http://reasonablypolymorphic.com/blog/ideas-and-men http://reasonablypolymorphic.com/blog/ideas-and-men has some basic examples.
- majewsky 10y agoActually, it's the other way around. Monad tutorials are so frequent that it's become a meme among Haskellers that everyone will eventually write a monad tutorial to relay his own mental model of monads.
- Nadya 10y agoAnd as someone who's read what is probably most of those tutorials - I fulfill the other half of the meme. "To understand monads, you first need to understand monads."
- bertiewhykovich 10y agoSorry -- you're right. I should have said "explain monads well."
- adilparvez 10y agoIn Haskell and PureScript, Monad is a typeclass just like any other. They are an abstraction, effectful computation is not inherent to them, they represent computational contexts, e.g. the list monad is used to model non-determinism, the maybe monad represents computations that can fail, both of these are pure. This is an excellent set of posts for building an intuition about monads: http://mvanier.livejournal.com/3917.html http://mvanier.livejournal.com/3917.html
- sdegutis 10y ago> the list monad is used to model non-determinism See this is the kind of thing that made learning Haskell so hard for me. I'm not a math guy, I'm terrible at math. I have no idea what "non-determinism" means, and I'd venture to guess that list monad is used to model "ordered collections of things".
- Senji 10y ago"non-determinism" implies unordered.
- bertiewhykovich 10y agoSee, to me, the sequence of keypresses I make while banging on my keyboard seem like it could be represented as an ordered list. I may be missing something, though.
- kodfodrasz 10y agoIf something is unordered it does not mean it may not be ordered. It only says you cannot assume that it is ordered. (A Collection in Java/C# is an unordered contract, but a List is also a Collection.) But the idea of a list also suggests an ordering to me.
- dpratt71 10y agoI'm not a math guy either and I did indeed find it difficult to penetrate the inner sanctum of Haskell for this very reason. I won't say I've completely succeeded in that effort, but I've come quite a long way. I'm fairly certain that in this context, non-determinism means that there can be more than one answer/result.