Dan Bensen <danben...@att.net> writes: > I'm trying to write a functor that extends a user-supplied polymorphic > variant type (PVT). How do you declare the user's type in the signature > for the argument to the functor without locking in the individual variant > definitions? > The code below (in revised syntax) generates an error message that says > the type isn't a PVT. > > code: > >> module type Reader = sig type ast; end; >> >> module Make (Read: Reader) = struct >> type ast = [= Read.ast | `Lid of string]; >> end; > > message: > >> Error: The type Read.ast is not a polymorphic variant type > > How do you make ast a PVT while allowing the user to > specify the variants?
Even if that did work how usefull would that be? You couldn't write let foo = function | `Lid s -> () | x -> Read.foo x unless Read.foo allows [> Read.ast]. In which case you don't need a functor but can just implement foo straight up. What is your use case? What do you want to do? MfG Goswin -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs