Skip to content

Instantly share code, notes, and snippets.

@cemerick
Created February 20, 2019 16:14
Show Gist options
  • Save cemerick/4d1b735008a3fb9da20d47ebc875eb60 to your computer and use it in GitHub Desktop.
Save cemerick/4d1b735008a3fb9da20d47ebc875eb60 to your computer and use it in GitHub Desktop.
type _ foo =
| A : int -> int foo
| B : int -> int foo
module FooSet = Set.Make(struct
type t
let compare a b =
let a' = match a with A x -> x | B x -> x in
let b' = match b with A x -> x | B x -> x in
Pervasives.compare a' b'
end)
(*
Error: Signature mismatch:
Modules do not match:
sig type t val compare : int foo -> int foo -> int end
is not included in
Set.OrderedType
Values do not match:
val compare : int foo -> int foo -> int
is not included in
val compare : t -> t -> int
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment