On Oct 30, 2010, at 2:30 PM, Mark Spezzano wrote:

If you use the type with Maybe Int like so:

sequence [Just 1, Nothing, Just 2]

then the result is Nothing.

Whereas sequence [Just 1, Just 2, Just 3] gives

Just [1, 2, 3]

Try

    do x <- Just 1
       y <- Nothing
       z <- Just 2
       return [x,y,z]

and

    do x <- Just 1
       y <- Just 2
       z <- Just 3
       return [x,y,z]

The results are the same as with your calls of `sequence`. It is >>= which makes the difference, not `sequence`.

Sebastian
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to