caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: William Chesters <williamc@dai.ed.ac.uk>
To: caml-list@inria.fr
Subject: Two small observations
Date: Sat, 23 Oct 1999 18:32:14 +0100	[thread overview]
Message-ID: <199910231732.SAA04758@toy.william.bogus> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 665 bytes --]

`with' is not fully polymorphic.  For instance, in

	type 'a t = { length: int; elt: int -> 'a }

	let map: ('a -> 'b) -> 'a t -> 'b t =
          fun f t -> { t with elt = f ° t.elt }

the inferred type for map is given by

	val map : ('a -> 'a) -> 'a t -> 'a t

I can see that this is a simple way out of the problem of what to say
if a `with' changes fields in a way inconsistent with the others'
types, but it is a little confusing.

   The other thing is that the compiler doesn't tell you if your type
annotations turn out to be over-optimistic, like that on `map' above.
It would be nice to have the option of having it generate a warning in
these cases.




                 reply	other threads:[~1999-10-25 18:53 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=199910231732.SAA04758@toy.william.bogus \
    --to=williamc@dai.ed.ac.uk \
    --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).