Version française
Home     About     Download     Resources     Contact us    
Browse thread
GenerateFold
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Re: GenerateFold
Got it:

There is the solution available for meditation :)

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


On 6/1/07, Joel Reymont <joelr1@gmail.com> wrote:
> I figured it out. The following introduction of order and order_type
> [2] triggers the error I was seeing previously [1]. This should be
> enough to reproduce the issue and, hopefully, provide clues on how to
> fix it. I have no clues, btw.
>
>         Thanks, Joel
>
> [1] Error
>
> 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
>
> [2] Code with order and order_type.
>
> 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
>      ]
>
>
>
> --
> http://topdog.cc      - EasyLanguage to C# translator
> http://wagerlabs.com  - Blog
>

-- 
Nicolas Pouillard