Version française
Home     About     Download     Resources     Contact us    
Browse thread
Oddness with recursive polymorphic variants
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff <brogoff@s...>
Subject: Re: [Caml-list] Oddness with recursive polymorphic variants
On Thu, 4 May 2006, Luc Maranget wrote:
> I cannot really explain why it matters, but I can supply a minimal (?) example
>
> type f = [`A ]
> type g = [f | `C]
>
> let k (x:f) = (x:g);;
>                ^
> This expression has type f but is here used with type g
> The first variant type does not allow tag(s) `C

Not enough polymorphism, the error message seems clear

type 'a h = 'a constraint 'a = [> `A];;
let k (x : 'a h) = (x : g)

works.

-- Brian