caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Physical counterpart to Pervasives.compare?
@ 2009-07-29  1:25 Elnatan Reisner
  0 siblings, 0 replies; 2+ messages in thread
From: Elnatan Reisner @ 2009-07-29  1:25 UTC (permalink / raw)
  To: caml-list

Is there something that can complete this analogy:
(=) is to (==) as Pervasives.compare is to ___?

That is, is there a polymorphic total ordering with respect to *physical*
entities, rather than to their structure?

I'm afraid of getting into trouble with Obj.magic, but what would this do:
let f (x:'a) (y:'a) = compare (Obj.magic x) (Obj.magic y)
? Or would annotations make any difference:
let f (x:'a) (y:'a) = compare (Obj.magic x : int) (Obj.magic y : int)

-Elnatan


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

end of thread, other threads:[~2009-08-26 10:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20090826100004.0169CBC58@yquem.inria.fr>
2009-08-26 10:14 ` Physical counterpart to Pervasives.compare? Pascal Cuoq
2009-07-29  1:25 Elnatan Reisner

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