From: Stephane Glondu <steph@glondu.net>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Union of polymorphic variants...
Date: Tue, 04 Dec 2007 15:33:00 +0100 [thread overview]
Message-ID: <4755651C.5010407@glondu.net> (raw)
In-Reply-To: <20071204.225712.186423247.garrigue@math.nagoya-u.ac.jp>
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
next prev parent reply other threads:[~2007-12-04 14:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-04 12:38 Stephane Glondu
2007-12-04 13:57 ` [Caml-list] " Jacques Garrigue
2007-12-04 14:33 ` Stephane Glondu [this message]
2007-12-05 2:17 ` Jacques GARRIGUE
2007-12-05 15:59 ` Stephane Glondu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4755651C.5010407@glondu.net \
--to=steph@glondu.net \
--cc=caml-list@yquem.inria.fr \
--cc=garrigue@math.nagoya-u.ac.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox