kseo / systemf

An implementation of System F in Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple

An implementation of System F in Haskell

Overview

systemf is an implementation of System F presented by Benjamin C. Pierce in his Types and Programming Languages. I transliterated the original source code written in OCaml into Haskell except for the parser which I rewrote in Parsec.

Syntax

  • Variables: x
  • Applications: x x
  • Lambda abstractions: \x.x
  • Type abstractions: /\X.X
  • Conditional: if x then y else z
  • Booleans: true, false
  • Universal quantification: All X.X->X
  • Existential quantification : {*All Y.Y, \x:(All Y.Y). x} as {Some X,X->X}

Implementation Details

  • The representation of a variable is a number - its De Brujin index
  • Evaluation performs substitution

REPL

systemfi is a REPL where you can input a lambda calculus term.

% \x:Bool.x
(\x:Bool.x)
$ {*All Y.Y, \x:(All Y.Y). x} as {Some X,X->X}
(\x:(All X.(X->X)).x)

About

An implementation of System F in Haskell

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Haskell 100.0%