Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] Mixing variant types...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Mixing variant types...
> Hi,
>
> Have you tried explicitly casting event to an open variant type (or
> whatever they're called) ?
>
> let sources = (Event.receive internal_control) :: List.map (fun w ->
> Channel.receive (w.control :> 'a * [> event ]) !windows in

Hmm, I tried that, and also:

let sources = (Event.receive internal_control) :: List.map (fun w ->
((Channel.receive w.control) :> (window * [> event | `New_window ])
Event.event)) !windows in

I now get:

This expression cannot be coerced to type
  (window * ([> `New_window | `Repaint ] as 'a)) Event.event;
it has type (window * event) Event.event but is here used with type
  (window * 'a) Event.event
Type event = [ `Repaint ] is not compatible with type 'a
The first variant type does not allow tag(s) `New_window

Jonathan