[Haskell-beginners] list monad question
Matthias Guedemann
matthias.guedemann at ovgu.de
Fri Oct 30 09:01:20 EDT 2009
Hallo David,
> If I understood what you ask this time, there's a function in
> Control.Monad that does it :
> allN = replicateM
>
> replicateM 4 [ 1,2,3 ] = [ [ 1,1,1,1],[1,1,1,2], ....
that is exactly what I wanted, thanks a lot. Next time I will state the question
more clearly :-)
> when you write
>
> a <- ls
> b <- ls
> c <- ls
>
> You perform the monad "action" 3 times, collecting the result in a
> then b, then c.
> now replicateM performs a monad action n times, collecting the result in a list.
> turns out that making a list of the result is exactly what you want.
Maybe I should have a closer look at Control.Monad, a lot seems to be there
already.
best regards,
Matthias
--
__________________________________________________________
___ __ __
Dipl. Inf. Matthias Guedemann / __\/ _\ /__\
Computer Systems in Engineering / / \ \ /_\
Otto-von-Guericke Universitaet Magdeburg / /___ _\ \//__
Tel.: 0391 / 67-19359 \____/ \__/\__/
__________________________________________________________
More information about the Beginners
mailing list