Skip to content

Instantly share code, notes, and snippets.

@objmagic
Created October 30, 2015 18:00
Show Gist options
  • Select an option

  • Save objmagic/5964ed8cdcbd8c18ac16 to your computer and use it in GitHub Desktop.

Select an option

Save objmagic/5964ed8cdcbd8c18ac16 to your computer and use it in GitHub Desktop.
gadt corner
module Propagation = struct
type _ t =
IntLit : int -> int t
| BoolLit : bool -> bool t
let check : type s. s t -> s = function
| IntLit n -> n
| BoolLit b -> b
let check : type s. s t -> s = fun x ->
let r = match x with
| IntLit n -> (n : s )
| BoolLit b -> b
in r
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment