
26 Sep
2017
26 Sep
'17
12:59 p.m.
Hello everyone, Just trying to understand the sequence function as follows: sequence [Just 1] -- evaluates to Just [1] sequence = foldr mcons (return []) where mcons p q = p >>= \x -> q >>= \y -> return (x:y) -- I'm trying to walk through the code as follows, I understand what is below isn't -- haskell code p >>= \x -> [] q >>= \y -> Just 1 return (x:y) -- [] : Just 1 Am I thinking of sequence correctly here? Best regards, Jim