From: Richard Cole <rcole@itee.uq.edu.au>
To: caml-list@inria.fr
Subject: [Caml-list] Questions about types and objects
Date: Tue, 03 Feb 2004 12:07:31 +1000 [thread overview]
Message-ID: <401F0263.8030105@itee.uq.edu.au> (raw)
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
next reply other threads:[~2004-02-03 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-03 2:07 Richard Cole [this message]
2004-02-03 9:32 ` Richard Jones
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=401F0263.8030105@itee.uq.edu.au \
--to=rcole@itee.uq.edu.au \
--cc=caml-list@inria.fr \
/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