From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: skaller@users.sourceforge.net
Cc: jonathan.roewen@gmail.com, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Mixing variant types...
Date: Fri, 13 Jan 2006 13:57:16 +0900 (JST) [thread overview]
Message-ID: <20060113.135716.226786926.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <1137038225.3681.178.camel@rosella>
From: skaller <skaller@users.sourceforge.net>
> I just tried making Event.event covariant but it didn't seem to work,
> perhaps I did something wrong here?
>
> (* event.ml *)
> type +'a event =
> Communication of 'a behavior
> | Choose of 'a event list
> | WrapAbort of 'a event * (unit -> unit)
> | Guard of (unit -> 'a event)
The + above is not needed (it is implied by the definition)
> (* event.mli *)
> type +'a event
That + is sufficient.
> Rebuilt and reinstalled Ocaml 3.09.0 .. changed example to:
>
> List.map (fun w ->
> (* Event.wrap (receive w.control) (fun (w,e) -> w, (e:> ec)) *)
> (receive w.control)
> )
> [] (* !windows .. *)
>
> eliminating the Event.wrap and hoping this would fix it ..
>
> skaller@rosella:/work/felix/flx$ ocamlc -thread r.ml
> File "r.ml", line 28, characters 6-143:
> This expression has type (window * event) Event.event list
> but is here used with type ws_event list
> Type (window * event) Event.event is not compatible with type
> ws_event = (window * ec) Event.event
> Type event = [ `Repaint ] is not compatible with type
> ec = [ `New_window | `Repaint ]
> The first variant type does not allow tag(s) `New_window
You still need to coerce the resulting list:
(List.map (fun w -> receive w.control) !windows :> ws_event list)
Jacques
next prev parent reply other threads:[~2006-01-13 4:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-11 10:36 Jonathan Roewen
2006-01-12 1:24 ` Jonathan Roewen
2006-01-12 2:45 ` skaller
2006-01-12 3:22 ` Jacques Garrigue
2006-01-12 3:57 ` skaller
2006-01-13 4:57 ` Jacques Garrigue [this message]
2006-01-13 7:56 ` skaller
2006-01-13 9:37 ` Jacques Garrigue
2006-01-12 3:59 ` Jonathan Roewen
-- strict thread matches above, loose matches on Subject: below --
2006-01-11 9:56 Jonathan Roewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060113.135716.226786926.garrigue@math.nagoya-u.ac.jp \
--to=garrigue@math.nagoya-u.ac.jp \
--cc=caml-list@yquem.inria.fr \
--cc=jonathan.roewen@gmail.com \
--cc=skaller@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox