Browse thread
[Caml-list] Efficiency of 'a list
-
Eray Ozkural
-
Mattias Waldau
- Ville-Pertti Keinonen
- Vitaly Lugovsky
- Eray Ozkural
- Lauri Alanko
-
Mattias Waldau
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Olivier Andrieu <andrieu@i...> |
| Subject: | Re: [Caml-list] Two types of efficiency (Was Efficiency of 'a list) |
John Max Skaller [Sunday 4 May 2003] : > Similarly, subtyping of polymorphic variants is invariant > in the arguments, when covariance is sound and more useful. > This is a real pain for me, since it destroys the main use > I hoped to obtain for polymorphic variants: > > type x = [`A | `B of x] > type y = [`A | `B of y | `C] > > x *is* a subtype of y, but the type system > disallows it, failing to recognise that every `B x > of type x is also a `B y of y. Typically I have > say a term for an expression and I want to eliminate > some cases by say a term reduction, but I can't restrict > the resultant type as desired because there's no way > to 'narrow' the type recursion. # type x = [`A | `B of x] ;; type x = [ `A | `B of x] # type y = [`A | `B of y | `C] ;; type y = [ `A | `B of y | `C] # fun a -> (a :x :> y) ;; - : x -> y = <fun> Doesn't that mean that x is a subtype of y ? -- Olivier ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners