[Haskell-beginners] stream of monadic calculations

Daniel Trstenjak daniel.trstenjak at gmail.com
Tue Oct 2 20:13:39 CEST 2012


Hi Christopher,

On Tue, Oct 02, 2012 at 10:12:44AM -0800, Christopher Howard wrote:
> Say I've got a stream of monadic calculations, like so:
> 
> code:
> --------
> do a' <- f a
>    a'' <- g a'
>    a''' <- h a''
>    return a'''
> --------
> 
> There is a cleaner way to do that, yes? (Without using all the tick marks?)

foldM (\a f -> f a) a [f, g, h]


Greetings,
Daniel



More information about the Beginners mailing list