Created
September 21, 2014 06:59
-
-
Save lazyvalue/af7cd9562937e75c2eaf to your computer and use it in GitHub Desktop.
Monad transformers are pretty good at type inference
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
import Control.Monad.Identity | |
import Control.Monad.Error | |
type Scott = ErrorT String Identity Int | |
myf :: Int -> Scott | |
myf i = return i | |
lar :: Scott | |
lar = do | |
x <- myf 4 | |
y <- myf 9 | |
return $ y + x | |
main :: IO () | |
main = do | |
print "lar lar lar" | |
print $ runIdentity (runErrorT lar) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lack of subtyping makes inference easy