Copyright | (c) Kimiyuki Onaka 2021 |
---|---|
License | Apache License 2.0 |
Maintainer | kimiyuki95@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- run :: (MonadAlpha m, MonadError Error m) => Program -> m Program
- data Equation
- formularizeProgram :: MonadAlpha m => Program -> m [Equation]
- sortEquations :: [Equation] -> ([(Type, Type)], [(VarName, Type)])
- mergeAssertions :: [(VarName, Type)] -> [(Type, Type)]
- newtype Subst = Subst {}
- subst :: Subst -> Type -> Type
- solveEquations :: MonadError Error m => [(Type, Type)] -> m Subst
- substProgram :: Subst -> Program -> Program
Documentation
run :: (MonadAlpha m, MonadError Error m) => Program -> m Program Source #
run
does type inference.
- This assumes that program has no name conflicts.
Before:
let f = fun y -> y in let x = 1 in f(x + x)
After:
let f: int -> int = fun y: int -> y in let x: int = 1 in f(x + x)
internal types and functions
formularizeProgram :: MonadAlpha m => Program -> m [Equation] Source #
Subst
is type substituion. It's a mapping from type variables to their actual types.
solveEquations :: MonadError Error m => [(Type, Type)] -> m Subst Source #