以下代码:
import Control.Monad.IO.Class
import Happstack.Server
test :: ServerPart String
test = liftIO (putStrLn "Test") >> ok "Test"
main = simpleHTTP nullConf test
无法使用以下消息进行编译:
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"
这里似乎有一个MonadIO实例:
但是添加Happstack.Server.Monads
导入并没有改变任何内容,所以我希望有人可以指出我做错了什么?