You're running into the same problem I describe here, at least as far as having incorrect code that typechecks when it should actually give a type error: Why is the type of "Main.main", "IO ()" and not "IO a"?. This is why you should always give main
the type signature main :: IO ()
explicitly.
To fix the problem, you will want to replace return
with lift
(see http://hackage.haskell.org/package/transformers/docs/Control-Monad-Trans-Class.html#v:lift) and replace sequence $ map ...
with mapM_
. mapM_ f
is equivalent to sequence_ . map f
.