Happstack ServerPart missing instance of MonadIO?
The following code:
import Control.Monad.IO.Class
import Happstack.Server
test :: ServerPart String
test = liftIO (putStrLn "Test") >> ok "Test"
main = simpleHTTP nullConf test
won't compile with message:
No instance for (MonadIO (ServerPartT IO))
arising from a use of `liftIO'
Possible fix:
add an instance declaration for (MonadIO (ServerPartT IO))
In the first argument of `(>>)', namely `liftIO (putStrLn "Test")'
In the expression: liftIO (putStrLn "Test") >> ok "Test"
In an equation for `test':
test = liftIO (putStrLn "Test") >> ok "Test"
A MonadIO instance appears to be present here:
but adding imports Happstack.Server.Monads
didn't change anything, so I was hoping someone could point out what I was doing wrong?
+3
source to share
No one has answered this question yet
Check out similar questions: