Hi Dan,

I'm afraid you can't. If you want to write unions of polymorphic variant
types, they have to be concrete and not abstract. See Romain Bardou's work
on this:

http://romain.bardou.fr/papers/stage2006p.pdf

Or, if you can read french:

www.math.nagoya-u.ac.jp/~garrigue/papers/index.html

(see Unions de variants polymorphes abstraits).

Cheers,
  Philippe.



2012/5/7 Dan Bensen <danben...@att.net>

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

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

Reply via email to