Re: [Caml-list] deriving show

2010-02-12 Thread ygrek
On Fri, 12 Feb 2010 19:54:50 +
Jon Harrop  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(`A `B))

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

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] deriving show

2010-02-12 Thread Jon Harrop

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?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] deriving Show with type-conf

2008-06-28 Thread Richard Jones
On Fri, Jun 27, 2008 at 06:07:22PM -0700, Nathaniel Gray wrote:
> Has anybody used type-conv to write a "deriving Show" style printer
> generator they can share?  Any other approaches?  I was using the
> "deriving" package for a while but it's got a bad parsing bug.

Fix the bug in deriving??

Rich.

-- 
Richard Jones
Red Hat

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] deriving Show with type-conf

2008-06-27 Thread Nathaniel Gray
Hi,

Has anybody used type-conv to write a "deriving Show" style printer
generator they can share?  Any other approaches?  I was using the
"deriving" package for a while but it's got a bad parsing bug.

Thanks,
-n8

-- 
>>>-- Nathaniel Gray -- Caltech Computer Science -->
>>>-- Mojave Project -- http://mojave.cs.caltech.edu -->

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs