e.g.
a <- [2] …
gives a the value of 2, unwrapping the List monad (only works if the return value of the function is a List of some kind).
The above could also be written:
[2] >> (\a -> …)
It’s been a while since I’ve done much with haskell, so forgive me if I’ve mis-remembered something.
a <- [2]
binds a to 2, rather than [2], makes no sense.
edit:
a better example (because it is more useful) would be:
a <- Just 2
which, again, binds a to 2, unwrapping the Maybe monad in the process. (I forget what happens if you try to do a <- Nothing)
I think I’ll live with 1 less karma ;)
e.g.
a <- [2] …
gives a the value of 2, unwrapping the List monad (only works if the return value of the function is a List of some kind).
The above could also be written:
[2] >> (\a -> …)
It’s been a while since I’ve done much with haskell, so forgive me if I’ve mis-remembered something.