aboutsummaryrefslogtreecommitdiff
path: root/src/int.gleam
diff options
context:
space:
mode:
Diffstat (limited to 'src/int.gleam')
-rw-r--r--src/int.gleam13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/int.gleam b/src/int.gleam
index 00571de..5eeece4 100644
--- a/src/int.gleam
+++ b/src/int.gleam
@@ -1,3 +1,5 @@
+import order
+
pub enum NotAnInt =
| NotAnInt
@@ -6,3 +8,14 @@ pub external fn parse(String) -> Result(Int, NotAnInt) = "gleam__stdlib" "parse_
pub external fn to_string(Int) -> String = "erlang" "integer_to_binary"
pub external fn to_base_string(Int, Int) -> String = "erlang" "integer_to_binary"
+
+pub fn compare(a, b) {
+ case a == b {
+ | True -> order:Eq
+ | False ->
+ case a < b {
+ | True -> order:Lt
+ | False -> order:Gt
+ }
+ }
+}