From: "Francisco Valverde Albacete" <fva@tsc.uc3m.es>
To: John R Harrison <johnh@ichips.intel.com>, caml-list@inria.fr
Subject: Re: [Caml-list] User-defined equality on types?
Date: Thu, 19 Apr 2001 19:44:37 +0200 [thread overview]
Message-ID: <3ADF2405.4976B91E@tsc.uc3m.es> (raw)
In-Reply-To: <200104181942.MAA05265@dhpc0010.pdx.intel.com>
Hi, please read below the question:
John R Harrison wrote:
> I'd like to suggest allowing the user to define a chosen interpretation
> of the equality symbol, and perhaps the polymorphic orderings too, on
> each new (maybe just abstract) data type. This seems natural in the
> context of abstract data types with non-canonical representation, giving
> a kind of quotient type. Has this ever been considered?
Have you considered using functors defining your datatype structures? In that way
you can customise the use of equality throught the whole module with something like:
module ParameterisedADT
(Eq: sig
type t
val (=) : t -> t -> bool
end)
=
struct
(* code of the ADT with whatever uses of your own "="! *)
end
you just have to supply a structure for formal parameter Eq with the adequate
semantics. The semantics of this new operation will be entirely up to the
implementation in the parameter module (you can do really strange things here).
Hope it helps.
Fran Valverde
PS: I apologise for the lack of French version. My French is way too rusty to write
anything sensible with it. FVA.
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr
next prev parent reply other threads:[~2001-04-19 17:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-18 19:42 John R Harrison
2001-04-19 17:44 ` Francisco Valverde Albacete [this message]
2001-04-19 23:25 ` John R Harrison
2001-04-19 19:57 ` Alain Frisch
2001-04-23 8:54 ` Xavier Leroy
2001-04-23 16:42 ` Brian Rogoff
2001-04-24 8:33 ` Andreas Rossberg
2001-04-19 21:00 Don Syme
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=3ADF2405.4976B91E@tsc.uc3m.es \
--to=fva@tsc.uc3m.es \
--cc=caml-list@inria.fr \
--cc=johnh@ichips.intel.com \
/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