Re: [Caml-list] Re: Generalized Algebraic Datatypes
Hi, If I misunderstood you, then I still misunderstand you: the App constructor you quoted took only 1 argument (a pair), so you can't partially apply it, and that's from the type declaration. IOW the type declaration you quoted is *not* curried. Now I get what you mean, and there's definitely been a misunderstanding. First, I wasn't referring to constructor App in particular, nor confusing a tuple argument with a curried form. I may be abusing the term, but I used partial application in the most general sense, ie, including an application with zero arguments (in other words, a first-class value). Suppose I had the following type declaration: val f: int - int - int - int I could do a partial application with 2 arguments: let f2 = f 1 2 A partial application with 1 argument: let f1 = f 1 And generalising, a partial application with 0 arguments, which is simply referring to f itself: let f0 = 0 Now, going back to the GADTs example, a declaration such as the one below hints that the constructors may be used as first-class values (a zero-arg partial application), when in fact they cannot. That is why I find this syntax to be inconsistent with the rest of the language. type _ t = | IntLit : int - int t | BoolLit : bool - bool t Best regards, Dario Teixeira ___ 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] Re: Generalized Algebraic Datatypes
bluestorm bluestorm.d...@gmail.com writes: It was actually the case in Caml Light : each datatype constructor implicitly declared a constructor function with the same name. I don't exactly know why this feature was dropped in Objective Caml, but I think I remember (from a previous discussion) that people weren't sure it was worth the additional complexity. Would that be not possible now with Camlp4 extension? Wojciech ___ 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] Re: Generalized Algebraic Datatypes
On 31-10-2010, Wojciech Daniel Meyer wojciech.me...@googlemail.com wrote: bluestorm bluestorm.d...@gmail.com writes: It was actually the case in Caml Light : each datatype constructor implicitly declared a constructor function with the same name. I don't exactly know why this feature was dropped in Objective Caml, but I think I remember (from a previous discussion) that people weren't sure it was worth the additional complexity. Would that be not possible now with Camlp4 extension? I am pretty sure, it is possible to implement them with camlp4. Just a matter of time -- and motivation. The only limitation I can see, is that the generated constructors won't be capitalized. E.g.: type t = MyConstr | YourConstr of int = type t = MyConstr | YourConstr of int let myConstr = MyConstr let yourConstr i = YouConstr i Regards, Sylvain Le Gall ___ 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] Re: Generalized Algebraic Datatypes
On Sun, Oct 31, 2010 at 3:35 PM, Sylvain Le Gall sylv...@le-gall.net wrote: On 31-10-2010, Wojciech Daniel Meyer wojciech.me...@googlemail.com wrote: bluestorm bluestorm.d...@gmail.com writes: It was actually the case in Caml Light : each datatype constructor implicitly declared a constructor function with the same name. I don't exactly know why this feature was dropped in Objective Caml, but I think I remember (from a previous discussion) that people weren't sure it was worth the additional complexity. Would that be not possible now with Camlp4 extension? I am pretty sure, it is possible to implement them with camlp4. Just a matter of time -- and motivation. The only limitation I can see, is that the generated constructors won't be capitalized. E.g.: type t = MyConstr | YourConstr of int = type t = MyConstr | YourConstr of int let myConstr = MyConstr let yourConstr i = YouConstr i Why do you say so? HOL Light uses capitalized identifiers for values, for example. It's probably possible to do whatever one reasonably wants. ___ 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] Re: Generalized Algebraic Datatypes
On 31-10-2010, Lukasz Stafiniak lukst...@gmail.com wrote: On Sun, Oct 31, 2010 at 3:35 PM, Sylvain Le Gall sylv...@le-gall.net wrote: On 31-10-2010, Wojciech Daniel Meyer wojciech.me...@googlemail.com wrote: bluestorm bluestorm.d...@gmail.com writes: It was actually the case in Caml Light : each datatype constructor implicitly declared a constructor function with the same name. I don't exactly know why this feature was dropped in Objective Caml, but I think I remember (from a previous discussion) that people weren't sure it was worth the additional complexity. Would that be not possible now with Camlp4 extension? I am pretty sure, it is possible to implement them with camlp4. Just a matter of time -- and motivation. The only limitation I can see, is that the generated constructors won't be capitalized. E.g.: type t = MyConstr | YourConstr of int = type t = MyConstr | YourConstr of int let myConstr = MyConstr let yourConstr i = YouConstr i Why do you say so? HOL Light uses capitalized identifiers for values, for example. It's probably possible to do whatever one reasonably wants. Function names and values are low id in OCaml (first letter must be uncapitalized). If you try to define let MyConstr = 0 in an OCaml toplevel, you will get a syntax error... The code generated by camlp4 must be syntactically correct. But maybe you are talking about a deeper integration? E.g. whenever you encounter the constructor YourConstr in expr, you transform it into fun i - YourConstr i. This should work but since camlp4 is limited to a single module, you won't be able to use this outside the module, because you won't have access to the definition of YouConstr and won't be able to determine his arity... But if you have an idea about how to solve this, just tell us. Regards, Sylvain Le Gall ___ 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] Re: Generalized Algebraic Datatypes
On Sun, Oct 31, 2010 at 4:08 PM, Sylvain Le Gall sylv...@le-gall.net wrote: Function names and values are low id in OCaml (first letter must be uncapitalized). If you try to define let MyConstr = 0 in an OCaml toplevel, you will get a syntax error... In unmodified toplevel, but the whole point is to use camlp4 (or camlp5). The code generated by camlp4 must be syntactically correct. No, camlp4 generates syntax trees (i.e. they don't have syntax other than abstract syntax). (But if there are any asserts in OCaml source that an AST element called a lower case identifier is actually lower case, that could be a problem.) But maybe you are talking about a deeper integration? One possibility would be to translate any Constr into a value in contexts where it cannot be parsed as applied to a value, and as constructor where it is applied to a value... It wouldn't be directly partially applicable, but it would serve most purposes since it would work as a function when passed to higher order functions as fold (and also could be easily rebound). ___ 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] Camllight packages
Well I'm just have done ubuntu package for camllight for maverick. I add a caml_all interactive mode to camllight and backup it for lucid, maverick and debian squeeze. With this mode, when doing $ camllight caml_all you can use libgraph, libnum and libunix in interactive mode. debian packages: deb http://boisson.homeip.net/debian squeeze divers (or etch lenny sarge sid squeeze woody) ubuntu packages: deb http://boisson.homeip.net/ubuntu/ maverick divers (or breezy dapper edgy feisty gutsy hardy intrepid jaunty karmic lucid maverick) apt-get install camllight source: deb-src http://boisson.homeip.net/source/ ./ apt-get source camllight François Boisson ___ 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