[CakeML-dev] Adding polymorphic compare to CakeML

Magnus Myreen magnus.myreen at gmail.com
Mon Nov 28 23:17:34 UTC 2016


Hi all,

I'm currently re-implementing recursive equality in wordLang.

It occurred to me that it's easy to add support for something
similar to OCaml's polymorphic compare function. Example:

    # compare;;
    - : 'a -> 'a -> int = <fun>
    # compare 0 1;;
    - : int = -1
    # compare 0 2;;
    - : int = -1
    # compare 1 1;;
    - : int = 0
    # compare 2 1;;
    - : int = 1
    # compare 3 1;;
    - : int = 1

The CakeML semantics of this primitive would be pretty clean for
values that do not contain closures or references.

If no one is against having compare in CakeML, then I'll add it to BVL
and downwards. I would need help in propagating it all the way to the
source semantics.

Cheers,
Magnus



More information about the Developers mailing list