caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dan Bensen <danbensen@att.net>
To: caml-list@inria.fr
Subject: [Caml-list] extending user-defined polymorphic variant types
Date: Mon, 7 May 2012 02:40:33 -0700 (PDT)	[thread overview]
Message-ID: <1336383633.2612.YahooMailRC@web180006.mail.gq1.yahoo.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]


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?

[-- Attachment #2: Type: text/html, Size: 925 bytes --]

             reply	other threads:[~2012-05-07  9:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-07  9:40 Dan Bensen [this message]
2012-05-07 11:37 ` Philippe Veber
2012-05-07 16:47 ` Goswin von Brederlow
2012-05-07 18:55   ` Dan Bensen
2012-05-07 20:17     ` Dan Bensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336383633.2612.YahooMailRC@web180006.mail.gq1.yahoo.com \
    --to=danbensen@att.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).