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:

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

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





All Articles