caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Polymorphic variants and signatures
@ 2003-06-15  6:01 brogoff
  2003-06-16  1:11 ` Jacques Garrigue
  0 siblings, 1 reply; 3+ messages in thread
From: brogoff @ 2003-06-15  6:01 UTC (permalink / raw)
  To: caml-list

Hi, 
    I've run into some issues with polymorphic variants that I can't find 
addressed in the manual. I'd like to define a module type which looks 
(simplified) like this

module type CELL_TYPE =
  sig
    type ('a, 'b) t

    val show_rec :
        ('a -> ('b -> string) -> string) -> ([< ('b, 'a) t ] *  'c) inst ->
            ('b -> string) -> string
    ...

  end

and obviously I can't because ('a, 'b) t is not a polymorphic variant type. 

Is there some way I can write such a module type, and, after having written it, 
use it in a functor as follows, 

module Make (Cell : CELL_TYPE) = 
  struct 
    type ('a, 'b) t = [`Newtag of 'b list | ('a, 'b) Cell.t]

    (* and some dispatch on `Newtag and #Cell.t *)
  end

-- 
-- 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-16  5:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-15  6:01 [Caml-list] Polymorphic variants and signatures brogoff
2003-06-16  1:11 ` Jacques Garrigue
2003-06-16  5:21   ` brogoff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).