Skip to content

Instantly share code, notes, and snippets.

@gsg
Created March 15, 2015 18:46
Show Gist options
  • Save gsg/136b64e2fa0b38862999 to your computer and use it in GitHub Desktop.
Save gsg/136b64e2fa0b38862999 to your computer and use it in GitHub Desktop.
type _ t =
| IntLit : int -> int t
| BoolLit : bool -> bool t;;
let eval : type a . a t -> (a * a) list =
fun term ->
List.map (fun x -> x, x) ((match term with
| IntLit x -> [x]
| BoolLit x -> [x]) : a list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment