Skip to content

Instantly share code, notes, and snippets.

@lazyvalue
Created September 21, 2014 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lazyvalue/af7cd9562937e75c2eaf to your computer and use it in GitHub Desktop.
Save lazyvalue/af7cd9562937e75c2eaf to your computer and use it in GitHub Desktop.
Monad transformers are pretty good at type inference
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)
@peterjanovsky
Copy link

Let's start writing some Haskell.

@pedrofurla
Copy link

Lack of subtyping makes inference easy

@cvogt
Copy link

cvogt commented Sep 21, 2014

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