From: Pascal Brisset <brisset@recherche.enac.fr>
To: caml-list@pauillac.inria.fr
Subject: Type constraints
Date: Fri, 30 May 1997 09:41:10 +0200 [thread overview]
Message-ID: <199705300741.JAA23620@indigo.recherche.enac.fr> (raw)
In-Reply-To: <338DD17B.62C6@impsat.net.co>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 852 bytes --]
Ernesto Posse writes:
« type 'a node = {x: 'a; y: t1}
« and t1 = A | B of t1*t1
« and t2 = C | D of (string * t2) node | E of bool node
«
« I obtain this message:
«
« Characters 98-102:
« This type parameter bool should be an instance of type string * t2
It may be compared to a similar expression at the term level:
# let rec f = fun x -> x
and g = f 1, f "1";;
^^^
This expression has type string but is here used with type int
In a recursive definition, occurrences of the defined idents have the
same type everywhere, i.e. the generalization (in your case, 'a is any
type) is done only ``at the end'' of the definition.
At the term level, ML+ is the (undecidable) solution to this kind of
recursive definition. I guess problems are similar at the type level.
A more precise answer from a Caml guru ?
--Pascal Brisset
next prev parent reply other threads:[~1997-06-02 12:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-29 18:56 Ernesto Posse
1997-05-30 7:41 ` Pascal Brisset [this message]
1997-05-30 9:24 ` Didier Rousseau
1997-05-30 10:01 ` Vale'rie Me'nissier-Morain
1997-05-30 11:09 ` Wolfgang Lux
1997-05-30 12:17 ` Jerome Vouillon
2004-12-06 19:55 Jim Farrand
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=199705300741.JAA23620@indigo.recherche.enac.fr \
--to=brisset@recherche.enac.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;
as well as URLs for NNTP newsgroup(s).