Happstack ServerPart缺少MonadIO实例?

时间:2015-07-29 02:47:37

标签: haskell happstack

以下代码:

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实例:

http://hackage.haskell.org/package/happstack-server-7.4.0/docs/Happstack-Server-Monads.html#t:ServerPartT

但是添加Happstack.Server.Monads导入并没有改变任何内容,所以我希望有人可以指出我做错了什么?

0 个答案:

没有答案