Hey,

Thanks for all the suggestions. I was hoping that there was some uniform
pattern that would extend to n arguments (rather than having to use
liftM2, litM3, etc. or have different 'application' operators in between
the different arguments); perhaps not. Oh well :)

Sure you can!  What you want is Control.Applicative, not Control.Monad.

(<*>) is the generic application you're looking for:

> pure (+) <*> [1,2,3] <*> [4,5,6]
[5,6,7,6,7,8,7,8,9]

Note that pure f <*> y can be shortened to fmap though, which Control.Applicative defines a handy infix version of:
> (+) <$> [1,2,3] <*> [4,5,6]
[5,6,7,6,7,8,7,8,9]

Hope that provides what you want

Bob
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to