Last active
July 11, 2025 14:00
-
-
Save Octachron/6a229e959547d014b52ae4027ebd3ba9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type any = [ `A | `B | `C ] | |
type _ t = | |
| A : [> `A ] t | |
| B: [> `B ] t | |
| C: [> `C ] t | |
let tag (type a) (x: a t) = match x with | |
| A -> 0 | |
| B -> 1 | |
| C -> 2 | |
let l : any t list = [ A; B; C ] | |
let only_a_or_b (x: [`A | `B ] t) = match x with | |
| A -> 0 | |
| B -> 1 | |
| _ -> . | |
let test = only_a_or_b A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment