diff options
author | Eduardo Julian | 2019-05-10 00:12:17 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-05-10 00:12:17 -0400 |
commit | 766eafa38b7a419a77b8e1fb8d4b763c60e9a41d (patch) | |
tree | d0110d8cece656c0c6ee9d4085d5011c52c913c9 | |
parent | a6ad4391394f37fb8a729a26e27826c17a477fec (diff) |
Added equivalence for any I64.
-rw-r--r-- | stdlib/source/lux/data/number/i64.lux | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/stdlib/source/lux/data/number/i64.lux b/stdlib/source/lux/data/number/i64.lux index dbc58b004..15b4ed821 100644 --- a/stdlib/source/lux/data/number/i64.lux +++ b/stdlib/source/lux/data/number/i64.lux @@ -1,7 +1,8 @@ (.module: [lux (#- and or not) [abstract - [monoid (#+ Monoid)]]]) + [monoid (#+ Monoid)] + [equivalence (#+ Equivalence)]]]) (def: #export bits-per-byte 8) @@ -32,20 +33,6 @@ (All [s] (-> (I64 s) (I64 s))) (xor (:coerce I64 -1))) -(structure: #export disjunction - (All [a] (Monoid (I64 a))) - - (def: identity (.i64 0)) - (def: compose ..or) - ) - -(structure: #export conjunction - (All [a] (Monoid (I64 a))) - - (def: identity (.i64 (..not 0))) - (def: compose ..and) - ) - (def: #export (mask bits) (-> Nat (I64 Any)) (|> 1 (..left-shift (n/% ..width bits)) .dec)) @@ -105,3 +92,23 @@ (def: #export (region size offset) (-> Nat Nat I64) (|> 1 (:coerce I64) (left-shift size) dec (left-shift offset))) + +(structure: #export equivalence + (All [a] (Equivalence (I64 a))) + + (def: (= parameter subject) + ("lux i64 =" parameter subject))) + +(structure: #export disjunction + (All [a] (Monoid (I64 a))) + + (def: identity (.i64 0)) + (def: compose ..or) + ) + +(structure: #export conjunction + (All [a] (Monoid (I64 a))) + + (def: identity (.i64 (..not 0))) + (def: compose ..and) + ) |