Browse thread
[Caml-list] inference engine
-
skaller
-
David Baelde
-
skaller
- Remi Vanicat
- Alain.Frisch@e...
-
skaller
-
David Baelde
[
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: | -- (:) |
| From: | Remi Vanicat <vanicat@l...> |
| Subject: | Re: [Caml-list] inference engine |
skaller <skaller@ozemail.com.au> writes:
[...]
> To do that I'm suggesting to give x the type 'at least an int',
> meaning any subsequent typing of x in the function body
> must be constrainable to int -- and that is checked every time
> additional information is obtained by the inference engine
> to refine the type.
>
> For another example:
>
> let f (x:int) = match x with | (a,b) -> ..
>
> should give an error saying:
>
> let f (x:int) = match x with | (a,b) -> ..
> -------------------------------*****
>
> "Here x is used with type 'a * 'b,
> which is not compatible with the constraint int"
the error given by ocaml is :
# let f (x:int) = match x with | (a,b) -> 2;;
^^^^^
This pattern matches values of type 'a * 'b
but is here used to match values of type int
--
Rémi Vanicat
remi.vanicat@laposte.net
-------------------
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/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners