aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/data/format/binary.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/data/format/binary.lux')
-rw-r--r--stdlib/source/lux/data/format/binary.lux36
1 files changed, 18 insertions, 18 deletions
diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux
index b2feda2c5..4657b48d5 100644
--- a/stdlib/source/lux/data/format/binary.lux
+++ b/stdlib/source/lux/data/format/binary.lux
@@ -28,10 +28,10 @@
(type: #export Size Nat)
-(def: #export size/8 +1)
-(def: #export size/16 +2)
-(def: #export size/32 +4)
-(def: #export size/64 +8)
+(def: #export size/8 1)
+(def: #export size/16 2)
+(def: #export size/32 4)
+(def: #export size/64 8)
(type: #export Read
(p.Parser [Offset Binary]))
@@ -46,7 +46,7 @@
## Operators
(def: #export (read format input)
(All [a] (-> (Format a) Binary (Error a)))
- (case ((get@ #read format) [+0 input])
+ (case ((get@ #read format) [0 input])
(#error.Error msg)
(#error.Error msg)
@@ -59,7 +59,7 @@
(def: #export (write format value)
(All [a] (-> (Format a) a Binary))
(let [[valueS valueT] ((get@ #write format) value)]
- (|> valueS binary.create (valueT +0))))
+ (|> valueS binary.create (valueT 0))))
## Primitives
(do-template [<name> <size> <read> <write>]
@@ -91,9 +91,9 @@
{#read (do p.Monad<Parser>
[flag (get@ #read bits/8)]
(case flag
- +0 (:: @ map (|>> #.Left) (get@ #read leftB))
- +1 (:: @ map (|>> #.Right) (get@ #read rightB))
- _ (p.lift (ex.throw invalid-tag [+2 (.nat flag)]))))
+ 0 (:: @ map (|>> #.Left) (get@ #read leftB))
+ 1 (:: @ map (|>> #.Right) (get@ #read rightB))
+ _ (p.lift (ex.throw invalid-tag [2 (.nat flag)]))))
#write (function (_ altV)
(case altV
(#.Left leftV)
@@ -101,7 +101,7 @@
[(.inc leftS)
(function (_ offset binary)
(|> binary
- (binary.write/8 offset +0)
+ (binary.write/8 offset 0)
error.assume
(leftT (.inc offset))))])
@@ -110,7 +110,7 @@
[(.inc rightS)
(function (_ offset binary)
(|> binary
- (binary.write/8 offset +1)
+ (binary.write/8 offset 1)
error.assume
(rightT (.inc offset))))])
))})
@@ -141,7 +141,7 @@
{#read (function (_ input)
(#error.Success [input default]))
#write (function (_ value)
- [+0
+ [0
(function (_ offset binary)
binary)])})
@@ -157,19 +157,19 @@
(case (: Nat data)
(^template [<nat> <bit>]
<nat> (#error.Success [(inc offset) binary] <bit>))
- ([+0 #0]
- [+1 #1])
+ ([0 #0]
+ [1 #1])
_
- (ex.throw invalid-tag [+2 data]))
+ (ex.throw invalid-tag [2 data]))
(#error.Error error)
(#error.Error error)))
#write (function (_ value)
- [+1
+ [1
(function (_ offset binary)
(|> binary
- (binary.write/8 offset (if value +1 +0))
+ (binary.write/8 offset (if value 1 0))
error.assume))])})
(def: #export nat (Format Nat) (:assume ..bits/64))
@@ -198,7 +198,7 @@
(error.assume
(do error.Monad<Error>
[_ (binary.write/64 offset size binary)]
- (binary.copy size +0 value (n/+ size/64 offset) binary))))]))})
+ (binary.copy size 0 value (n/+ size/64 offset) binary))))]))})
(def: #export text
(Format Text)