[Haskell-cafe] Sequencing Operations in a Monad

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Sat Sep 15 02:21:51 EDT 2007


>  If you arrange the types to try to do all the operations inside the IO
> monad you can't chain together more than 1 binary operation.  eg.
> 
> do
>    S <- A + B
>    Z <- Q * S
> 
> vs
> 
> do 
>    S <-  Q * (A + B)
> 
> Are there any suggestions for this dilemma?  Am I using the wrong monad for
> this task?

I'm not sure if this is what you are asking but isn't liftM2 or some
variant what you need?

Dominic.



More information about the Haskell-Cafe mailing list