
29 Jul
2008
29 Jul
'08
5:48 p.m.
On Tue, Jul 29, 2008 at 8:57 AM, Jefferson Heard
I tried using liftM on writeFile, but it then complained that "newanns" was a string instead of a list of strings, which I don't understand at all.
liftM isn't what you think it is.
liftM :: (a -> b) -> (m a -> m b) which is doing something weird depending how you inserted it: liftM (writeFile "x") :: Monad m => m String -> m (IO ()) which could theoretically have m get forced to be a list as the typechecker tries to figure out how to decipher this mess... liftM (writeFile "x") :: [String] -> [IO ()] or something else weird.
You are looking for either lift or liftIO, from Control.Monad.Trans
lift :: (Monad m, MonadTrans t) => m a -> t m a liftIO :: MonadIO m => IO a -> m a
-- ryan