caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <Alain.Frisch@ens.fr>
To: Jon Harrop <postmaster@jdh30.plus.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Hunting polymorphic function applications
Date: Fri, 23 Jul 2004 10:16:44 +0200 (MET DST)	[thread overview]
Message-ID: <Pine.SOL.4.44.0407231007240.3753-100000@clipper.ens.fr> (raw)
In-Reply-To: <200407230544.55323.postmaster@jdh30.plus.com>

On Fri, 23 Jul 2004, Jon Harrop wrote:

> For elegance, I've been using the built-in polymorphic comparisons
> (particularly equality) to compare ASTs. I just added some metadata to my AST
> type and now it needs its own comparison function (or polymorphic compare
> bails at run-time with Invalid_argument "equal: functional value").
>
> Is there an easy way, or does anyone have a tool, which will let me track down
> all applications of polymorphic functions to my AST type so that I can alter
> them to use my customised versions?

I sometimes use the following trick: redefine the operators at the
beginning of the module. E.g.:

let (=) (x:unit) : unit = assert false
let (<=) (x:unit) : unit = assert false
...
let compare (x:unit) : unit = assert false

This should produce type-errors where expected.

(Variant: "let (<=) = ((<=) : int -> int -> bool)" to
restrict the use to the integer case)

-- Alain



-------------------
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


      reply	other threads:[~2004-07-23  8:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-23  4:44 Jon Harrop
2004-07-23  8:16 ` Alain Frisch [this message]

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=Pine.SOL.4.44.0407231007240.3753-100000@clipper.ens.fr \
    --to=alain.frisch@ens.fr \
    --cc=caml-list@inria.fr \
    --cc=postmaster@jdh30.plus.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;
as well as URLs for NNTP newsgroup(s).