[Haskell-beginners] combine concatMap and mapM

Renah Scarowsky renahs at suite-sol.com
Mon Feb 17 10:38:47 UTC 2014


Hi,

How would I combine the functionalities of concatMap and mapM to define a function like:
Monad m => (a  -> m [b]) -> [a] -> m [b]

I need to create a recursive function within the IO monad which results in a list of the original type.
So something like:
goX :: MonadIO m => x -> m [x]
goX = do
....
x includes within it a list of xs, let's call it (children x)
I need to call goX on each of the children and get a modified list of children as result
ys <- ?
return $ x { children = ys } : zs


Thanks,

Renah Scarowsky
Suite Solutions
Create>Manage>Deploy
http://www.suite-sol.com<http://www.suite-sol.com/>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20140217/615e023b/attachment.html>


More information about the Beginners mailing list