yilin.wei10
2020-8-18 19:57:10
Is there a way to define a custom subtyping relation for an opaque type in typed racket?
yilin.wei10
2020-8-18 22:04:02
OK looking in https://github.com/racket/typed-racket/blob/521b66e6486cbd8908bbc2d3977ff2d356471604/typed-racket-lib/typed-racket/types/subtype.rkt I don’t think there’s a construct which I’m looking for.
yilin.wei10
2020-8-18 22:05:59
I guess the solution should just be using a U
to represent the supertype and “closing” it and not allowing external modules to extend it?
yilin.wei10
2020-8-19 00:48:52
OK - I’ve found the docs for the define-new-subtype
and the Distinction
construct.
yilin.wei10
2020-8-19 00:51:02
Or possibly, using a Refinement
.