2 ms·
Here's a common example of a monad being used in a non-stateful way: map (* 2) [1,2,3,4] Yep, that's a function on a monad — lists are monads. The same func
by chc 16y ago
Here's a common example of a monad being used in a non-stateful way:
map (* 2) [1,2,3,4]
Yep, that's a function on a monad — lists are monads. The same function can be written:
[1,2,3,4] >>= return . (* 2)