[Haskell-cafe] Subsets and supersets

Yves Parès limestrael at gmail.com
Wed Mar 16 14:54:19 CET 2011


> 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 <brandon_m_moore at yahoo.com>

> 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110316/41b30aae/attachment.htm>


More information about the Haskell-Cafe mailing list