From: Tom Hirschowitz <Tom.Hirschowitz@inria.fr>
To: Alain Frisch <frisch@clipper.ens.fr>,
Jonathan D Eddy <eddy@fas.harvard.edu>, <caml-list@inria.fr>
Subject: Re: [Caml-list] Odd Type Checking Problem
Date: Thu, 7 Feb 2002 11:04:21 +0100 [thread overview]
Message-ID: <15458.20773.964917.531200@paille.inria.fr> (raw)
In-Reply-To: <15458.19627.196922.659055@paille.inria.fr>
Ok it is something else, just that the expression
let mAny = fun succ0 input -> succ0 in
let x = mAny (mAny true) in
mAny
is expansive and therefore cannot be generalized in, say
let h =
let mAny = fun succ0 input -> succ0 in
let x = mAny (mAny true) in
mAny
in ...
Tom Hirschowitz writes:
>
> What about these ones :
>
> # let mAny = fun succ0 input -> succ0 in
> let x = mAny (mAny true) in
> mAny;;
> - : '_a -> '_b -> '_a = <fun>
>
> # let mAny = fun succ0 input -> succ0 in
> mAny;;
> - : 'a -> 'b -> 'a = <fun>
>
>
> Alain Frisch writes:
> > On Wed, 6 Feb 2002, Jonathan D Eddy wrote:
> >
> > > (* type checks *)
> > > let mAny = fun succ0 input -> succ0 in
> > > let ans0 = true in
> > > let x = mAny (mAny ans0) in
> > > x 1 2
> > >
> > > (* does not type check *)
> > > let mAny: 'a -> int -> 'a = fun succ0 input -> succ0 in
> > > let ans0 = true in
> > > let x = mAny (mAny ans0) in
> > > x 1 2
> >
> > I guess this is a problem of understanding type variable scoping rules.
> > The scope of the 'a variable above is all the phrase, including
> > the (mAny (mAny ans0)). So the type annotation makes mAny monomorphic,
> > but you want to use it with two different types.
> >
> > It seems that explicitly introduced type variables are generalized only
> > at the (syntactic) level above their introduction; this together with
> > unclear scoping rules may be confusing ...
> >
> >
> > -- Alain
> >
> > -------------------
> > Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> > To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
> >
> -------------------
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
> To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
>
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next prev parent reply other threads:[~2002-02-07 10:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-06 19:37 Jonathan D Eddy
2002-02-06 22:59 ` Alain Frisch
2002-02-07 9:45 ` Tom Hirschowitz
2002-02-07 10:04 ` Tom Hirschowitz [this message]
2002-02-07 11:21 ` [Caml-list] Type variables (was: Odd Type Checking Problem) Alain Frisch
2002-02-07 12:25 ` Markus Mottl
2002-02-08 1:33 ` Jacques Garrigue
2002-02-08 9:24 ` Markus Mottl
2002-02-07 3:15 ` [Caml-list] Odd Type Checking Problem stalkern2
2002-02-06 21:19 ` Remi VANICAT
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=15458.20773.964917.531200@paille.inria.fr \
--to=tom.hirschowitz@inria.fr \
--cc=caml-list@inria.fr \
--cc=eddy@fas.harvard.edu \
--cc=frisch@clipper.ens.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