Version française
Home     About     Download     Resources     Contact us    
Browse thread
Polymorphic variants question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andres Varon <avaron@g...>
Subject: Re: [Caml-list] Polymorphic variants problem
>
> Now, I just tried to use my super term union, but I ran
> into a problem. It looks like a fault in type inference,
> something like this:
>
> let f (x:[`A|`B]) = ..
> let g (x:[`A]) = ..
> ..
> fun x ->
>    f x;
>    g x;
>    ..
>
You have to define it as follows:

let f (x : [< `A | `B ]) = ..
let g (x : [`A]) =

to let the compiler know that the argument of f could be refined  
further.