Skip to content

Instantly share code, notes, and snippets.

@Octachron
Last active February 23, 2022 12:54
Show Gist options
  • Select an option

  • Save Octachron/89e7f1d99fbd9bc79da89f6fb029ab5d to your computer and use it in GitHub Desktop.

Select an option

Save Octachron/89e7f1d99fbd9bc79da89f6fb029ab5d to your computer and use it in GitHub Desktop.
type _ data_cstr = ..
module type t = sig
type a
type _ data_cstr += Fmt: a data_cstr
end
type 'a data_format = (module t with type a = 'a)
let mk_data_format : type a. unit -> a data_format = fun () ->
(module struct type nonrec a = a type _ data_cstr += Fmt : a data_cstr end)
let data_format_iseq : type a b. a data_format -> b data_format -> (a, b) eq option =
fun (module M) (module N) ->
match M.Fmt, N.Fmt with
| M.Fmt, M.Fmt -> Some Eq
| _ -> None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment