[
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: | Stephane Glondu <steph@g...> |
| Subject: | Re: [Caml-list] Union of polymorphic variants... |
Jacques Garrigue a écrit : > [...] union of polymorphic variant is flat [...] > The reason is that dispatch only looks at the head constructor: > > let f = function > | #b as x -> fb x > | #c as x -> fc x > [...] Actually, I was faced to the problem in a similar pattern-matching, and I reduced the problem to the example in my post :-) > [...] is actually > > let f = function > | `A _ as x -> fb x > | `A _ as x -> fc x > > which only types if both parameters have the same type. However, one can do: let f = function | `A (`B _) -> ... | `A (`C _) -> .. Would it be difficult to extend the system so that #b and #c expand to the constructions above? > Polymorphic variants are _not_ XML types. > Use ocamlduce for that :-) I am having a look at it... -- Stéphane Glondu