caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: ygrek <ygrekheretix@gmail.com>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] deriving show
Date: Fri, 12 Feb 2010 23:29:36 +0200	[thread overview]
Message-ID: <20100212232936.77ff1807.ygrekheretix@gmail.com> (raw)
In-Reply-To: <201002121954.50954.jon@ffconsultancy.com>

On Fri, 12 Feb 2010 19:54:50 +0000
Jon Harrop <jon@ffconsultancy.com> wrote:

> 
> IIRC, there is an OCaml macro that will autogenerate the code to print values 
> of a variant type from the type definition. Does it handle polymorphic 
> variants?

Yes, but one needs to write out the type (as in the case with the closed variants) :

type t = [ `A of t | `B ] deriving (Show)
print_endline (Show.show<t>(`A `B))

-- 
 ygrek
 http://ygrek.org.ua


      reply	other threads:[~2010-02-12 21:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 19:54 Jon Harrop
2010-02-12 21:29 ` ygrek [this message]

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=20100212232936.77ff1807.ygrekheretix@gmail.com \
    --to=ygrekheretix@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=jon@ffconsultancy.com \
    /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).