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) |
Lack of subtyping makes inference easy
Here is my Scala approximation: https://gist.github.com/cvogt/bda9bd48578ccccc2d1e
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's start writing some Haskell.