> I'm loving learning Haskell quite a bit. > It is stretching my brain but in a delightfull way.
Great! > Using the cool lambdabot "pointless" utility I found out that: > >> \x -> snd(x) - fst(x) > > is the same as: > >> liftM2 (-) snd fst Yes, the '(->) c' monad is very handy. One way to think about it is viewing 'f :: c -> a' as a set of 'a''s, indexed by the set of 'c''s. The monad operations are then easily understood as doing things 'pointwise': given some specific index (e.g. 'x'), you use this index to select the appropriate value of every relevant indexed object (e.g. 'snd' and 'fst'), and then apply the unlifted function (e.g. '(-)') to those. Another way to write the above function is 'uncurry (flip (-))', or 'uncurry subtract'. Regards, Arie _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe