So I'm trying to understand exactly how the Haskell do
notation works.
I understand that it is used together with monads and that it basically expands (since it's actually syntactic sugar) into anonymous functions connected with either bind (>>=
) or then (>>
) as shown here https://en.wikibooks.org/wiki/Haskell/Syntactic_sugar#Do_notation.
However my question is why the following command
Prelude> do [1, 2, 3]; "hello"
returns
"hellohellohello"
I know that arrays are actually monads (and that strings are arrays of chars) but I fail to see how this results in the behavior above.