[Haskell-cafe] Subsets and supersets
Brandon Moore
brandon_m_moore at yahoo.com
Wed Mar 16 14:38:02 CET 2011
You want polymorphic variants. Check out O'Caml, or MLPolyR.
Subtyping is not very compatible with first-class functions. If you have
subtype-bounded polymorphism
("forall A a subtype of T, ..."), and your subtype relation says A -> B is a
subtype of C ->D whenever
A is a supertype of C and B is a subtype of D, then checking subtyping is
undecidable.
I might as well mention here that in any OO language with protected methods or
members, a
subclass is not a subtype in any behavioral sense - and terminal coalgebras have
so little structure
that just working in terms of the interface doesn't seem too useful.
Brandon.
More information about the Haskell-Cafe
mailing list