[Haskell-beginners] List Function

Yitzchak Gale gale at sefer.org
Thu Apr 30 03:22:30 EDT 2009


Brent Yorgey wrote:
>>   Prelude Control.Applicative> liftA2 (,) [1,2,3] [4,5,6]
>>   [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]

Edward Z. Yang wrote:
> I'm not even going to try to understand that now.

Brent used that because Applicative is even simpler
than Monad - at least theoretically. But it's less well
known at the moment.

If you want to stick to Monad, Brent's method works
there too:

  Prelude Control.Monad> liftM2 (,) [1,2,3] [4,5,6]
  [(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,4),(3,5),(3,6)]

-Yitz


More information about the Beginners mailing list