Browse thread
Polymorphic variants question
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-09-01 (20:43) |
From: | Jacques Carette <carette@m...> |
Subject: | Re: [Caml-list] Re: Polymorphic variants question |
David Allsopp wrote: > Incidentally, if I use an annotation free version > > let f x = if x = `A then (true, `B) else (false, (x : [< `A | `C] :> [> `A | > `C])) > > then the inferred type of x is [< `A | `C > `A ] ... what does that mean? > This is a "point free" notation for what mathematicians would have written `A <= x <= `A | `C In other words, x is strictly bounded above and below by those 2 types. Translated into english, this means that the type from which x comes *must* contain an `A and *may* contain a `C and *must not* contain anything else. For example, trying let g x = f (snd (f x)) would not type. Jacques