aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/target/jvm/encoding/unsigned.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/target/jvm/encoding/unsigned.lux')
-rw-r--r--stdlib/source/lux/target/jvm/encoding/unsigned.lux23
1 files changed, 14 insertions, 9 deletions
diff --git a/stdlib/source/lux/target/jvm/encoding/unsigned.lux b/stdlib/source/lux/target/jvm/encoding/unsigned.lux
index f5db7a81a..15dd7a07e 100644
--- a/stdlib/source/lux/target/jvm/encoding/unsigned.lux
+++ b/stdlib/source/lux/target/jvm/encoding/unsigned.lux
@@ -3,12 +3,13 @@
[abstract
[equivalence (#+ Equivalence)]]
[control
- ["." parser ("#;." functor)]]
+ ["<>" parser ("#@." functor)
+ ["<2>" binary (#+ Parser)]]]
[data
[number
["." i64]]
[format
- ["." binary (#+ Format)]]]
+ [".F" binary (#+ Writer)]]]
[macro
["." template]]
[type
@@ -48,12 +49,16 @@
)
)
-(template [<name> <type> <format> <post-read>]
- [(def: #export <name>
- (Format <type>)
- (binary.adapt <post-read> ..nat <format>))]
+(template [<parser-name> <writer-name> <type> <parser> <writer> <post-read>]
+ [(def: #export <parser-name>
+ (Parser <type>)
+ (<>@map <post-read> <parser>))
- [u1-format U1 binary.bits/8 ..u1]
- [u2-format U2 binary.bits/16 ..u2]
- [u4-format U4 binary.bits/32 ..u4]
+ (def: #export <writer-name>
+ (Writer <type>)
+ (|>> ..nat <writer>))]
+
+ [u1-parser u1-writer U1 <2>.bits/8 binaryF.bits/8 ..u1]
+ [u2-parser u2-writer U2 <2>.bits/16 binaryF.bits/16 ..u2]
+ [u4-parser u4-writer U4 <2>.bits/32 binaryF.bits/32 ..u4]
)