From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Joel Reymont" <joelr1@gmail.com>
Cc: "OCaml List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Re: GenerateFold
Date: Tue, 5 Jun 2007 14:25:38 +0200 [thread overview]
Message-ID: <cd67f63a0706050525u5863d354t21dd32ca644ed07d@mail.gmail.com> (raw)
In-Reply-To: <cd67f63a0706010907i56b24e9cl94e1acc126451aed@mail.gmail.com>
I've fixed the fold generation for record types in the CVS.
On 6/1/07, Nicolas Pouillard <nicolas.pouillard@gmail.com> wrote:
> Ok there is a bug in the fold generation we using records, but the
> previous example (without records) compiled fine for me. So
> records+fold is buggy for now.
>
> On 6/1/07, Joel Reymont <joelr1@gmail.com> wrote:
> > Doesn't work!
> >
> > On Jun 1, 2007, at 2:30 PM, Nicolas Pouillard wrote:
> >
> > > Got it:
> > >
> > > There is the solution available for meditation :)
> >
> > To be precise, I don't know if it works or not. I think the fold
> > generator bombs out.
> >
> > I have no idea how to debug this but, again, it has nothing to do
> > with the implementation of is_fun_arg.
> >
> > Simply using GenerateFold triggers the error. Notice that everything
> > but class fold = ... is commented out. I'm including everything
> > needed to reproduce the error, just in case.
> >
> > ocamlbuild c.byte
> > + /usr/local/bin/ocamlc.opt -c -I +camlp4 -pp 'camlp4of -I src -
> > filter map -filter fold -filter trash ' -o b.cmo b.ml
> > File "ghost-location", line 1, characters 0-0:
> > This expression has type
> > < array : 'b. ('a -> 'b -> 'a) -> 'b array -> 'a; bool : bool -> 'a;
> > expr : A.expr -> 'a; float : float -> 'a; id : A.id -> 'a;
> > input_decl : A.input_decl -> 'a; int : int -> 'a;
> > list : 'c. ('a -> 'c -> 'a) -> 'c list -> 'a;
> > option : 'd. ('a -> 'd -> 'a) -> 'd option -> 'a; order :
> > A.order -> 'a;
> > order_type : A.order_type -> 'a; program : A.program -> 'a;
> > ref : 'e. ('a -> 'e -> 'a) -> 'e ref -> 'a;
> > statement : A.statement -> 'a; string : string -> 'a;
> > subscript : A.subscript -> 'a; ty : A.ty -> 'a; .. >
> > as 'a
> > but is here used with type A.order_type
> >
> > cat b.ml
> > open A
> >
> > class fold = Camlp4Filters.GenerateFold.generated;;
> >
> > (*
> > let is_fun_arg = object
> > inherit fold as super
> > val found = false
> > method found = found
> > method input_decl x =
> > match x with
> > | `FunArgDecl _ -> {< found = true >}
> > | _ -> super#input_decl x
> > end
> >
> > let is_fun x = (is_fun_arg#statement x)#found;;
> > *)
> >
> > module Camlp4Trash = struct
> > INCLUDE "a.ml";;
> > end;;
> >
> > cat a.ml
> > type id = string
> >
> > and program = statement list
> >
> > and ty =
> > [
> > | `TyAny
> > ]
> >
> > and statement =
> > [
> > | `Skip
> > | `InputDecls of input_decl list
> > ]
> >
> > and subscript = expr list
> >
> > and input_decl =
> > [
> > | `InputDecl of id * ty * expr
> > | `FunArgDecl of id * ty * subscript
> > ]
> >
> > and expr =
> > [
> > | `Int of int
> > | `Float of float
> > | `Str of string
> > ]
> >
> > and order = {
> > order_type: order_type;
> > }
> >
> > and order_type =
> > [
> > | `Buy
> > | `Sell
> > | `Short
> > | `Cover
> > ]
> >
> > cat c.ml
> > open A
> > open B
> >
> > cat _tags
> > "b.ml": use_camlp4, pp(camlp4of -I src -filter map -filter fold -
> > filter trash )
> >
> >
> > --
> > http://topdog.cc - EasyLanguage to C# translator
> > http://wagerlabs.com - Blog
> >
> >
> >
> >
> >
> >
>
>
> --
> Nicolas Pouillard
>
--
Nicolas Pouillard
prev parent reply other threads:[~2007-06-05 12:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-31 12:18 GenerateFold Joel Reymont
2007-05-31 15:29 ` GenerateFold Nicolas Pouillard
2007-05-31 17:41 ` GenerateFold Joel Reymont
2007-05-31 18:58 ` GenerateFold Joel Reymont
2007-05-31 22:05 ` GenerateFold Nicolas Pouillard
2007-05-31 22:16 ` GenerateFold Joel Reymont
2007-05-31 22:34 ` GenerateFold Joel Reymont
2007-06-01 6:08 ` [Caml-list] GenerateFold Edgar Friendly
2007-06-01 13:22 ` Joel Reymont
2007-06-01 13:30 ` Nicolas Pouillard
2007-06-01 13:44 ` Joel Reymont
2007-06-01 16:07 ` Nicolas Pouillard
2007-06-05 12:25 ` Nicolas Pouillard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd67f63a0706050525u5863d354t21dd32ca644ed07d@mail.gmail.com \
--to=nicolas.pouillard@gmail.com \
--cc=caml-list@inria.fr \
--cc=joelr1@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox