Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Julien Signoles
let () = match GPL with > | GPL | LGPL -> > assert >(let s = "Do not forget to add new constructors to the data list > above." in > Format.ifprintf Format.std_formatter "%s" s; > true) > Sorry could be much better like this: let () = match GPL with GPL | LGPL ->

Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Julien Signoles
Hello Sylvain, 2010/9/3 Sylvain Le Gall > I would like to define: > > type license = GPL | LGPL > > and > > let data = [ GPL, "GNU Public license"; > LGPL, "GNU Lesser General Public license" ] > > > I would like to enforce that all variants of license are in the > association list.

[Caml-list] deriving for 3.12.0

2010-09-03 Thread Jake Donham
Hi list, If you are interested in using deriving on OCaml 3.12.0, I have fixed it up here: http://github.com/jaked/deriving I haven't tried anything serious with it but the tests pass. Jake ___ Caml-list mailing list. Subscription management: http:

[Caml-list] Re: Create a constraint between variant type and data list

2010-09-03 Thread Sylvain Le Gall
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 List.map (fun x -> x, ass

[Caml-list] Re: Create a constraint between variant type and data list

2010-09-03 Thread Sylvain Le Gall
On 03-09-2010, Maxence Guesdon wrote: > Le Fri, 3 Sep 2010 17:16:48 + (UTC), > Sylvain Le Gall a écrit : > > A solution is to add your new license to your list of associations, then > the compiler will complain about the unknown variant :) > This is my current solutions. I try to find someth

Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Maxence Guesdon
Le Fri, 3 Sep 2010 17:16:48 + (UTC), Sylvain Le Gall a écrit : > Hello all, > > I would like to somehow enforce that a variant type is associated with > an entry in a data list. > > For example, > > I would like to define: > > type license = GPL | LGPL > > and > > let data = [ GPL,

Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Ashish Agarwal
See the Enum section of deriving: http://code.google.com/p/deriving/wiki/Introduction I haven't used it myself so cannot comment on how well it works. On Fri, Sep 3, 2010 at 2:51 PM, Martin Jambon wrote: > Sylvain Le Gall wrote: > > Hello all, > > > > I would like to somehow enforce that a vari

Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Martin Jambon
Sylvain Le Gall wrote: > Hello all, > > I would like to somehow enforce that a variant type is associated with > an entry in a data list. > > For example, > > I would like to define: > > type license = GPL | LGPL > > and > > let data = [ GPL, "GNU Public license"; > LGPL, "G

Re: [Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread bluestorm
Hi, I do not have a direct solution to your problem. If you want to associate a data with each case, you can use a pattern matching, wich will do the exhaustiveness check : let to_string : license -> _ = function | `GPL -> "GPL" | `LGPL -> "LGPL" You will be warned if you add (or remove) some l

Re: [Caml-list] Contribute your Camlp4 knowledge! [was: account for Camlp4 wiki]

2010-09-03 Thread Jake Donham
On Fri, Sep 3, 2010 at 12:07 AM, Hendrik Tews wrote: > Great! Let's collect all our Camlp4 knowledge in this wiki! > Hopefully the wiki can replace the non-existing documentation one > day. For people who haven't seen it, I have a number of Camlp4 articles at http://ambassadortothecomputers.bl

[Caml-list] Create a constraint between variant type and data list

2010-09-03 Thread Sylvain Le Gall
Hello all, I would like to somehow enforce that a variant type is associated with an entry in a data list. For example, I would like to define: type license = GPL | LGPL and let data = [ GPL, "GNU Public license"; LGPL, "GNU Lesser General Public license" ] I would like to

Re: [Caml-list] Segfault with humongous heap size

2010-09-03 Thread Damien Doligez
On 2010-09-02, at 13:23, Paul Steckler wrote: > If I enter this in my shell: > > declare -x OCAMLRUNPARAM="h=32" > > every OCaml program I run yields a segfault. I have OCaml 3.11.1+rc1 > installed > on Fedora 12 x64. > > Of course, that heap size, 3.2G words, is larger than the mem

[Caml-list] interfacing Ocaml with Mathematica

2010-09-03 Thread zaid al-zobaidi
Dear members I am writing an Ocaml code and part of it I need to do the following job: * I want to find out if two arithmetic or logical expressions are equal like "a + b" and "2 * a + b - a" or "a and b or a" and "a", and Ocaml it is unlikely to achieve my target, therefore I checked the avai

Re: [Caml-list] Re: Segfaults with Dynlink with OCaml 3.11

2010-09-03 Thread Damien Doligez
On 2010-08-25, at 06:00, Paul Steckler wrote: > Today, I found the culprit. Here's the pattern: > > dynamically load .cmxs file > query list mutated by .cmxs file (* no problem *) > Gc.set { (Gc.get()) with Gc.minor_heap_size = ...}; > Gc.set { (Gc.get()) with Gc.major_heap

[Caml-list] What projects are compiled with ocamlbuild ?

2010-09-03 Thread Alexandre Pilkiewicz
Dear list I am looking for any project (written in ocaml or any other language !) compiled with ocamlbuild with the source publicly available (under any license, it is not for modification nor publication). If you know any of them, could you please drop me a line with the name of the project and

Re: [Caml-list] Quotations and the functorial camlp4 interface

2010-09-03 Thread Hendrik Tews
I wrote: How about the Loc submodule of Ast that is passed into OCamlInitSyntax? There is the mutable Loc.name, which contains the default location variable. If I reuse the Ast argument of OCamlInitSyntax, will the mutable Loc.name be shared between the outputs? Yes, it will, chan

[Caml-list] Contribute your Camlp4 knowledge! [was: account for Camlp4 wiki]

2010-09-03 Thread Hendrik Tews
Jake Donham writes: I would like to make some contributions to the Camlp4 wiki at Great! Let's collect all our Camlp4 knowledge in this wiki! Hopefully the wiki can replace the non-existing documentation one day. Recently, I filled the ast page (http://brion.inria.fr/gallium/index.php/Abstr