1 (* Copyright (C
) 2009 Matthew Fluet
.
2 * Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
3 * Jagannathan
, and Stephen Weeks
.
5 * MLton is released under a BSD
-style license
.
6 * See the file MLton
-LICENSE for details
.
12 datatype t
= datatype order
14 val equals
: t
* t
-> bool = op =
18 | GREATER
=> "Greater"
21 fun lessEqual
{<, equals
} =
24 fun a
<= b
= a
< b
orelse equals (a
, b
)
25 fun a
>= b
= b
< a
orelse equals (b
, a
)
26 fun compare (a
, b
) = if a
< b
then LESS
27 else if equals (a
, b
) then EQUAL
29 fun min (x
, y
) = if x
< y
then x
else y
30 fun max (x
, y
) = if x
< y
then y
else x
31 in {> = op >, <= = op <=, >= = op >=,
32 compare
= compare
, min
= min
, max
= max
}
36 let fun equals (x
, y
) = (case c (x
, y
) of
39 fun x
< y
= (case c (x
, y
) of
42 fun x
<= y
= (case c (x
, y
) of
46 fun x
> y
= (case c (x
, y
) of
49 fun x
>= y
= (case c (x
, y
) of
53 fun max (x
, y
) = (case c (x
, y
) of
56 fun min (x
, y
) = (case c (x
, y
) of
60 < = op <, > = op >, <= = op <=, >= = op >=,