Skip to content

Instantly share code, notes, and snippets.

@gsg
Created August 18, 2015 16:05
Show Gist options
  • Save gsg/5a22d2e6a543c7aef006 to your computer and use it in GitHub Desktop.
Save gsg/5a22d2e6a543c7aef006 to your computer and use it in GitHub Desktop.
type binop = Add | Sub | Mul | Div
type cmpop = Lt | Gt | LtEq | GtEq | Eq | NotEq
type 'a arith = AInt : int arith | AFloat : float arith
type 'a comparable =
| CBool : bool comparable
| Arith : 'a arith -> 'a comparable
type 'a expr =
| Bool : bool -> bool expr
| Int : int -> int expr
| Float : float -> float expr
| BinOp : 'a arith * binop * 'a expr * 'a expr -> 'a expr
| Cmp : 'a comparable * cmpop * 'a expr * 'a expr -> bool expr
| Not : bool expr -> bool expr
| And : bool expr * bool expr -> bool expr
| Or : bool expr * bool expr -> bool expr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment