I have:
stuff :: IO [String]
doThings :: String -> IO [()]
and I want to
stuff >>= doThings
but my types are off. I want to do a lifted bind essentially but everything I try is subtly wrong.
If you've got lots of such functions, this is the textbook usecase of ListT:
main = runListT $ do
string <- ListT stuff
ListT $ doThings string
do xs <- stuff; mapM_ doThings xs? What exactly are you trying to do. Also:[()]is a pretty useless type. Isn't anIntenough? Or can't you just have the typeString -> IO ()? - Bakuriu[()]to()and usedmapM_, it worked great! - Sandy Vanderbleek[()](assuming you have some reason to want that) by usingmapM. Notice the trailing_in Haskell typically means "ignore the result(s)". - Thomas M. DuBuisson