[Haskell-cafe] (liftM join .) . mapM

Kim-Ee Yeoh a.biurvOir4 at asuhan.com
Tue Dec 29 07:44:23 EST 2009


I'd write it as

foo f = join .<$> sequence . (f <$>)

where
(.<$>) :: (.<$>) :: Functor f => (a -> b) -> ((x -> f a) -> (x -> f b))
x .<$> y = (x <$>) . y

is part of my line-noise toolbox.

This join .* sequence family of functions is quite common. 
Should really have a name for them.



Tony Morris-4 wrote:
> 
> Can (liftM join .) . mapM be improved?
> (Monad m) => (a -> m [b]) -> [a] -> m [b]
> 

-- 
View this message in context: http://old.nabble.com/%28liftM-join-.%29-.-mapM-tp26953786p26954040.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list