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] Polymorphic variants and signatures
[ 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: [Caml-list] Polymorphic variants and signatures
    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 =
    type ('a, 'b) t

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


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) = 
    type ('a, 'b) t = [`Newtag of 'b list | ('a, 'b) Cell.t]

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

-- Brian

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