From 766eafa38b7a419a77b8e1fb8d4b763c60e9a41d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 May 2019 00:12:17 -0400 Subject: Added equivalence for any I64. --- stdlib/source/lux/data/number/i64.lux | 37 +++++++++++++++++++++-------------- 1 file 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) + ) -- cgit v1.2.3