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
haskell happstack


source to share


No one has answered this question yet

Check out similar questions:

4
How do I access the happstack response code?
4
Correct use of do notation
3
Is there a way to get the "current route" in the Happstack?
3
Reducing redundancy in happstack script code
3
CSS with Happstack
1
Create your own random response code
1
Happstack - world hello server
1
HappStack Event Files
0
Launch HAppStack withot cabal application
0
Haskell Happstack



All Articles
Loading...
X
Show
Funny
Dev
Pics