From: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
To: Caml list <caml-list@inria.fr>
Subject: Typing problem
Date: Sun, 19 Mar 2006 02:30:14 +0100 [thread overview]
Message-ID: <D3508A4A-5682-44C2-926B-48824621B3DD@epfl.ch> (raw)
Hello,
I would like to define the following types.
> type u = [ `U1 | `U2 ]
>
> type 'a t = [`A of 'a | `B of ([`U1 ] as 'a) ] constraint 'a = [< u ]
t's parameter is used to statically express constraints in other
parts of the code. My problem is that
the constraint on 'a is downgraded to [`U1] while I would like to be
able to write
> let param : 'a t -> 'a = function (`A v | `B v) -> v
and get the following typing behaviour.
> let v = param (`A `U1) (* should type *)
> let v = param (`A `U2) (* should type *)
> let v = param (`B `U1) (* should type *)
> let v = param (`B `U2) (* should not type *)
Is it possible to express that in ocaml's type system ?
Regards,
Daniel
next reply other threads:[~2006-03-19 1:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-19 1:30 Daniel Bünzli [this message]
2006-03-19 11:21 ` [Caml-list] " Jacques Garrigue
2006-03-19 14:58 ` Daniel Bünzli
-- strict thread matches above, loose matches on Subject: below --
2006-03-19 14:23 j h woodyatt
2000-02-10 13:49 jean-marc alliot
2000-02-11 10:17 ` Pierre Weis
2000-02-12 22:34 ` Jacques Garrigue
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=D3508A4A-5682-44C2-926B-48824621B3DD@epfl.ch \
--to=daniel.buenzli@epfl.ch \
--cc=caml-list@inria.fr \
/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;
as well as URLs for NNTP newsgroup(s).