[Haskell] mapM with Traversables

thomas burt thedwards at gmail.com
Thu Sep 29 01:27:58 CEST 2011

Hi -

I have a function, "f :: Monad m => a -> m b", as well as a list of a's. I'd
like to produce a sequence (Data.Sequence) of b's, given the a's:

g :: [a] -> m (Seq b)
g a = do Data.Traversable.mapM f a   -- type error!

I see that "Data.Traversable.mapM f a" doesn't work... is this like asking
the compiler to infer the cons/append operation from the type signature of

Do I need to write my own function that explicitly calls the "append"
functions from Data.Sequence or can I do something else that would work for
any "g :: Traversable t, Traversable u => t a -> m (u b)" given "f :: a -> m

Thanks for any comments!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell/attachments/20110928/ed72d11c/attachment.htm>

More information about the Haskell mailing list