2008/2/23, Harri Kiiskinen <[EMAIL PROTECTED]>: > Dear All, > > banging my head against Haskell, but liking the feeling of hurting > brains. Just a simple question: > > If > > fmap (^4) [1,2,3] >>= \i -> shows i " " > > gives > > "1 16 81 "
In the List Monad, (>>=) is defined as concatMap, so this code can be translated by : > concatMap (\i -> shows i " ") (fmap (^4) [1,2,3]) shows is applied to each elements of the list, then the strings are concatened. Whereas in > let xs = fmap (^4) [1,2,3] in shows xs " " shows is applied to the whole list. -- Jedaï _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
