在haskell中使用IO映射?

dev*_*vel 1 haskell

嗨,我需要有关haskell中的map函数和IO操作的帮助.

我有一个List喜欢[(x,(y,z))]和我想给一个函数列表中的每个项目,所以我想使用map的问题是,该函数看起来像:

test :: (String, (String, String)) -> IO (String, String, (String, String))
test (a,(b,c)) = do
    -- some IO stuff
    return (a,b, (c,c))
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用map(map test myList)时,我得到一个错误,因为它是IO,如何解决这个问题?

Lan*_*dei 5

您是否尝试使用mapM(来自Control.Monad)?

(对不起,没有更多代码我只能猜)