Nottingham FP Lab Blog

The internal workings of GHC

by Graham on October 5, 2007.
Tagged as: Lunches.

Andy Gill from Galois visited today, and talked about two of the key ideas in the Glasgow Haskell Compiler: the simple data type that is used to represent expressions (copied below), and the manner in which unboxed values are handled.

data Expr b =   — “b” for the type of binders,
  Var      Id
  |  Lit     Literal
  |  App   (Expr b) (Arg b)
  |  Lam   b (Expr b)
  |  Let    (Bind b) (Expr b)
  |  Case  (Expr b) b Type [Alt b]
  |  Cast  (Expr b) Coercion
  |  Note  Note (Expr b)
  |  Type  Type  

type Arg b = Expr b

type Alt b = (AltCon, [b], Expr b)

data AltCon =
DataAlt DataCon
| LitAlt Literal
deriving (Eq, Ord)

data Bind b =
NonRec b (Expr b)
| Rec [(b, (Expr b))]

comments powered by Disqus