aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/data/format/binary.lux22
-rw-r--r--stdlib/source/lux/target/jvm/constant/pool.lux11
2 files changed, 16 insertions, 17 deletions
diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux
index 5e35829c8..a947de559 100644
--- a/stdlib/source/lux/data/format/binary.lux
+++ b/stdlib/source/lux/data/format/binary.lux
@@ -172,9 +172,9 @@
(def: #export text ..utf8/64)
-(template [<name> <with-offset> <bits> <size> <write>]
- [(def: #export (<with-offset> extra-count valueW)
- (All [v] (-> Nat (Writer v) (Writer (Row v))))
+(template [<name> <size> <write>]
+ [(def: #export (<name> valueW)
+ (All [v] (-> (Writer v) (Writer (Row v))))
(function (_ value)
(let [original-count (row.size value)
capped-count (i64.and (..mask <size>)
@@ -193,17 +193,13 @@
(function (_ [offset binary])
(try.assume
(do try.monad
- [_ (<write> offset (n/+ extra-count capped-count) binary)]
- (wrap (mutation [(n/+ <size> offset) binary])))))])))
-
- (def: #export <name>
- (All [v] (-> (Writer v) (Writer (Row v))))
- (<with-offset> 0))]
+ [_ (<write> offset capped-count binary)]
+ (wrap (mutation [(n/+ <size> offset) binary])))))])))]
- [row/8 row/8' ..bits/8 /.size/8 binary.write/8]
- [row/16 row/16' ..bits/16 /.size/16 binary.write/16]
- [row/32 row/32' ..bits/32 /.size/32 binary.write/32]
- [row/64 row/64' ..bits/64 /.size/64 binary.write/64]
+ [row/8 /.size/8 binary.write/8]
+ [row/16 /.size/16 binary.write/16]
+ [row/32 /.size/32 binary.write/32]
+ [row/64 /.size/64 binary.write/64]
)
(def: #export maybe
diff --git a/stdlib/source/lux/target/jvm/constant/pool.lux b/stdlib/source/lux/target/jvm/constant/pool.lux
index 773607858..062f7553b 100644
--- a/stdlib/source/lux/target/jvm/constant/pool.lux
+++ b/stdlib/source/lux/target/jvm/constant/pool.lux
@@ -14,10 +14,9 @@
["." text
["%" format (#+ format)]]
[format
- [".F" binary (#+ Writer)]]
+ [".F" binary (#+ Writer) ("specification@." monoid)]]
[collection
- ["." list ("#;." fold)]
- ["." row (#+ Row)]]]
+ ["." row (#+ Row) ("#@." fold)]]]
[type
abstract]
[macro
@@ -194,7 +193,11 @@
(def: #export writer
(Writer Pool)
- (binaryF.row/16' ..offset //.writer))
+ (function (_ pool)
+ (row@fold (function (_ post pre)
+ (specification@compose pre (//.writer post)))
+ (binaryF.bits/16 (n/+ ..offset (row.size pool)))
+ pool)))
(def: #export empty
Pool