Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: Alex Baretta <alex@b...>
Subject: [Caml-list] What about polymorphic union types in functors?
Here what I need to do:

module type FRAGMENT = sig
   type foo (* Closed polymorphic union type *)
   val do_something : foo -> whatever

module Merge_fragments (F1:FRAGMENT) (F2:FRAGMENT) : #FRAGMENT = struct
   type foo = [ | ]
   let do_something = function
     | as f1 -> F1.do_something f1
     | as f2 -> F2.do_something f2

Up to now I have used automatic code generation to actually write the ML 
file which implements the functor istantiation. Could such an extension 
be made to Ocaml type system?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: