You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

20 lines
393 B

module Hypo where
import Control.Monad.Trans.Reader
import Control.Monad.Trans.Maybe
-- r -> Maybe a
foo :: Int -> ReaderT Int Maybe Int
foo a = return a
-- (Reader r) (Maybe a)
-- r -> Maybe a
bar :: Int -> MaybeT (Reader Int) Int
bar a = return a
-- looks pretty much the same to me...
main :: IO ()
main = do
print $ runReaderT (foo 1) 5
print $ runReader (runMaybeT (bar 1)) 5