Newbie : What does the sequence function make?

Please,can anyone explain it to me? Cheers! ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

On Monday 02 May 2005 19:42, mandziy@web.de wrote:
Please,can anyone explain it to me?
From http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control.Monad.htm... sequence :: Monad m => [m a] -> m [a] Evaluate each action in the sequence from left to right, and collect the results. Another way to explain what sequence does is the following implementation, which I find a bit easier to understand for the beginner than the one given in http://www.haskell.org/onlinelibrary/standard-prelude.html : sequence [] = [] sequence m:ms = do x <- m xs <- sequence ms return (x:xs) HTH, Ben

Benjamin Franksen wrote:
Another way to explain what sequence does is the following implementation, which I find a bit easier to understand for the beginner than the one given in http://www.haskell.org/onlinelibrary/standard-prelude.html :
sequence [] = [] sequence m:ms = do x <- m xs <- sequence ms return (x:xs)
Except that this definitions has a syntax error and a type error (or just a different type if you provide no signature). -- Lennart

On Monday 02 May 2005 20:52, Lennart Augustsson wrote:
Benjamin Franksen wrote:
Another way to explain what sequence does is the following implementation, which I find a bit easier to understand for the beginner than the one given in http://www.haskell.org/onlinelibrary/standard-prelude.html :
sequence [] = [] sequence m:ms = do x <- m xs <- sequence ms return (x:xs)
Except that this definitions has a syntax error and a type error (or just a different type if you provide no signature).
Oh dammit, sorry. This is what I meant: sequence [] = return [] sequence (m:ms) = do x <- m xs <- sequence ms return (x:xs) Cheers, Ben

At 19:42 02/05/05 +0200, mandziy@web.de wrote:
Please,can anyone explain it to me? Cheers!
This may be a bit late, and others have responded, but just in case it helps you might peek at: http://www.ninebynine.org/Software/Learning-Haskell-Notes.html#Sequence #g ------------ Graham Klyne For email: http://www.ninebynine.org/#Contact

Graham Klyne wrote:
This may be a bit late, and others have responded, but just in case it helps you might peek at: http://www.ninebynine.org/Software/Learning-Haskell-Notes.html#Sequence
It is never to late, I appreciate it. For beginner it is not the simplest function to understand... :-)
participants (5)
-
Benjamin Franksen
-
Graham Klyne
-
Khrystyna Mandziy
-
Lennart Augustsson
-
mandziy@web.de