2 ms·
After quickly scanning https://realworldocaml.org/v1/en/html/variants.html https://realworldocaml.org/v1/en/html/variants.html, isn't the same thing accomplishe
by codygman 10y ago
After quickly scanning https://realworldocaml.org/v1/en/html/variants.html https://realworldocaml.org/v1/en/html/variants.html, isn't the same thing accomplished by GADTs?
- rbehrends 10y agoThe point of polymorphic variants is that the entire type doesn't have to be fully defined in one place; you can have partial definitions in a module and those definitions can even overlap. You can have (say) [ `Int of int | `String of string ] in one module and [ `String of string | `Char of char ] in another, and the typechecker will handle intersections and unions of these types.