Re:Codata in action, or how to connect FP and OOP
by contravariant on Monday August 10, 2020 @05:17AM
(#24107168)
> I'm not sure that this still allows subtyping of that GADT as if it were a regular class.
It does, more or less, since any subtype will have to implement the "accept" method for the visitor, which has been defined to only 'accept' the values that can be represented by the GADT. Any subtype will need to define how its possible values map to that of the supertype.
It does, more or less, since any subtype will have to implement the "accept" method for the visitor, which has been defined to only 'accept' the values that can be represented by the GADT. Any subtype will need to define how its possible values map to that of the supertype.