From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA24977; Tue, 3 Feb 2004 03:07:53 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA25214 for ; Tue, 3 Feb 2004 03:07:48 +0100 (MET) Received: from gum.itee.uq.edu.au (gum.itee.uq.edu.au [130.102.66.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i1327kP05990 for ; Tue, 3 Feb 2004 03:07:46 +0100 (MET) Received: from nut.itee.uq.edu.au (nut.itee.uq.edu.au [130.102.66.13]) by gum.itee.uq.edu.au (8.12.10/8.12.10) with ESMTP id i1327WaM000434 for ; Tue, 3 Feb 2004 12:07:32 +1000 (EST) Received: from itee.uq.edu.au (g613-8948.itee.uq.edu.au [130.102.66.112]) by nut.itee.uq.edu.au (8.12.10/8.12.9) with ESMTP id i1327WY7015874 for ; Tue, 3 Feb 2004 12:07:32 +1000 (EST) Message-ID: <401F0263.8030105@itee.uq.edu.au> Date: Tue, 03 Feb 2004 12:07:31 +1000 From: Richard Cole User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] Questions about types and objects Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checked: This message probably not SPAM X-Spam-Score: -0.1 X-Spam-Tests: USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG X-Spam-Report: -0.10 points, 8 required; * 0.0 -- User-Agent header indicates a non-spam MUA (Mozilla) * -0.1 -- Has a X-Accept-Language header X-Scanned-By: MIMEDefang 2.35 X-Loop: caml-list@inria.fr X-Spam: no; 0.00; cole:99 lattice:01 lattice:01 cmx:01 bool:01 bool:01 ocaml:01 closure:01 int:01 int:01 tree:02 tree:02 objects:02 unit:03 unit:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello all, I'm new to ocaml and getting the following type error and I don't understand why: File "concept_lattice_editor.ml", line 99, characters 28-35: This expression has type ('a, 'b) Concept_lattice.concept_lattice = < determine_contingent : int -> unit; down_closure : int Rb_set.tree -> int Rb_set.tree; downset : int -> int Rb_set.tree; has_all_lower_covers_in : int Rb_set.tree -> int -> bool; has_all_upper_covers_in : int Rb_set.tree -> int -> bool; has_lower_covers_in : int Rb_set.tree -> int -> bool; has_upper_covers_in : int Rb_set.tree -> int -> bool; index : ('a, 'b) Concept.concept -> int; insert_top : int -> unit; insertion_site_from_bottom : int -> int Rb_set.tree; iter : (int -> unit) -> unit; iter_downset : (int -> unit) -> int -> unit; iter_upset : (int -> unit) -> int -> unit; lower_cover_union : int Rb_set.tree -> int Rb_set.tree; lower_covers : int -> int Rb_set.tree; next_cochain_down : int Rb_set.tree -> int Rb_set.tree -> int Rb_set.tree; next_cochain_up : int Rb_set.tree -> int Rb_set.tree -> int Rb_set.tree; trace : out_channel -> unit; trace_tree : out_channel -> int Rb_set.tree -> string -> unit; upper_cover_union : int Rb_set.tree -> int Rb_set.tree; upper_covers : int -> int Rb_set.tree; upset : int -> int Rb_set.tree; word : int -> ('a, 'b) Concept.concept > but is here used with type Hasse_diagram.abstract_hasse_diagram = < iter : (int -> unit) -> unit; upper_covers : int -> int Rb_set.tree; upset : int -> int Rb_set.tree > Only the first object type has a method determine_contingent make: *** [concept_lattice_editor.cmx] Error 2 From an expression: diagram#make_from_hasse lattice; Now "('a,'b) concept_lattice" inherits from "('a,'b) concept hasse_diagram" which in turn inherits from "abstract_hasse_diagram". So my question is: why isn't my ('a,'b) concept_lattice a refinement of abstract_hasse_diagram and thus able to be passed to diagram#make_from_hasse. Here's the make_from_hasse method on diagram: method make_from_hasse : abstract_hasse_diagram -> unit = fun hd -> let set_vect x = if (count (hd#upper_covers x)) == 1 then vect#insert_mapping x self#next_vector else () in let set_rep x = let set_rep_cand cand = if vect#is_domain_member cand then rep#insert x cand else () in iter set_rep_cand (hd#upset x); set_rep_cand x; in hd#iter set_vect; hd#iter set_rep; () regards, Richard. ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners