by jabagawee · 12y ago · 0 comments
EDIT: While I have your attention, do you mind also pointing me to some resources to learn about this ">>=" operator? I recall it's something related to monads...
As for `>>=` (also known as `bind`), I'm using it as a more generic version of `concatMap`. The following expressions are basically the same:
concat (map (\ x -> [x, -x]) [1, 2, 3])
concatMap (\ x -> [x, -x]) [1, 2, 3]
[1, 2, 3] >>= \ x -> [x, -x]
If you want to learn more, check out LYAH [1].do x <- foo; y <- bar; baz x y
foo >>= \x -> bar >>= \y -> baz x y