
On Sun, Jul 24, 2011 at 04:44:55PM +0100, Julian Porter wrote:
Well, speaking of rigour, I don't think applicative functors, etc are actually the right approach. Using the list monad gives a much clearer idea of what's going on, plus it's massively generalisable.
See http://jpembeddedsolutions.wordpress.com/2011/07/24/combining-haskell-lists-... for a description.
I don't see why this implies that "applicative functors are not the right approach". In fact, pairThem :: Monad m => a -> m b -> m (a,b) pairThem x ys = liftM2 (,) (return x) ys can be made *more generic* (which you yourself state is the main goal) as follows: pairThem :: Applicative m => a -> m b -> m (a,b) pairThem x ys = liftA2 (,) (pure x) ys Since every monad is also an applicative functor, this definition allows pairThem to be used with strictly more types. -Brent