Created
May 2, 2011 21:14
-
-
Save tomasv/952379 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Control.Monad.Writer | |
import Control.Monad.Reader | |
rwt :: A Int | |
rwt = ask >>= \x -> tell ("Got " ++ show x) >> return (x * 2) | |
type A = ReaderT Int (WriterT String Maybe) | |
runA :: A a -> Int -> Maybe (a, String) | |
runA app i = runWriterT (runReaderT app i) | |
main = do | |
let ee = runA rwt 6 | |
putStrLn $ (show ee) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment