
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.
In fashion terms: operator (->) is contravariant in its first argument and
covariant in its second.
;)
2011/3/16 Brandon Moore
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.
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe