caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Hunting polymorphic function applications
@ 2004-07-23  4:44 Jon Harrop
  2004-07-23  8:16 ` Alain Frisch
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Harrop @ 2004-07-23  4:44 UTC (permalink / raw)
  To: caml-list


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?

Cheers,
Jon.

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Hunting polymorphic function applications
  2004-07-23  4:44 [Caml-list] Hunting polymorphic function applications Jon Harrop
@ 2004-07-23  8:16 ` Alain Frisch
  0 siblings, 0 replies; 2+ messages in thread
From: Alain Frisch @ 2004-07-23  8:16 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-23  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-23  4:44 [Caml-list] Hunting polymorphic function applications Jon Harrop
2004-07-23  8:16 ` Alain Frisch

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