[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
g?
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
b"?
Thanks for any comments!
Thomas
-------------- 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