Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2010-09-03 (21:30)
From: Sylvain Le Gall <sylvain@l...>
Subject: Re: Create a constraint between variant type and data list
On 03-09-2010, bluestorm <> 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 (fun x -> x, assoc_function x)). This
> can easily be generated from the datatype declaration using direct
> camlp4, or Markus Mottl's type-conv (
> ).

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

Sylvain Le Gall

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