Version française
Home     About     Download     Resources     Contact us    
Browse thread
Create a constraint between variant type and data list
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: Create a constraint between variant type and data list
On 03-09-2010, bluestorm <bluestorm.dylc@gmail.com> wrote:
> Hi,
>
> Finally, I have a third solution based on code generation : given my
> first solution (turning the association list into a function), what
> you need is only a list of all the constructors (and you can build
> your assoc list with List.map (fun x -> x, assoc_function x)). This
> can easily be generated from the datatype declaration using direct
> camlp4, or Markus Mottl's type-conv (
> http://www.ocaml.info/home/ocaml_sources.html#toc11 ).
>

Your answer and the one from Martin/Ashish, makes me think that I need
to go back to camlp4/type-conv... I would have like to avoid this
solution, but I think it is the best one.

Thanks for all your answer...

Regards,
Sylvain Le Gall

p.s.: this remains an open problem, so solutions are still welcome ;-)