]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.runtime/scl/Comparator.scl
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / bundles / org.simantics.scl.runtime / scl / Comparator.scl
1 import "Prelude"
2
3 importJava "java.util.Comparator" where
4     """
5     A comparison function, which imposes a total ordering on some collection of objects
6     """
7     data Comparator a
8     
9     @JavaName compare
10     """
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.
12     """
13     compareWithComparator :: Comparator a -> a -> a -> Integer
14
15 """
16 Sorts the list using the given comparator.
17 """
18 sortWithComparator :: Comparator a -> [a] -> [a]
19 sortWithComparator = sortWith . compareWithComparator