[Haskell-beginners] foldM with tuple and maybe

Miro Karpis miroslav.karpis at gmail.com
Mon Dec 30 23:42:26 UTC 2013


Hi, please can you help me with following?

I have a following function:
f1 :: (String, String) -> IO (Maybe String)

which I would like to apply to a list of tuples.I have defined the function
like this, but that gives me error (below):

f2 :: [(String, String)] -> IO (Maybe String)
f2 x = foldM f1 0 x


error:
Couldn't match expected type `IO (Maybe String)'  with actual type `[b0] ->
m0 (String, String)' In the return type of a call of `foldM'

thanks,
m.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20131231/a9a5ec23/attachment.html>


More information about the Beginners mailing list