Skip to content

Instantly share code, notes, and snippets.

@gsg
Created December 31, 2014 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsg/d0bca5e241fb2af590d5 to your computer and use it in GitHub Desktop.
Save gsg/d0bca5e241fb2af590d5 to your computer and use it in GitHub Desktop.
type _ t = I : int -> int t | F : float -> float t
module TEq = struct
type 'a key = 'a t
type 'a value = 'a t
let equal : type a b . a key -> b key -> (a, b) Eq.t option =
fun x y -> match x, y with
| I a, I b -> if a = b then Some Eq.Refl else None
| F a, F b -> if a = b then Some Eq.Refl else None
| _ -> None
end
module TAlist = Alist (TEq)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment