Skip to content

Instantly share code, notes, and snippets.

@cemerick cemerick/foo.ml
Created Feb 20, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.