From: Judicael Courant <Judicael.Courant@lri.fr>
To: caml-list@pauillac.inria.fr
Subject: Typechecking of recursive variants
Date: Fri, 12 May 2000 16:34:08 +0200 (MEST) [thread overview]
Message-ID: <200005121434.QAA12123@pc87.lri.fr> (raw)
Hello,
I do not understand the following behavior of the typechecker :
match x 4 with `X z -> z | `Y -> assert false;;
- : [ `Y | `X of '_a] as 'a = `X (`X (`X `Y))
Objective Caml version 3.00
# let rec x n = if n = 0 then `Y else `X (x (n-1));;
val x : int -> ([> `Y | `X of 'a] as 'a) = <fun>
# x 3;;
- : _[> `Y | `X of '_a] as 'a = `X (`X (`X `Y))
# match x 4 with `X z -> z | `Y -> assert false;;
- : [ `Y | `X of '_a] as 'a = `X (`X (`X `Y))
What do these underscores mean ? Anything to do with monomorphic type
variables ? Why is not there any ">" at the beginning of the latest
type ?
Judicaël.
--
Judicael.Courant@lri.fr, http://www.lri.fr/~jcourant/
(+33) (0)1 69 15 64 85
"Montre moi des morceaux de ton monde, et je te montrerai le mien"
Tim, matricule #929, condamné à mort.
http://rozenn.picard.free.fr/tim.html
next reply other threads:[~2000-05-12 17:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-05-12 14:34 Judicael Courant [this message]
2000-05-15 0:33 ` 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=200005121434.QAA12123@pc87.lri.fr \
--to=judicael.courant@lri.fr \
--cc=caml-list@pauillac.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