-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thursday 29 May 2008 04:13:20 am Christophe Raffalli wrote: > Via Custom block (section 18.9.1 of the manual), you could create a functor > with the following shape (I did not check my syntax): > > module type Quotient = > type t > type qt > val class : t -> qt > val get_representent : qt -> t > end > > module type Equivalence = > type t > val compare : t -> t -> int > end > > module Make_Quotient (R : Equivalence) : Quotient with type t = R.t > > Such that (class x) builds a custom block with > the given compare as comparison function ... > You can add hash and serialization to the Equivalence type too ... > > It is a pity we have to do that from C, this should be the default way > to bridge the gap between polymorphic comparison and specific comparison. > (and PML will provide a buildin class constructor in the near future). > > Hope this helps, > Christophe This is very interesting. I've never read that part of the manual. It's probably too much overhead for me, so I'll resort to cut + paste first and see how it goes. Thanks, Peng -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFIPq66fIRcEFL/JewRAh2mAKCjCBE3OLYeAudddf5qCoF5jtKmLgCfTRWP Q5xoPoXccaD512zj99mDs7Q= =X2pn -----END PGP SIGNATURE----- _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs