Skip to content

Instantly share code, notes, and snippets.

@CoderPuppy
Last active September 23, 2016 21:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CoderPuppy/235a4e543e77238d3f9c6c127345067d to your computer and use it in GitHub Desktop.
Save CoderPuppy/235a4e543e77238d3f9c6c127345067d to your computer and use it in GitHub Desktop.
Amulet Type AST "Analysis"
data Type = TName TypeName -- Foo
| TVar TypeVar -- a
| TLambda TypeVar Type -- \(a : Type) => b -- not strictly necessary
| TForAll TypeVar Type -- \{a : Type) => b
| TExists TypeVar Type -- (a : Type ** b)
| TFunc Type Type -- a -> b
| TArrow Constraint Type -- a => b
| TInst Type Type -- a b
type Nat f g = forall a. f a -> g a
Nat f g {a} = f a -> g a
Nat = \(f : Type) => \(g : Type) => \{a : Type} => f a -> g a
Nat = TLambda "f" $ TLambda "g" $ TForAll "a" $ TFunc (TInst (TVar "f") (TVar "a")) (TInst (TVar "g") (TVar "a"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment