|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
"ocaml_beginners"::[] compile-error "illegal permutation of structure fields"Hello,
by compiling a module I got following error: ---- 8>< --- 8>< --- 8>< ---- The implementation speedseg.ml does not match the interface (inferred signature): Module type declarations do not match: module type Speedseg = sig type segm_t = Background of int | Foreground of int | Unsegmented type bbox_t = { x0 : int; y0 : int; x1 : int; y1 : int; } type 'a tree_t = Leaf of 'a | Node of 'a tree_t * 'a tree_t exception SegmentationError of string val xsort : ('a * bbox_t) list -> ('a * bbox_t) list val ysort : ('a * bbox_t) list -> ('a * bbox_t) list val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) list val segment_page : Sdlvideo.surface -> Sdlvideo.color -> (segm_t * bbox_t) tree_t val draw_image : (segm_t * bbox_t) tree_t -> Sdlvideo.surface -> string -> (segm_t * bbox_t) list val intersection_and_complement : bbox_t -> bbox_t -> bool * bbox_t list * bbox_t list val test_if_connected : bbox_t -> bbox_t -> bool val filter_all_connected_bboxes : segm_t * bbox_t -> (segm_t * bbox_t) list -> (segm_t * bbox_t) list * (segm_t * bbox_t) list val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) list end does not match module type Speedseg = sig type segm_t = Background of int | Foreground of int | Unsegmented type bbox_t = { x0 : int; y0 : int; x1 : int; y1 : int; } type 'a tree_t = Leaf of 'a | Node of 'a tree_t * 'a tree_t exception SegmentationError of string val xsort : ('a * bbox_t) list -> ('a * bbox_t) list val ysort : ('a * bbox_t) list -> ('a * bbox_t) list val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) list val segment_page : Sdlvideo.surface -> Sdlvideo.color -> (segm_t * bbox_t) tree_t val draw_image : (segm_t * bbox_t) tree_t -> Sdlvideo.surface -> string -> (segm_t * bbox_t) list val intersection_and_complement : bbox_t -> bbox_t -> bool * bbox_t list * bbox_t list val test_if_connected : bbox_t -> bbox_t -> bool val filter_all_connected_bboxes : segm_t * bbox_t -> (segm_t * bbox_t) list -> (segm_t * bbox_t) list * (segm_t * bbox_t) list val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) list end Illegal permutation of structure fields ---- ><8 --- ><8 --- ><8 ---- If I comment out the last entry (compress_bboxes) then it will compile sucessfully. The problem is that there is no difference between both signatures. The signature is equivalent to the signature created with "ocamlc -i speedseg.ml" Could you help me to understand this error-message, please? PS.: I am using ocaml in version 3.10.2 (Debian Lenny) -- Andreas Romeyke - Abteilung Blindenschrift - Deutsche Zentralbücherei für Blinde zu Leipzig (DZB) Gustav-Adolf-Straße 7, 04105 Leipzig Tel: +49 341 7113-..., Fax: +49 341 7113-125 Internet: www.dzb.de E-Mail: andreas.romeyke@... [Non-text portions of this message have been removed] |
|
|
Re: "ocaml_beginners"::[] compile-error "illegal permutation of structure fields"Hi Andreas,
Looking at the first declaration I see: > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > list .... > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > list Two functions with the same parameters? If this is not an error try using different names for these functions. HTH, Hugo F. Romeyke, Andreas wrote: > Hello, > > by compiling a module I got following error: > > ---- 8>< --- 8>< --- 8>< ---- > The implementation speedseg.ml > does not match the interface (inferred signature): > Module type declarations do not match: > module type Speedseg = > sig > type segm_t = Background of int | Foreground of int | Unsegmented > type bbox_t = { x0 : int; y0 : int; x1 : int; y1 : int; } > type 'a tree_t = Leaf of 'a | Node of 'a tree_t * 'a tree_t > exception SegmentationError of string > val xsort : ('a * bbox_t) list -> ('a * bbox_t) list > val ysort : ('a * bbox_t) list -> ('a * bbox_t) list > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > list > val segment_page : > Sdlvideo.surface -> Sdlvideo.color -> (segm_t * bbox_t) tree_t > val draw_image : > (segm_t * bbox_t) tree_t -> > Sdlvideo.surface -> string -> (segm_t * bbox_t) list > val intersection_and_complement : > bbox_t -> bbox_t -> bool * bbox_t list * bbox_t list > val test_if_connected : bbox_t -> bbox_t -> bool > val filter_all_connected_bboxes : > segm_t * bbox_t -> > (segm_t * bbox_t) list -> > (segm_t * bbox_t) list * (segm_t * bbox_t) list > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > list > end > does not match > module type Speedseg = > sig > type segm_t = Background of int | Foreground of int | Unsegmented > type bbox_t = { x0 : int; y0 : int; x1 : int; y1 : int; } > type 'a tree_t = Leaf of 'a | Node of 'a tree_t * 'a tree_t > exception SegmentationError of string > val xsort : ('a * bbox_t) list -> ('a * bbox_t) list > val ysort : ('a * bbox_t) list -> ('a * bbox_t) list > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > list > val segment_page : > Sdlvideo.surface -> Sdlvideo.color -> (segm_t * bbox_t) tree_t > val draw_image : > (segm_t * bbox_t) tree_t -> > Sdlvideo.surface -> string -> (segm_t * bbox_t) list > val intersection_and_complement : > bbox_t -> bbox_t -> bool * bbox_t list * bbox_t list > val test_if_connected : bbox_t -> bbox_t -> bool > val filter_all_connected_bboxes : > segm_t * bbox_t -> > (segm_t * bbox_t) list -> > (segm_t * bbox_t) list * (segm_t * bbox_t) list > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > list > end > Illegal permutation of structure fields > ---- ><8 --- ><8 --- ><8 ---- > > If I comment out the last entry (compress_bboxes) then it will compile > sucessfully. The problem is that there is no difference between both > signatures. The signature is equivalent to the signature created with > "ocamlc -i speedseg.ml" > > Could you help me to understand this error-message, please? > > PS.: I am using ocaml in version 3.10.2 (Debian Lenny) > |
|
|
Re: "ocaml_beginners"::[] compile-error "illegal permutation of structure fields"Hi Andreas and Hugo,
Hugo Ferreira a écrit : > > > Hi Andreas, > > Looking at the first declaration I see: > > > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > > list > .... > > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > > list > > Two functions with the same parameters? > If this is not an error try using different names > for these functions. That is what I would have suggested, and indeed, if I try to compile: --------------- module type Foo = sig val f : int -> int val f : int -> int end;; module Bar : Foo = struct let f x = x let f x = x+1 end;; --------------- I get the same error. But this works in a top-level. We can then do : --------------- # Bar.f 3;; - : int = 4 --------------- Does anyone knows why ? -- Chantal KELLER |
|
|
Re: "ocaml_beginners"::[] compile-error "illegal permutation ofstructure fields"Hello,
Am Montag, den 16.11.2009, 13:36 +0000 schrieb Hugo Ferreira: > > Looking at the first declaration I see: > > > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > > list > .... > > val compress_bboxes : (segm_t * bbox_t) list -> (segm_t * bbox_t) > > list > > Two functions with the same parameters? > If this is not an error try using different names > for these functions. Thanks, that was the reason, I had 2 signatures used... Thanks :) Bye Andreas -- Andreas Romeyke - Abteilung Blindenschrift - Deutsche Zentralbücherei für Blinde zu Leipzig (DZB) Gustav-Adolf-Straße 7, 04105 Leipzig Tel: +49 341 7113-..., Fax: +49 341 7113-125 Internet: www.dzb.de E-Mail: andreas.romeyke@... [Non-text portions of this message have been removed] |
| Free embeddable forum powered by Nabble | Forum Help |