Browse thread
[Caml-list] Odd Type Checking Problem
[
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: | stalkern2 <stalkern2@t...> |
| Subject: | Re: [Caml-list] Odd Type Checking Problem |
Beginner's opinion:
I think that the compiler/interpreter is clear:
'a->'b->'a
is not
'a->'a->'b->'a
and that you just let the function starve before giving it the last meatball.
Look:
# let mAny: 'a -> int -> 'a = fun succ0 input -> succ0 in
let ans0 = true in
let x = mAny (mAny ans0 1) in
x 2;;
- : bool = true
Ciao
Ernesto
Alle ore 14:37, mercoledì 06 febbraio 2002, Jonathan D Eddy ha scritto:
> (* type checks *)
> let mAny = fun succ0 input -> succ0 in
> let ans0 = true in
> let x = mAny (mAny ans0) in
> x 1 2
>
> (* does not type check *)
> let mAny: 'a -> int -> 'a = fun succ0 input -> succ0 in
> let ans0 = true in
> let x = mAny (mAny ans0) in
> x 1 2
-------------------
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