]>
I think it is because you have
"if f c then ... else ..."
---
this restrict "f c" must be bool, thus 'a is bool.
On Nov 22, 2007 10:01 PM, Jonathan T Bryant <jtbryant@valdosta.edu> wrote:
> List,
>
> I don't understand the following typing:
>
> # type 'a t = Cond of bool t * 'a t * 'a t | Value of 'a;;
> type 'a t = Cond of bool t * 'a t * 'a t | Value of 'a
>
> # let rec f t = match t with
> Cond (c,t,e) -> if f c then f t else f e
> | Value x -> x
> ;;
> val f : bool t -> bool = <fun>
>
> I don't understand why f isn't of type 'a t -> 'a. I understand that f
> is applied to a bool t, but I would think that that would just be a
> particular instantiation of 'a, not enough to fully determine its type.
>
> --Jonathan Bryant
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
--
Regards,
Angela Zhu
------------------------------------------
Dept. of CS, Rice University
http://www.cs.rice.edu/~yz2/
------------------------------------------