
30 Apr
2009
30 Apr
'09
3:22 a.m.
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