[
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: | 2007-03-09 (16:44) |
From: | Zheng Li <li@p...> |
Subject: | Re: Constraint missbehaviours?? |
"Till Varoquaux" <till.varoquaux@gmail.com> writes: > type 'a exp2=[ > | 'a exp > | `Sub of 'e * 'e > | `Mul of 'e * 'e > ] > constraint 'a = <exp2:'e;..>;; > > doesn't type correctly but seems perfectly legal to me... Am I missing > anything here? Don't understand the purpose why you programming this way. But if what you want the type check to recognize the `Mul 'e * 'e here has the same 'e as the 'e inside 'a exp, you should explicit it, I don't see reasons why type checker will unify these two polymorphic type parameters. # type 'a exp2 = [ | (<exp:'e; ..> as 'a) exp | `Sub of 'e * 'e | `Mul of 'e * 'e ] constraint 'a = <exp2:'e; ..>;; type 'a exp2 = [ `Add of 'b * 'b | `Mul of 'b * 'b | `Sub of 'b * 'b ] constraint 'a = < exp : 'b; exp2 : 'b; .. > -- Zheng Li http://www.pps.jussieu.fr/~li