From: "Laurent Chéno" <laurent.cheno@noos.fr>
To: Caml-list <caml-list@margaux.inria.fr>
Subject: [Caml-list] False polymorphic
Date: Thu, 9 Aug 2001 09:28:21 +0200 [thread overview]
Message-ID: <200108090728.f797SPH15721@concorde.inria.fr> (raw)
(please excuse my poor english)
David said well :
> # let id x = x;;
> val id : 'a -> 'a = <fun>
>
> This expression is fully polymorphic.
>
> # let id2 = id id;;
> val id2 : '_a -> '_a = <fun>
>
> This one is not (notice the underscore (_) before the type variable
> a). It is a monomorphic type that is right know unknown but will be
> determined at first instantiation.
and you should read indeed
> For further information on this subject, have a look at the FAQ:
> http://caml.inria.fr/FAQ/FAQ_EXPERT-eng.html#variables_de_types_faibles
>
I just add this point :
> #let id x = x ;;
> id : 'a -> 'a = <fun>
> #let id3 x = (id id) x ;;
> id3 : 'a -> 'a = <fun>
> #id3 ;;
> - : 'a -> 'a = <fun>
> #id3 3 ;;
> - : int = 3
> #id3 "abc" ;;
> - : string = "abc"
> #
>
You can retain that this '_a problem can be avoided if you explicitly
give all expected args.
Best regards,
Laurent
(who never learned english)
--
Laurent Chéno
Prof. de mathématiques en PSI*
et de l'option informatique en MP/MP*
Lycée Louis-le-Grand, Paris
http://pauillac.inria.fr/~cheno/
-------------------
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
reply other threads:[~2001-08-09 7:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200108090728.f797SPH15721@concorde.inria.fr \
--to=laurent.cheno@noos.fr \
--cc=caml-list@margaux.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