* Two small observations
@ 1999-10-23 17:32 William Chesters
0 siblings, 0 replies; only message in thread
From: William Chesters @ 1999-10-23 17:32 UTC (permalink / raw)
To: caml-list
[-- 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-10-25 18:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-23 17:32 Two small observations William Chesters
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).