Skip to content

Instantly share code, notes, and snippets.

@Octachron
Created June 13, 2023 13:51
Show Gist options
  • Save Octachron/dea0ed81b2884546da239aa00bf159cb to your computer and use it in GitHub Desktop.
Save Octachron/dea0ed81b2884546da239aa00bf159cb to your computer and use it in GitHub Desktop.
type ('a,'b,'c) skel =
| A of 'a
| B of 'b
| C of 'c
type 'a disabled = |
type 'a enabled = 'a
module Make(X:sig type 'a a type 'a b type 'a c end) = struct
type ('a,'b,'c) t = ('a X.a, 'b X.b, 'c X.c) skel
end
module All(X:sig type 'a t end) = struct type 'a a = 'a X.t type 'b b = 'b X.t type 'c c = 'c X.t end
module With_only_A = Make(struct include All(struct type 'a t = 'a disabled end) type 'a a = 'a enabled end)
module With_A_and_B = Make(struct include All(struct type 'a t = 'a enabled end) type 'a c = 'a disabled end)
let up (x:_ With_only_A.t): _ With_A_and_B.t = x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment