aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/target/jvm/index.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/target/jvm/index.lux38
1 files changed, 38 insertions, 0 deletions
diff --git a/stdlib/source/library/lux/target/jvm/index.lux b/stdlib/source/library/lux/target/jvm/index.lux
new file mode 100644
index 000000000..851d6903f
--- /dev/null
+++ b/stdlib/source/library/lux/target/jvm/index.lux
@@ -0,0 +1,38 @@
+(.module:
+ [library
+ [lux #*
+ [abstract
+ ["." equivalence (#+ Equivalence)]]
+ [data
+ [format
+ [binary (#+ Writer)]]]
+ [type
+ abstract]]]
+ ["." // #_
+ [encoding
+ ["#." unsigned (#+ U2)]]])
+
+(def: #export length
+ //unsigned.bytes/2)
+
+(abstract: #export (Index kind)
+ U2
+
+ (def: #export index
+ (All [kind] (-> U2 (Index kind)))
+ (|>> :abstraction))
+
+ (def: #export value
+ (-> (Index Any) U2)
+ (|>> :representation))
+
+ (def: #export equivalence
+ (All [kind] (Equivalence (Index kind)))
+ (\ equivalence.functor map
+ ..value
+ //unsigned.equivalence))
+
+ (def: #export writer
+ (All [kind] (Writer (Index kind)))
+ (|>> :representation //unsigned.writer/2))
+ )