From 1d9118493710e5a28a21ed0bf98f3c8713c69853 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 6 Jul 2019 21:33:40 -0400 Subject: No more alternative row writers. --- stdlib/source/lux/data/format/binary.lux | 22 +++++++++------------- stdlib/source/lux/target/jvm/constant/pool.lux | 11 +++++++---- 2 files changed, 16 insertions(+), 17 deletions(-) (limited to 'stdlib') 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 [ ] - [(def: #export ( extra-count valueW) - (All [v] (-> Nat (Writer v) (Writer (Row v)))) +(template [ ] + [(def: #export ( valueW) + (All [v] (-> (Writer v) (Writer (Row v)))) (function (_ value) (let [original-count (row.size value) capped-count (i64.and (..mask ) @@ -193,17 +193,13 @@ (function (_ [offset binary]) (try.assume (do try.monad - [_ ( offset (n/+ extra-count capped-count) binary)] - (wrap (mutation [(n/+ offset) binary])))))]))) - - (def: #export - (All [v] (-> (Writer v) (Writer (Row v)))) - ( 0))] + [_ ( offset capped-count binary)] + (wrap (mutation [(n/+ 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 -- cgit v1.2.3