aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/source/lux/data/name.lux19
1 files changed, 19 insertions, 0 deletions
diff --git a/stdlib/source/lux/data/name.lux b/stdlib/source/lux/data/name.lux
index b54988169..3ad96cd84 100644
--- a/stdlib/source/lux/data/name.lux
+++ b/stdlib/source/lux/data/name.lux
@@ -3,6 +3,7 @@
[abstract
[monoid (#+)]
[equivalence (#+ Equivalence)]
+ [order (#+ Order)]
[codec (#+ Codec)]
hash]
[data
@@ -25,6 +26,24 @@
(and (text@= xmodule ymodule)
(text@= xname yname))))
+(def: (name@< [moduleP shortP] [moduleS shortS])
+ (-> Name Name Bit)
+ (if (text@= moduleP moduleS)
+ (:: text.order < shortP shortS)
+ (:: text.order < moduleP moduleS)))
+
+(structure: #export order (Order Name)
+ (def: &equivalence ..equivalence)
+ (def: < name@<)
+ (def: (<= parameter subject)
+ (or (:: ..equivalence = parameter subject)
+ (name@< parameter subject)))
+ (def: (> parameter subject)
+ (name@< subject parameter))
+ (def: (>= parameter subject)
+ (or (:: ..equivalence = subject parameter)
+ (name@< subject parameter))))
+
(structure: #export codec (Codec Text Name)
(def: (encode [module short])
(case module