3 ms·
> Little need for monads to do this: What do you think >>= is? It is the piece unique to Monads. So your “little need for monads” example shows the opposite.
by dragonwriter 5y ago
> Little need for monads to do this:
What do you think >>= is? It is the piece unique to Monads.
So your “little need for monads” example shows the opposite.
- bradrn 5y agoIf you’re willing to take input on stdin, you can rewrite it without >>=: main = interact number where number = lines . zipWith addNumber [0..] . unlines addNumber n l = show n ++ " " ++ l My point is that the logic itself does not require the idea of monadic sequencing — it’s relevant only for the minimal amount of surrounding IO.