>>1
A monad is something you can connect in a sequence so that the choice of a step can depend on the results of previous steps. In other words, it's the most natural way to exress sequences of actions.
>>5 A monad is something you can connect in a sequence so that the choice of a step can depend on the results of previous steps. In other words, it's the most natural way to exress sequences of actions.
Is this a monad then?
int
something (int a)
{
int b = somethingElse (a);
int c = somethingElse (b);
int d = somethingElse (c);
return somethingElse (d);
}
A monad is the crap, which haskell-fags use, instead of delimited continuation, to precisely control the execution of code. Basically it allows you to slice your usual linear PROGN into serial-lambdas, which allows injection of some other code between their compositions. One example of monads being Unix-like pipes executing in parallel. Basically, if you know continuation-passing-style or x86 assembly push/jmp/pop/ret sequence, you know monads.
Name:
Anonymous2014-03-25 14:17
>>7
can I has more explain?
what's the difference between continuations and this?
What's the pros and cons of each of them?
Name:
Anonymous2014-03-25 14:37
>>6
Yes, and the semi-colons are the monadic >>= (a.k.a. bind). The difference is that Haskellers can overload the semi-colon in lots of ways and the compiler can ensure that monadic code stays in one particular monad and doesn't drip into another (like doing IO inside an STM transaction).
>>9
Thank you kindly sir
sussman, stallman and the holly G.d bless you
Name:
Anonymous2014-03-25 14:45
>>6
By the way, the functional languages Clean and Mercury actually do use uniqueness typing for their IO. Haskellers, on the other hand, thought monads arere cleaner (as they eliminate the need to explicitly thread state through a sequence of actions).
Name:
Anonymous2014-03-25 15:05
>>11
As far as I know IO monads can be implemented via uniqueness typing
What do you like more btw?