[Haskell-beginners] Problem combining monads <sigh!>

Daniel Trstenjak daniel.trstenjak at gmail.com
Mon Apr 7 09:20:22 UTC 2014


Hi John,

for some versions you almost did it ;).

> λ>return (+7) =<< [1,2,3]

   return . (+7) =<< [1,2,3]

> λ>[1,2,3] >>=  (+7).return

   [1,2,3] >>= return . (+7)


It's really helpful to look at the types:

   > :t return (+7)
   return (+7) :: (Monad m, Num a) => m (a -> a)
   > :t return . (+7)
   return . (+7) :: (Monad m, Num b) => b -> m b


Greetings,
Daniel


More information about the Beginners mailing list