For a college assignment I am learning Haskell and when reading about the do-notation and sequencing with >>=
and >>
I came across this behaviour that I did not expect.
[1,2,3] >> [1] -- returns [1,1,1]
Can anyone explain why every element of the first array is replaced by the elements of the second array? It seems like the list is concatenated in some way, while I expected the result of the first expression to be completely ignored, thus I would expect [1]
as the result.
Thanks a lot in advance.