[Haskell-cafe] Monads and Functions sequence and sequence_
Gregory Crosswhite
gcross at phys.washington.edu
Sat Oct 30 01:13:10 EDT 2010
The expression
sequence [a,b,c,...]
is roughly equivalent to
do
r_a <- a
r_b <- b
r_c <- c
...
return [r_a,r_b,r_c,...]
The expression
sequence_ [a,b,c,...]
is roughly equivalent to
do
a
b
c
...
return ()
Does that help?
Cheers,
Greg
On 10/29/10 10:07 PM, Mark Spezzano wrote:
> Hi,
>
> Can somebody please explain exactly how the monad functions "sequence" and "sequence_" are meant to work?
>
> I have almost every Haskell textbook, but there's surprisingly little information in them about the two functions.
>
> From what I can gather, "sequence" and "sequence_" behave differently depending on the types of the Monads that they are processing. Is this correct? Some concrete examples would be really helpful.
>
> Even references to some research papers that explain the rationale behind these (and all the other..?) monad functions would be great.
>
> Thanks in advance,
>
>
> Mark Spezzano
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
More information about the Haskell-Cafe
mailing list