Skip to content

Instantly share code, notes, and snippets.

@aostiles
Created May 31, 2014 23:05
Show Gist options
  • Save aostiles/fb8d5e22881cdb05e5fa to your computer and use it in GitHub Desktop.
Save aostiles/fb8d5e22881cdb05e5fa to your computer and use it in GitHub Desktop.
module IHaskell.Eval.RIO (RIO(), runRIO, IHaskell.Eval.RIO.putStrLn, IHaskell.Eval.RIO.putStr,MyGhcMonad) where
import qualified System.IO
import GHC
-- Notice that symbol UnsafeRIO is not exported from this module!
newtype RIO a = UnsafeRIO { runRIO :: IO a }
type MyGhcMonad = GhcT RIO
instance Monad RIO where
return = UnsafeRIO . return
(UnsafeRIO m) >>= k = UnsafeRIO $ m >>= runRIO . k
putStrLn :: String -> RIO ()
putStrLn s = UnsafeRIO (System.IO.putStrLn s)
putStr :: String -> RIO ()
putStr s = UnsafeRIO (System.IO.putStr s)
print :: Show a => a -> RIO ()
print s = UnsafeRIO (System.IO.print s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment