by iaabtpbtpnn · 6y ago · 0 comments
> Their real purpose is to support subsets and supersets, which are useful all over the place.
And indeed they are super useful, e.g. I am using them to implement functions that deal with web responses: some can deal with only HTTP responses, some with only WebSocket responses, and some with either. All completely type-safe and extensible.
[1] https://discuss.ocaml.org/t/function-argument-polymorphism/3...
[2] https://www.cl.cam.ac.uk/~sd601/papers/mlsub-preprint.pdf
[1] Recently have been seeing a lot more use in BuckleScript because of the JS object representation