]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.runtime/scl/Comparator.scl
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.scl.runtime / scl / Comparator.scl
diff --git a/bundles/org.simantics.scl.runtime/scl/Comparator.scl b/bundles/org.simantics.scl.runtime/scl/Comparator.scl
new file mode 100644 (file)
index 0000000..ade3861
--- /dev/null
@@ -0,0 +1,19 @@
+import "Prelude"\r
+\r
+importJava "java.util.Comparator" where\r
+    """\r
+    A comparison function, which imposes a total ordering on some collection of objects\r
+    """\r
+    data Comparator a\r
+    \r
+    @JavaName compare\r
+    """\r
+    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
+    """\r
+    compareWithComparator :: Comparator a -> a -> a -> Integer\r
+\r
+"""\r
+Sorts the list using the given comparator.\r
+"""\r
+sortWithComparator :: Comparator a -> [a] -> [a]\r
+sortWithComparator = sortWith . compareWithComparator
\ No newline at end of file