]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.runtime/scl/Comparator.scl
Merge commit '53059ca'
[simantics/platform.git] / bundles / org.simantics.scl.runtime / scl / Comparator.scl
1 import "Prelude"\r
2 \r
3 importJava "java.util.Comparator" where\r
4     """\r
5     A comparison function, which imposes a total ordering on some collection of objects\r
6     """\r
7     data Comparator a\r
8     \r
9     @JavaName compare\r
10     """\r
11     Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.\r
12     """\r
13     compareWithComparator :: Comparator a -> a -> a -> Integer\r
14 \r
15 """\r
16 Sorts the list using the given comparator.\r
17 """\r
18 sortWithComparator :: Comparator a -> [a] -> [a]\r
19 sortWithComparator = sortWith . compareWithComparator