liftIO not working in ActionM

53 views
Skip to first unread message

Adriaan

unread,
Feb 18, 2015, 7:28:55 AM2/18/15
to af...@googlegroups.com
We're having some trouble doing IO in Scotty. Trying to compile this program

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Web.Scotty
import Data.Monoid
import Data.Text.Lazy
import Control.Monad.Trans

main :: IO ()
main = scotty 3000 $ do
    get "/" serve
    post "/" serve
  where
    serve :: ActionM ()
    serve = do
        liftIO $ putStrLn "test"
        return ()


results in the following error:

 TestScotty.hs:16:9:
    No instance for (MonadIO
                       (Web.Scotty.Internal.Types.ActionT Text IO))
      arising from a use of ‘liftIO’
    In the expression: liftIO
    In a stmt of a 'do' block: liftIO $ putStrLn "test"
    In the expression:
      do { liftIO $ putStrLn "test";
           return () }


Is it possibly a problem with our set-up or are we missing something?


Tack på förhand!
Reply all
Reply to author
Forward
0 new messages