Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] What about polymorphic union types in functors?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff@s...
Subject: Re: [Caml-list] What about polymorphic union types in functors?
On Fri, 6 Feb 2004, Alex Baretta wrote:
> Here what I need to do:
>
> module type FRAGMENT = sig
>    type foo (* Closed polymorphic union type *)
>    val do_something : foo -> whatever
> end
>
> module Merge_fragments (F1:FRAGMENT) (F2:FRAGMENT) : #FRAGMENT = struct
>    type foo = [ F1.foo | F2.foo ]
>    let do_something = function
>      | #F1.foo as f1 -> F1.do_something f1
>      | #F2.foo as f2 -> F2.do_something f2
> end

Looks like you are implementing GCaml style polymorphism by hand. Last I read,
work on GCaml was slated to resume after 3.07. The original system looked
quite promising, but I have no idea how it will interact with the module system,
and all of the other non corish extensions (OO, polymorphic variants, etc)
that make up the full language.

-- Brian


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners