diff options
author | Eduardo Julian | 2018-07-05 00:34:35 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-07-05 00:34:35 -0400 |
commit | b8e44ec6ee38d3f67b7e3c3989de51b03e7a1352 (patch) | |
tree | c126f9a239da03a57a8fe1c3e131314f97be37ce /stdlib/test | |
parent | 023874d8cb82f59bf73a7663d7e8e3a1062ae15f (diff) |
- Re-named "equality" to "equivalence".
Diffstat (limited to '')
68 files changed, 268 insertions, 279 deletions
diff --git a/stdlib/test/test/lux.lux b/stdlib/test/test/lux.lux index fc649eec3..211cf6d6b 100644 --- a/stdlib/test/test/lux.lux +++ b/stdlib/test/test/lux.lux @@ -6,7 +6,7 @@ ["r" math/random] (data [maybe] [bit] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format) [macro] (macro ["s" syntax #+ syntax:]))) diff --git a/stdlib/test/test/lux/cli.lux b/stdlib/test/test/lux/cli.lux index 4aed244b2..b8bc50e9e 100644 --- a/stdlib/test/test/lux/cli.lux +++ b/stdlib/test/test/lux/cli.lux @@ -8,7 +8,7 @@ [sum] ["E" error] [number] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format (coll [list])) ["r" math/random] diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index 6de1634ec..8a1e04849 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -29,7 +29,7 @@ (wrap output))) (context: "FRP" - (let [(^open "list/") (list.Eq<List> number.Eq<Int>)] + (let [(^open "list/") (list.Equivalence<List> number.Equivalence<Int>)] ($_ seq (wrap (do promise.Monad<Promise> [#let [values (list 0 1 2 3 4 5)] diff --git a/stdlib/test/test/lux/concurrency/semaphore.lux b/stdlib/test/test/lux/concurrency/semaphore.lux index b360426c5..0100ee2ac 100644 --- a/stdlib/test/test/lux/concurrency/semaphore.lux +++ b/stdlib/test/test/lux/concurrency/semaphore.lux @@ -2,7 +2,7 @@ lux (lux (control [monad #+ do]) (data [maybe] - [text "text/" Eq<Text> Monoid<Text>] + [text "text/" Equivalence<Text> Monoid<Text>] text/format (coll [list "list/" Functor<List>])) (concurrency ["/" semaphore] diff --git a/stdlib/test/test/lux/concurrency/stm.lux b/stdlib/test/test/lux/concurrency/stm.lux index 9f3c5bd7e..4bebfa3e7 100644 --- a/stdlib/test/test/lux/concurrency/stm.lux +++ b/stdlib/test/test/lux/concurrency/stm.lux @@ -54,7 +54,7 @@ _ (&.commit (&.update (n/* +3) _var)) changes (promise.future (atom.read changes))] (assert "Can follow all the changes to STM vars." - (:: (list.Eq<List> number.Eq<Nat>) = + (:: (list.Equivalence<List> number.Equivalence<Nat>) = (list +5 +15) (list.reverse changes))))) (wrap (let [_concurrency-var (&.var +0)] diff --git a/stdlib/test/test/lux/control/continuation.lux b/stdlib/test/test/lux/control/continuation.lux index ea43b511d..bda63e3e1 100644 --- a/stdlib/test/test/lux/control/continuation.lux +++ b/stdlib/test/test/lux/control/continuation.lux @@ -57,7 +57,7 @@ (test "Can use delimited continuations with shifting." (let [(^open "&/") &.Monad<Cont> - (^open "L/") (list.Eq<List> number.Eq<Nat>) + (^open "L/") (list.Equivalence<List> number.Equivalence<Nat>) visit (: (-> (List Nat) (&.Cont (List Nat) (List Nat))) (function (visit xs) diff --git a/stdlib/test/test/lux/control/equality.lux b/stdlib/test/test/lux/control/equality.lux deleted file mode 100644 index 5139b41ea..000000000 --- a/stdlib/test/test/lux/control/equality.lux +++ /dev/null @@ -1,19 +0,0 @@ -(.module: - lux - (lux (control ["/" equality] - [monad #+ do]) - (math ["r" random]) - test)) - -(def: #export (spec Eq<a> generator) - (All [a] (-> (/.Eq a) (r.Random a) Test)) - (do r.Monad<Random> - [sample generator - another generator] - ($_ seq - (test "Equality is reflexive." - (:: Eq<a> = sample sample)) - (test "Equality is symmetric." - (if (:: Eq<a> = sample another) - (:: Eq<a> = another sample) - true))))) diff --git a/stdlib/test/test/lux/control/equivalence.lux b/stdlib/test/test/lux/control/equivalence.lux new file mode 100644 index 000000000..18265af6c --- /dev/null +++ b/stdlib/test/test/lux/control/equivalence.lux @@ -0,0 +1,19 @@ +(.module: + lux + (lux (control ["/" equivalence] + [monad #+ do]) + (math ["r" random]) + test)) + +(def: #export (spec Equivalence<a> generator) + (All [a] (-> (/.Equivalence a) (r.Random a) Test)) + (do r.Monad<Random> + [sample generator + another generator] + ($_ seq + (test "Equivalence is reflexive." + (:: Equivalence<a> = sample sample)) + (test "Equivalence is symmetric." + (if (:: Equivalence<a> = sample another) + (:: Equivalence<a> = another sample) + true))))) diff --git a/stdlib/test/test/lux/control/interval.lux b/stdlib/test/test/lux/control/interval.lux index 3187c0b7b..06fe5cbde 100644 --- a/stdlib/test/test/lux/control/interval.lux +++ b/stdlib/test/test/lux/control/interval.lux @@ -11,12 +11,12 @@ (coll ["S" set/unordered] ["L" list])))) -(context: "Equality." +(context: "Equivalence." (<| (times +100) (do @ [bottom r.int top r.int - #let [(^open "&/") &.Eq<Interval>]] + #let [(^open "&/") &.Equivalence<Interval>]] ($_ seq (test "Every interval is equal to itself." (and (let [self (&.between number.Enum<Int> bottom top)] @@ -92,7 +92,7 @@ right-singleton gen-singleton left-outer gen-outer right-outer gen-outer - #let [(^open "&/") &.Eq<Interval>]] + #let [(^open "&/") &.Equivalence<Interval>]] ($_ seq (test "The union of an interval to itself yields the same interval." (&/= some-interval (&.union some-interval some-interval))) @@ -114,7 +114,7 @@ right-singleton gen-singleton left-outer gen-outer right-outer gen-outer - #let [(^open "&/") &.Eq<Interval>]] + #let [(^open "&/") &.Equivalence<Interval>]] ($_ seq (test "The intersection of an interval to itself yields the same interval." (&/= some-interval (&.intersection some-interval some-interval))) @@ -130,7 +130,7 @@ (<| (times +100) (do @ [some-interval gen-interval - #let [(^open "&/") &.Eq<Interval>]] + #let [(^open "&/") &.Equivalence<Interval>]] ($_ seq (test "The complement of a complement is the same as the original." (&/= some-interval (|> some-interval &.complement &.complement))) diff --git a/stdlib/test/test/lux/control/parser.lux b/stdlib/test/test/lux/control/parser.lux index fd1f67724..c7293c2ee 100644 --- a/stdlib/test/test/lux/control/parser.lux +++ b/stdlib/test/test/lux/control/parser.lux @@ -2,7 +2,7 @@ lux (lux [io] (control ["M" monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Equivalence] ["&" parser] pipe) (data [text "Text/" Monoid<Text>] diff --git a/stdlib/test/test/lux/control/pipe.lux b/stdlib/test/test/lux/control/pipe.lux index d159cfeb9..1288b5302 100644 --- a/stdlib/test/test/lux/control/pipe.lux +++ b/stdlib/test/test/lux/control/pipe.lux @@ -7,7 +7,7 @@ [number] [product] identity - [text "text/" Eq<Text>]) + [text "text/" Equivalence<Text>]) ["r" math/random]) lux/test) diff --git a/stdlib/test/test/lux/control/writer.lux b/stdlib/test/test/lux/control/writer.lux index 49335de0d..35df0ae06 100644 --- a/stdlib/test/test/lux/control/writer.lux +++ b/stdlib/test/test/lux/control/writer.lux @@ -4,7 +4,7 @@ (control ["M" monad #+ do Monad] pipe ["&" writer]) - (data [text "Text/" Monoid<Text> Eq<Text>] + (data [text "Text/" Monoid<Text> Equivalence<Text>] [number] [product])) lux/test) diff --git a/stdlib/test/test/lux/data/bool.lux b/stdlib/test/test/lux/data/bool.lux index d7bc88e87..ead88f0db 100644 --- a/stdlib/test/test/lux/data/bool.lux +++ b/stdlib/test/test/lux/data/bool.lux @@ -18,17 +18,17 @@ (:: And@Monoid<Bool> identity) (not (:: And@Monoid<Bool> compose value (not value))) - (:: Eq<Bool> = value (not (not value))) - (not (:: Eq<Bool> = value (not value))) + (:: Equivalence<Bool> = value (not (not value))) + (not (:: Equivalence<Bool> = value (not value))) - (not (:: Eq<Bool> = value ((complement id) value))) - (:: Eq<Bool> = value ((complement not) value)) + (not (:: Equivalence<Bool> = value ((complement id) value))) + (:: Equivalence<Bool> = value ((complement not) value)) (case (|> value (:: Codec<Text,Bool> encode) (:: Codec<Text,Bool> decode)) (#.Right dec-value) - (:: Eq<Bool> = value dec-value) + (:: Equivalence<Bool> = value dec-value) (#.Left _) false) diff --git a/stdlib/test/test/lux/data/coll/array.lux b/stdlib/test/test/lux/data/coll/array.lux index 125694cc7..c29baefc3 100644 --- a/stdlib/test/test/lux/data/coll/array.lux +++ b/stdlib/test/test/lux/data/coll/array.lux @@ -29,11 +29,11 @@ (test "Size function must correctly return size of array." (n/= size (@.size original))) (test "Cloning an array should yield and identical array, but not the same one." - (and (:: (@.Eq<Array> number.Eq<Nat>) = original clone) + (and (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original clone) (not (is? original clone)))) (test "Full-range manual copies should give the same result as cloning." (exec (@.copy size +0 original +0 copy) - (and (:: (@.Eq<Array> number.Eq<Nat>) = original copy) + (and (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original copy) (not (is? original copy))))) (test "Array folding should go over all values." (exec (:: @.Fold<Array> fold @@ -42,11 +42,11 @@ (inc idx))) +0 original) - (:: (@.Eq<Array> number.Eq<Nat>) = original manual-copy))) + (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original manual-copy))) (test "Transformations between (full) arrays and lists shouldn't cause lose or change any values." (|> original @.to-list @.from-list - (:: (@.Eq<Array> number.Eq<Nat>) = original))) + (:: (@.Equivalence<Array> number.Equivalence<Nat>) = original))) )))) (context: "Array mutation" @@ -102,7 +102,7 @@ [size bounded-size array (r.array size r.nat)] (let [(^open) @.Functor<Array> - (^open) (@.Eq<Array> number.Eq<Nat>)] + (^open) (@.Equivalence<Array> number.Equivalence<Nat>)] ($_ seq (test "Functor shouldn't alter original array." (let [copy (map id array)] @@ -122,7 +122,7 @@ left (r.array sizeL r.nat) right (r.array sizeR r.nat) #let [(^open) @.Monoid<Array> - (^open) (@.Eq<Array> number.Eq<Nat>) + (^open) (@.Equivalence<Array> number.Equivalence<Nat>) fusion (compose left right)]] ($_ seq (test "Appending two arrays should produce a new one twice as large." diff --git a/stdlib/test/test/lux/data/coll/bits.lux b/stdlib/test/test/lux/data/coll/bits.lux index a5141034c..0fbe2edb2 100644 --- a/stdlib/test/test/lux/data/coll/bits.lux +++ b/stdlib/test/test/lux/data/coll/bits.lux @@ -5,7 +5,7 @@ (data (coll ["/" bits])) ["r" math/random]) lux/test - (test (lux (control ["_eq" equality])))) + (test (lux (control ["_eq" equivalence])))) (def: (size min max) (-> Nat Nat (r.Random Nat)) @@ -57,7 +57,7 @@ (not (/.intersects? sample (/.not sample)))) (test "'and' with oneself changes nothing" - (:: /.Eq<Bits> = sample (/.and sample sample))) + (:: /.Equivalence<Bits> = sample (/.and sample sample))) (test "'and' with one's opposite yields the empty bit-set." (is? /.empty (/.and sample (/.not sample)))) @@ -72,9 +72,9 @@ (/.capacity sample))) (test "Double negation results in original bit-set." - (:: /.Eq<Bits> = sample (/.not (/.not sample)))) + (:: /.Equivalence<Bits> = sample (/.not (/.not sample)))) (test "Negation does not affect the empty bit-set." (is? /.empty (/.not /.empty))) - (_eq.spec /.Eq<Bits> ..bits) + (_eq.spec /.Equivalence<Bits> ..bits) )))) diff --git a/stdlib/test/test/lux/data/coll/dictionary/ordered.lux b/stdlib/test/test/lux/data/coll/dictionary/ordered.lux index a373f6107..bb13ac532 100644 --- a/stdlib/test/test/lux/data/coll/dictionary/ordered.lux +++ b/stdlib/test/test/lux/data/coll/dictionary/ordered.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad] - [equality #+ Eq]) + [equivalence #+ Equivalence]) (data [product] [number] (coll (set ["s" unordered]) @@ -27,7 +27,7 @@ (n/< left right)) pairs) sorted-values (L/map product.right sorted-pairs) - (^open "&/") (&.Eq<Dict> number.Eq<Nat>)]] + (^open "&/") (&.Equivalence<Dict> number.Equivalence<Nat>)]] ($_ seq (test "Can query the size of a dictionary." (n/= size (&.size sample))) @@ -60,10 +60,10 @@ (&/= sample))) (test "Order is preserved." - (let [(^open "L/") (list.Eq<List> (: (Eq [Nat Nat]) - (function (_ [kr vr] [ks vs]) - (and (n/= kr ks) - (n/= vr vs)))))] + (let [(^open "L/") (list.Equivalence<List> (: (Equivalence [Nat Nat]) + (function (_ [kr vr] [ks vs]) + (and (n/= kr ks) + (n/= vr vs)))))] (L/= (&.entries sample) sorted-pairs))) diff --git a/stdlib/test/test/lux/data/coll/dictionary/unordered.lux b/stdlib/test/test/lux/data/coll/dictionary/unordered.lux index 93b83dc7b..bde4810a5 100644 --- a/stdlib/test/test/lux/data/coll/dictionary/unordered.lux +++ b/stdlib/test/test/lux/data/coll/dictionary/unordered.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad] - ["eq" equality]) + ["eq" equivalence]) (data [text] text/format [number] @@ -19,7 +19,7 @@ size capped-nat dict (r.dict number.Hash<Nat> size r.nat capped-nat) non-key (|> r.nat (r.filter (function (_ key) (not (&.contains? key dict))))) - test-val (|> r.nat (r.filter (function (_ val) (not (list.member? number.Eq<Nat> (&.values dict) val)))))] + test-val (|> r.nat (r.filter (function (_ val) (not (list.member? number.Equivalence<Nat> (&.values dict) val)))))] ($_ seq (test "Size function should correctly represent Dict size." (n/= size (&.size dict))) @@ -30,7 +30,7 @@ (not (&.empty? dict)))) (test "The functions 'entries', 'keys' and 'values' should be synchronized." - (:: (list.Eq<List> (eq.product number.Eq<Nat> number.Eq<Nat>)) = + (:: (list.Equivalence<List> (eq.product number.Equivalence<Nat> number.Equivalence<Nat>)) = (&.entries dict) (list.zip2 (&.keys dict) (&.values dict)))) @@ -89,19 +89,19 @@ (n/= (dec (&.size plus)) (&.size base))))) (test "A Dict should equal itself & going to<->from lists shouldn't change that." - (let [(^open) (&.Eq<Dict> number.Eq<Nat>)] + (let [(^open) (&.Equivalence<Dict> number.Equivalence<Nat>)] (and (= dict dict) (|> dict &.entries (&.from-list number.Hash<Nat>) (= dict))))) (test "Merging a Dict to itself changes nothing." - (let [(^open) (&.Eq<Dict> number.Eq<Nat>)] + (let [(^open) (&.Equivalence<Dict> number.Equivalence<Nat>)] (= dict (&.merge dict dict)))) (test "If you merge, and the second dict has overlapping keys, it should overwrite yours." (let [dict' (|> dict &.entries (list/map (function (_ [k v]) [k (inc v)])) (&.from-list number.Hash<Nat>)) - (^open) (&.Eq<Dict> number.Eq<Nat>)] + (^open) (&.Equivalence<Dict> number.Equivalence<Nat>)] (= dict' (&.merge dict' dict)))) (test "Can merge values in such a way that they become combined." diff --git a/stdlib/test/test/lux/data/coll/list.lux b/stdlib/test/test/lux/data/coll/list.lux index 73eb25d85..d57b19b9c 100644 --- a/stdlib/test/test/lux/data/coll/list.lux +++ b/stdlib/test/test/lux/data/coll/list.lux @@ -25,7 +25,7 @@ other-size bounded-size other-sample (r.list other-size r.nat) separator r.nat - #let [(^open) (&.Eq<List> number.Eq<Nat>) + #let [(^open) (&.Equivalence<List> number.Equivalence<Nat>) (^open "&/") &.Functor<List>]] ($_ seq (test "The size function should correctly portray the size of the list." @@ -59,7 +59,7 @@ (test "Any element of the list can be considered its member." (let [elem (maybe.assume (&.nth idx sample))] - (&.member? number.Eq<Nat> sample elem))) + (&.member? number.Equivalence<Nat> sample elem))) )))) (context: "Lists: Part 2" @@ -71,7 +71,7 @@ other-size bounded-size other-sample (r.list other-size r.nat) separator r.nat - #let [(^open) (&.Eq<List> number.Eq<Nat>) + #let [(^open) (&.Equivalence<List> number.Equivalence<Nat>) (^open "&/") &.Functor<List>]] ($_ seq (test "Appending the head and the tail should yield the original list." @@ -134,7 +134,7 @@ separator r.nat from (|> r.nat (:: @ map (n/% +10))) to (|> r.nat (:: @ map (n/% +10))) - #let [(^open) (&.Eq<List> number.Eq<Nat>) + #let [(^open) (&.Equivalence<List> number.Equivalence<Nat>) (^open "&/") &.Functor<List>]] ($_ seq (test "If you zip 2 lists, the result's size will be that of the smaller list." @@ -212,10 +212,10 @@ (&/map product.right enum-sample))))) (test "Ranges can be constructed forward and backwards." - (and (let [(^open "list/") (&.Eq<List> number.Eq<Nat>)] + (and (let [(^open "list/") (&.Equivalence<List> number.Equivalence<Nat>)] (list/= (&.n/range from to) (&.reverse (&.n/range to from)))) - (let [(^open "list/") (&.Eq<List> number.Eq<Int>) + (let [(^open "list/") (&.Equivalence<List> number.Equivalence<Int>) from (.int from) to (.int to)] (list/= (&.i/range from to) diff --git a/stdlib/test/test/lux/data/coll/queue.lux b/stdlib/test/test/lux/data/coll/queue.lux index 7edcbf9b4..12d924963 100644 --- a/stdlib/test/test/lux/data/coll/queue.lux +++ b/stdlib/test/test/lux/data/coll/queue.lux @@ -13,7 +13,7 @@ [size (:: @ map (n/% +100) r.nat) sample (r.queue size r.nat) non-member (|> r.nat - (r.filter (|>> (&.member? number.Eq<Nat> sample) not)))] + (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not)))] ($_ seq (test "I can query the size of a queue (and empty queues have size 0)." (if (n/= +0 size) @@ -27,7 +27,7 @@ (n/= size (&.size (&.pop (&.push non-member sample)))))) (test "Transforming to/from list can't change the queue." - (let [(^open "&/") (&.Eq<Queue> number.Eq<Nat>)] + (let [(^open "&/") (&.Equivalence<Queue> number.Equivalence<Nat>)] (|> sample &.to-list &.from-list (&/= sample)))) @@ -38,14 +38,14 @@ (#.Some _) true)) (test "I can query whether an element belongs to a queue." - (and (not (&.member? number.Eq<Nat> sample non-member)) - (&.member? number.Eq<Nat> (&.push non-member sample) + (and (not (&.member? number.Equivalence<Nat> sample non-member)) + (&.member? number.Equivalence<Nat> (&.push non-member sample) non-member) (case (&.peek sample) #.None (&.empty? sample) (#.Some first) - (and (&.member? number.Eq<Nat> sample first) - (not (&.member? number.Eq<Nat> (&.pop sample) first)))))) + (and (&.member? number.Equivalence<Nat> sample first) + (not (&.member? number.Equivalence<Nat> (&.pop sample) first)))))) )))) diff --git a/stdlib/test/test/lux/data/coll/queue/priority.lux b/stdlib/test/test/lux/data/coll/queue/priority.lux index 38527523a..17664056c 100644 --- a/stdlib/test/test/lux/data/coll/queue/priority.lux +++ b/stdlib/test/test/lux/data/coll/queue/priority.lux @@ -25,7 +25,7 @@ [size (|> r.nat (:: @ map (n/% +100))) sample (gen-queue size) non-member-priority r.nat - non-member (|> r.nat (r.filter (|>> (&.member? number.Eq<Nat> sample) not)))] + non-member (|> r.nat (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not)))] ($_ seq (test "I can query the size of a queue (and empty queues have size 0)." (n/= size (&.size sample))) @@ -38,15 +38,15 @@ (&.size (&.pop sample)))))) (test "I can query whether an element belongs to a queue." - (and (and (not (&.member? number.Eq<Nat> sample non-member)) - (&.member? number.Eq<Nat> + (and (and (not (&.member? number.Equivalence<Nat> sample non-member)) + (&.member? number.Equivalence<Nat> (&.push non-member-priority non-member sample) non-member)) (or (n/= +0 (&.size sample)) - (and (&.member? number.Eq<Nat> + (and (&.member? number.Equivalence<Nat> sample (maybe.assume (&.peek sample))) - (not (&.member? number.Eq<Nat> + (not (&.member? number.Equivalence<Nat> (&.pop sample) (maybe.assume (&.peek sample)))))))) )))) diff --git a/stdlib/test/test/lux/data/coll/row.lux b/stdlib/test/test/lux/data/coll/row.lux index 3a4da0f42..643dcbe24 100644 --- a/stdlib/test/test/lux/data/coll/row.lux +++ b/stdlib/test/test/lux/data/coll/row.lux @@ -16,8 +16,8 @@ idx (|> r.nat (:: @ map (n/% size))) sample (r.row size r.nat) other-sample (r.row size r.nat) - non-member (|> r.nat (r.filter (|>> (&.member? number.Eq<Nat> sample) not))) - #let [(^open "&/") (&.Eq<Row> number.Eq<Nat>) + non-member (|> r.nat (r.filter (|>> (&.member? number.Equivalence<Nat> sample) not))) + #let [(^open "&/") (&.Equivalence<Row> number.Equivalence<Nat>) (^open "&/") &.Apply<Row> (^open "&/") &.Monad<Row> (^open "&/") &.Fold<Row> @@ -50,8 +50,8 @@ (|> sample &.to-list &.from-list (&/= sample))) (test "Can identify members of a row." - (and (not (&.member? number.Eq<Nat> sample non-member)) - (&.member? number.Eq<Nat> (&.add non-member sample) non-member))) + (and (not (&.member? number.Equivalence<Nat> sample non-member)) + (&.member? number.Equivalence<Nat> (&.add non-member sample) non-member))) (test "Can fold over elements of row." (n/= (list/fold n/+ +0 (&.to-list sample)) diff --git a/stdlib/test/test/lux/data/coll/sequence.lux b/stdlib/test/test/lux/data/coll/sequence.lux index 44eea350b..d1e91bcd1 100644 --- a/stdlib/test/test/lux/data/coll/sequence.lux +++ b/stdlib/test/test/lux/data/coll/sequence.lux @@ -21,7 +21,7 @@ elem r.nat cycle-seed (r.list size r.nat) cycle-sample-idx (|> r.nat (:: @ map (n/% +1000))) - #let [(^open "List/") (list.Eq<List> number.Eq<Nat>) + #let [(^open "List/") (list.Equivalence<List> number.Equivalence<Nat>) sample0 (&.iterate inc +0) sample1 (&.iterate inc offset)]] ($_ seq @@ -84,7 +84,7 @@ (test "'unfold' generalizes 'iterate'." (let [(^open "&/") &.Functor<Sequence> - (^open "List/") (list.Eq<List> text.Eq<Text>)] + (^open "List/") (list.Equivalence<List> text.Equivalence<Text>)] (List/= (&.take size (&/map Nat/encode (&.iterate inc offset))) (&.take size diff --git a/stdlib/test/test/lux/data/coll/set/ordered.lux b/stdlib/test/test/lux/data/coll/set/ordered.lux index cb78ad963..fd4fb5579 100644 --- a/stdlib/test/test/lux/data/coll/set/ordered.lux +++ b/stdlib/test/test/lux/data/coll/set/ordered.lux @@ -22,7 +22,7 @@ sizeR gen-nat listL (|> (r.set number.Hash<Nat> sizeL gen-nat) (:: @ map s.to-list)) listR (|> (r.set number.Hash<Nat> sizeR gen-nat) (:: @ map s.to-list)) - #let [(^open "&/") &.Eq<Set> + #let [(^open "&/") &.Equivalence<Set> setL (&.from-list number.Order<Nat> listL) setR (&.from-list number.Order<Nat> listR) sortedL (list.sort n/< listL) @@ -61,7 +61,7 @@ (test "Order is preserved." (let [listL (&.to-list setL) - (^open "L/") (list.Eq<List> number.Eq<Nat>)] + (^open "L/") (list.Equivalence<List> number.Equivalence<Nat>)] (L/= listL (list.sort n/< listL)))) diff --git a/stdlib/test/test/lux/data/coll/set/unordered.lux b/stdlib/test/test/lux/data/coll/set/unordered.lux index bdb896e8b..f17867665 100644 --- a/stdlib/test/test/lux/data/coll/set/unordered.lux +++ b/stdlib/test/test/lux/data/coll/set/unordered.lux @@ -22,7 +22,7 @@ setR (r.set number.Hash<Nat> sizeR gen-nat) non-member (|> gen-nat (r.filter (|>> (&.member? setL) not))) - #let [(^open "&/") &.Eq<Set>]] + #let [(^open "&/") &.Equivalence<Set>]] ($_ seq (test "I can query the size of a set." (and (n/= sizeL (&.size setL)) diff --git a/stdlib/test/test/lux/data/coll/tree/rose.lux b/stdlib/test/test/lux/data/coll/tree/rose.lux index fdc385515..133f2ef20 100644 --- a/stdlib/test/test/lux/data/coll/tree/rose.lux +++ b/stdlib/test/test/lux/data/coll/tree/rose.lux @@ -4,7 +4,7 @@ (control [monad #+ do Monad]) (data [product] [number] - [text "T/" Eq<Text>] + [text "T/" Equivalence<Text>] text/format (coll (tree ["&" rose]) [list "L/" Monad<List> Fold<List>])) @@ -30,11 +30,11 @@ (<| (times +100) (do @ [[size sample] gen-tree - #let [(^open "&/") (&.Eq<Tree> number.Eq<Nat>) + #let [(^open "&/") (&.Equivalence<Tree> number.Equivalence<Nat>) (^open "&/") &.Fold<Tree> concat (function (_ addition partial) (format partial (%n addition)))]] ($_ seq - (test "Can compare trees for equality." + (test "Can compare trees for equivalence." (&/= sample sample)) (test "Can flatten a tree to get all the nodes as a flat tree." diff --git a/stdlib/test/test/lux/data/coll/tree/rose/zipper.lux b/stdlib/test/test/lux/data/coll/tree/rose/zipper.lux index ff52e706d..0f5eff838 100644 --- a/stdlib/test/test/lux/data/coll/tree/rose/zipper.lux +++ b/stdlib/test/test/lux/data/coll/tree/rose/zipper.lux @@ -36,8 +36,8 @@ new-val r.nat pre-val r.nat post-val r.nat - #let [(^open "tree/") (rose.Eq<Tree> number.Eq<Nat>) - (^open "list/") (list.Eq<List> number.Eq<Nat>)]] + #let [(^open "tree/") (rose.Equivalence<Tree> number.Equivalence<Nat>) + (^open "list/") (list.Equivalence<List> number.Equivalence<Nat>)]] ($_ seq (test "Trees can be converted to/from zippers." (|> sample diff --git a/stdlib/test/test/lux/data/color.lux b/stdlib/test/test/lux/data/color.lux index 58bba6749..776862749 100644 --- a/stdlib/test/test/lux/data/color.lux +++ b/stdlib/test/test/lux/data/color.lux @@ -57,8 +57,8 @@ (f/<= 0.75 saturation))))))) ratio (|> r.frac (r.filter (f/>= 0.5)))] ($_ seq - (test "Has equality." - (:: @.Eq<Color> = any any)) + (test "Has equivalence." + (:: @.Equivalence<Color> = any any)) (test "Can convert to/from HSL." (|> any @.to-hsl @.from-hsl (distance any) @@ -78,7 +78,7 @@ (distance (@.brighter ratio colorful) white)))) (test "Can calculate complement." (let [~any (@.complement any) - (^open "@/") @.Eq<Color>] + (^open "@/") @.Equivalence<Color>] (and (not (@/= any ~any)) (@/= any (@.complement ~any))))) (test "Can saturate color." diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index b3196e1e6..e630b7a49 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -3,7 +3,7 @@ (lux [io] (control [monad #+ do Monad] codec - [equality #+ Eq] + [equivalence #+ Equivalence] pipe ["p" parser]) (data [text] @@ -20,7 +20,7 @@ (macro [code] [syntax #+ syntax:] [poly #+ derived:] - [poly/equality] + [poly/equivalence] [poly/json]) (type [unit]) ["r" math/random] @@ -51,7 +51,7 @@ (<| (times +100) (do @ [sample gen-json - #let [(^open "@/") @.Eq<JSON> + #let [(^open "@/") @.Equivalence<JSON> (^open "@/") @.Codec<Text,JSON>]] ($_ seq (test "Every JSON is equal to itself." @@ -97,7 +97,7 @@ (r.alt r.frac (r.seq r.frac gen-recursive))))) -(derived: (poly/equality.Eq<?> Recursive)) +(derived: (poly/equivalence.Equivalence<?> Recursive)) (def: qty (All [unit] (r.Random (unit.Qty unit))) @@ -125,38 +125,38 @@ (derived: (poly/json.Codec<JSON,?> Record)) -(struct: _ (Eq Record) +(struct: _ (Equivalence Record) (def: (= recL recR) (let [variant/= (function (_ left right) (case [left right] [(#Case0 left') (#Case0 right')] - (:: bool.Eq<Bool> = left' right') + (:: bool.Equivalence<Bool> = left' right') [(#Case1 left') (#Case1 right')] - (:: text.Eq<Text> = left' right') + (:: text.Equivalence<Text> = left' right') [(#Case2 left') (#Case2 right')] (f/= left' right') _ false))] - (and (:: bool.Eq<Bool> = (get@ #bool recL) (get@ #bool recR)) + (and (:: bool.Equivalence<Bool> = (get@ #bool recL) (get@ #bool recR)) (f/= (get@ #frac recL) (get@ #frac recR)) - (:: text.Eq<Text> = (get@ #text recL) (get@ #text recR)) - (:: (maybe.Eq<Maybe> number.Eq<Frac>) = (get@ #maybe recL) (get@ #maybe recR)) - (:: (list.Eq<List> number.Eq<Frac>) = (get@ #list recL) (get@ #list recR)) - (:: (d.Eq<Dict> number.Eq<Frac>) = (get@ #dict recL) (get@ #dict recR)) + (:: text.Equivalence<Text> = (get@ #text recL) (get@ #text recR)) + (:: (maybe.Equivalence<Maybe> number.Equivalence<Frac>) = (get@ #maybe recL) (get@ #maybe recR)) + (:: (list.Equivalence<List> number.Equivalence<Frac>) = (get@ #list recL) (get@ #list recR)) + (:: (d.Equivalence<Dict> number.Equivalence<Frac>) = (get@ #dict recL) (get@ #dict recR)) ## (variant/= (get@ #variant recL) (get@ #variant recR)) ## (let [[tL0 tL1 tL2] (get@ #tuple recL) ## [tR0 tR1 tR2] (get@ #tuple recR)] - ## (and (:: bool.Eq<Bool> = tL0 tR0) + ## (and (:: bool.Equivalence<Bool> = tL0 tR0) ## (f/= tL1 tR1) - ## (:: text.Eq<Text> = tL2 tR2))) - (:: Eq<Recursive> = (get@ #recursive recL) (get@ #recursive recR)) - ## (:: ti.Eq<Instant> = (get@ #instant recL) (get@ #instant recR)) - (:: tdu.Eq<Duration> = (get@ #duration recL) (get@ #duration recR)) - (:: tda.Eq<Date> = (get@ #date recL) (get@ #date recR)) - (:: unit.Eq<Unit> = (get@ #grams recL) (get@ #grams recR)) + ## (:: text.Equivalence<Text> = tL2 tR2))) + (:: Equivalence<Recursive> = (get@ #recursive recL) (get@ #recursive recR)) + ## (:: ti.Equivalence<Instant> = (get@ #instant recL) (get@ #instant recR)) + (:: tdu.Equivalence<Duration> = (get@ #duration recL) (get@ #duration recR)) + (:: tda.Equivalence<Date> = (get@ #date recL) (get@ #date recR)) + (:: unit.Equivalence<Unit> = (get@ #grams recL) (get@ #grams recR)) )))) (context: "Polytypism" @@ -164,7 +164,7 @@ ## (times +100) (do @ [sample gen-record - #let [(^open "@/") Eq<Record> + #let [(^open "@/") Equivalence<Record> (^open "@/") Codec<JSON,Record>]] (test "Can encode/decode arbitrary types." (|> sample @/encode @/decode diff --git a/stdlib/test/test/lux/data/format/xml.lux b/stdlib/test/test/lux/data/format/xml.lux index b7377ab64..27d904a98 100644 --- a/stdlib/test/test/lux/data/format/xml.lux +++ b/stdlib/test/test/lux/data/format/xml.lux @@ -4,7 +4,7 @@ (control [monad #+ do Monad] ["p" parser] pipe) - (data [text "text/" Eq<Text>] + (data [text "text/" Equivalence<Text>] text/format [ident] ["E" error] @@ -59,7 +59,7 @@ (<| (times +100) (do @ [sample gen-xml - #let [(^open "&/") &.Eq<XML> + #let [(^open "&/") &.Equivalence<XML> (^open "&/") &.Codec<Text,XML>]] ($_ seq (test "Every XML is equal to itself." @@ -112,7 +112,7 @@ (do E.Monad<Error> [outputs (|> (&.children (p.some &.text)) (&.run node))] - (wrap (:: (list.Eq<List> text.Eq<Text>) = + (wrap (:: (list.Equivalence<List> text.Equivalence<Text>) = children outputs))))) )))) diff --git a/stdlib/test/test/lux/data/ident.lux b/stdlib/test/test/lux/data/ident.lux index 5e39bad7f..b1e4c8490 100644 --- a/stdlib/test/test/lux/data/ident.lux +++ b/stdlib/test/test/lux/data/ident.lux @@ -4,7 +4,7 @@ (control [monad #+ do Monad] pipe) (data ["&" ident] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format) ["r" math/random]) lux/test) @@ -28,14 +28,14 @@ module2 (gen-part sizeM2) name2 (gen-part sizeN2) #let [ident2 [module2 name2]] - #let [(^open "&/") &.Eq<Ident> + #let [(^open "&/") &.Equivalence<Ident> (^open "&/") &.Codec<Text,Ident>]] ($_ seq (test "Can get the module & name parts of an ident." (and (is? module1 (&.module ident1)) (is? name1 (&.name ident1)))) - (test "Can compare idents for equality." + (test "Can compare idents for equivalence." (and (&/= ident1 ident1) (if (&/= ident1 ident2) (and (text/= module1 module2) @@ -56,7 +56,7 @@ )))) (context: "Ident-related macros." - (let [(^open "&/") &.Eq<Ident>] + (let [(^open "&/") &.Equivalence<Ident>] ($_ seq (test "Can obtain Ident from symbol." (and (&/= ["lux" "yolo"] (ident-for .yolo)) diff --git a/stdlib/test/test/lux/data/identity.lux b/stdlib/test/test/lux/data/identity.lux index f5ac9c6ba..479ec5670 100644 --- a/stdlib/test/test/lux/data/identity.lux +++ b/stdlib/test/test/lux/data/identity.lux @@ -4,7 +4,7 @@ (control ["M" monad #+ do Monad] comonad) (data ["&" identity] - [text "Text/" Monoid<Text> Eq<Text>])) + [text "Text/" Monoid<Text> Equivalence<Text>])) lux/test) (context: "Identity" diff --git a/stdlib/test/test/lux/data/maybe.lux b/stdlib/test/test/lux/data/maybe.lux index 9723500f5..8353461b7 100644 --- a/stdlib/test/test/lux/data/maybe.lux +++ b/stdlib/test/test/lux/data/maybe.lux @@ -12,7 +12,7 @@ (let [(^open "&/") &.Monoid<Maybe> (^open "&/") &.Apply<Maybe> (^open "&/") &.Monad<Maybe> - (^open "Maybe/") (&.Eq<Maybe> text.Eq<Text>)] + (^open "Maybe/") (&.Equivalence<Maybe> text.Equivalence<Text>)] ($_ seq (test "Can compare Maybe values." (and (Maybe/= #.None #.None) diff --git a/stdlib/test/test/lux/data/number.lux b/stdlib/test/test/lux/data/number.lux index 9f3d94a2e..4afba422a 100644 --- a/stdlib/test/test/lux/data/number.lux +++ b/stdlib/test/test/lux/data/number.lux @@ -4,26 +4,26 @@ (control ["M" monad #+ do Monad] pipe) (data number - [text "Text/" Monoid<Text> Eq<Text>] + [text "Text/" Monoid<Text> Equivalence<Text>] text/format) ["r" math/random]) lux/test) -(do-template [category rand-gen <Eq> <Order>] - [(context: (format "[" category "] " "Eq & Order") +(do-template [category rand-gen <Equivalence> <Order>] + [(context: (format "[" category "] " "Equivalence & Order") (<| (times +100) (do @ [x rand-gen y rand-gen] - (test "" (and (:: <Eq> = x x) - (or (:: <Eq> = x y) + (test "" (and (:: <Equivalence> = x x) + (or (:: <Equivalence> = x y) (:: <Order> < y x) (:: <Order> > y x)))))))] - ["Nat" r.nat Eq<Nat> Order<Nat>] - ["Int" r.int Eq<Int> Order<Int>] - ["Rev" r.rev Eq<Rev> Order<Rev>] - ["Frac" r.frac Eq<Frac> Order<Frac>] + ["Nat" r.nat Equivalence<Nat> Order<Nat>] + ["Int" r.int Equivalence<Int> Order<Int>] + ["Rev" r.rev Equivalence<Rev> Order<Rev>] + ["Frac" r.frac Equivalence<Frac> Order<Frac>] ) (do-template [category rand-gen <Number> <Order>] @@ -119,7 +119,7 @@ ["Frac/Max" r.frac Number<Frac> Order<Frac> Max@Monoid<Frac> (f/% 1000.0) (f/> 0.0)] ) -(do-template [<category> <rand-gen> <Eq> <Codec>] +(do-template [<category> <rand-gen> <Equivalence> <Codec>] [(context: (format "[" <category> "] " "Alternative formats") (<| (times +100) (do @ @@ -129,30 +129,30 @@ (:: <Codec> encode) (:: <Codec> decode) (case> (#.Right x') - (:: <Eq> = x x') + (:: <Equivalence> = x x') (#.Left _) false))))))] - ["Nat/Binary" r.nat Eq<Nat> Binary@Codec<Text,Nat>] - ["Nat/Octal" r.nat Eq<Nat> Octal@Codec<Text,Nat>] - ["Nat/Decimal" r.nat Eq<Nat> Codec<Text,Nat>] - ["Nat/Hex" r.nat Eq<Nat> Hex@Codec<Text,Nat>] - - ["Int/Binary" r.int Eq<Int> Binary@Codec<Text,Int>] - ["Int/Octal" r.int Eq<Int> Octal@Codec<Text,Int>] - ["Int/Decimal" r.int Eq<Int> Codec<Text,Int>] - ["Int/Hex" r.int Eq<Int> Hex@Codec<Text,Int>] - - ["Rev/Binary" r.rev Eq<Rev> Binary@Codec<Text,Rev>] - ["Rev/Octal" r.rev Eq<Rev> Octal@Codec<Text,Rev>] - ["Rev/Decimal" r.rev Eq<Rev> Codec<Text,Rev>] - ["Rev/Hex" r.rev Eq<Rev> Hex@Codec<Text,Rev>] - - ["Frac/Binary" r.frac Eq<Frac> Binary@Codec<Text,Frac>] - ["Frac/Octal" r.frac Eq<Frac> Octal@Codec<Text,Frac>] - ["Frac/Decimal" r.frac Eq<Frac> Codec<Text,Frac>] - ["Frac/Hex" r.frac Eq<Frac> Hex@Codec<Text,Frac>] + ["Nat/Binary" r.nat Equivalence<Nat> Binary@Codec<Text,Nat>] + ["Nat/Octal" r.nat Equivalence<Nat> Octal@Codec<Text,Nat>] + ["Nat/Decimal" r.nat Equivalence<Nat> Codec<Text,Nat>] + ["Nat/Hex" r.nat Equivalence<Nat> Hex@Codec<Text,Nat>] + + ["Int/Binary" r.int Equivalence<Int> Binary@Codec<Text,Int>] + ["Int/Octal" r.int Equivalence<Int> Octal@Codec<Text,Int>] + ["Int/Decimal" r.int Equivalence<Int> Codec<Text,Int>] + ["Int/Hex" r.int Equivalence<Int> Hex@Codec<Text,Int>] + + ["Rev/Binary" r.rev Equivalence<Rev> Binary@Codec<Text,Rev>] + ["Rev/Octal" r.rev Equivalence<Rev> Octal@Codec<Text,Rev>] + ["Rev/Decimal" r.rev Equivalence<Rev> Codec<Text,Rev>] + ["Rev/Hex" r.rev Equivalence<Rev> Hex@Codec<Text,Rev>] + + ["Frac/Binary" r.frac Equivalence<Frac> Binary@Codec<Text,Frac>] + ["Frac/Octal" r.frac Equivalence<Frac> Octal@Codec<Text,Frac>] + ["Frac/Decimal" r.frac Equivalence<Frac> Codec<Text,Frac>] + ["Frac/Hex" r.frac Equivalence<Frac> Hex@Codec<Text,Frac>] ) (context: "Can convert frac values to/from their bit patterns." diff --git a/stdlib/test/test/lux/data/sum.lux b/stdlib/test/test/lux/data/sum.lux index de33a9f64..47e68e220 100644 --- a/stdlib/test/test/lux/data/sum.lux +++ b/stdlib/test/test/lux/data/sum.lux @@ -10,7 +10,7 @@ lux/test) (context: "Sum operations" - (let [(^open "List/") (list.Eq<List> text.Eq<Text>)] + (let [(^open "List/") (list.Equivalence<List> text.Equivalence<Text>)] ($_ seq (test "Can inject values into Either." (and (|> (left "Hello") (case> (+0 "Hello") true _ false)) diff --git a/stdlib/test/test/lux/data/text.lux b/stdlib/test/test/lux/data/text.lux index 99c750f74..23d6f8d9b 100644 --- a/stdlib/test/test/lux/data/text.lux +++ b/stdlib/test/test/lux/data/text.lux @@ -64,7 +64,7 @@ fake-sample (&.join-with " " (list sampleL sampleR)) dup-sample (&.join-with "" (list sampleL sampleR)) enclosed-sample (&.enclose [sampleR sampleR] sampleL) - (^open) &.Eq<Text>]] + (^open) &.Equivalence<Text>]] (test "" (and (not (= sample fake-sample)) (= sample dup-sample) (&.starts-with? sampleL sample) @@ -112,7 +112,7 @@ parts (r.list sizeL part-gen) #let [sample1 (&.concat (list.interpose sep1 parts)) sample2 (&.concat (list.interpose sep2 parts)) - (^open "&/") &.Eq<Text>]] + (^open "&/") &.Equivalence<Text>]] ($_ seq (test "Can split text through a separator." (n/= (list.size parts) diff --git a/stdlib/test/test/lux/data/text/format.lux b/stdlib/test/test/lux/data/text/format.lux index ccffe2fcf..2ce811b33 100644 --- a/stdlib/test/test/lux/data/text/format.lux +++ b/stdlib/test/test/lux/data/text/format.lux @@ -8,7 +8,7 @@ lux/test) (context: "Formatters" - (let [(^open "&/") text.Eq<Text>] + (let [(^open "&/") text.Equivalence<Text>] ($_ seq (test "Can format common values simply." (and (&/= "true" (%b true)) diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index 58e142a98..d1d05074f 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -5,7 +5,7 @@ ["p" parser]) [io] (data ["E" error] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format ["&" text/lexer] (coll [list])) @@ -30,7 +30,7 @@ (def: (should-passL test input) (-> (List Text) (E.Error (List Text)) Bool) - (let [(^open "list/") (list.Eq<List> text.Eq<Text>)] + (let [(^open "list/") (list.Equivalence<List> text.Equivalence<Text>)] (case input (#.Right output) (list/= test output) diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 7bc3082a1..cab2b168b 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -5,7 +5,7 @@ pipe ["p" parser]) (data [product] - [text "T/" Eq<Text>] + [text "T/" Equivalence<Text>] text/format (text [lexer] ["&" regex])) diff --git a/stdlib/test/test/lux/host.jvm.lux b/stdlib/test/test/lux/host.jvm.lux index cfd6bad5e..c9c59e8d2 100644 --- a/stdlib/test/test/lux/host.jvm.lux +++ b/stdlib/test/test/lux/host.jvm.lux @@ -6,7 +6,7 @@ (data text/format [number] [product] - [text "text/" Eq<Text>]) + [text "text/" Equivalence<Text>]) ["&" host #+ class: interface: object] ["r" math/random]) lux/test) diff --git a/stdlib/test/test/lux/io.lux b/stdlib/test/test/lux/io.lux index faddcf42d..768bc3166 100644 --- a/stdlib/test/test/lux/io.lux +++ b/stdlib/test/test/lux/io.lux @@ -2,7 +2,7 @@ lux (lux ["&" io] (control ["M" monad #+ do Monad]) - (data [text "Text/" Monoid<Text> Eq<Text>] + (data [text "Text/" Monoid<Text> Equivalence<Text>] text/format [number])) lux/test) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/case.lux b/stdlib/test/test/lux/lang/compiler/analysis/case.lux index cbf11b164..21fa2b9f9 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/case.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/case.lux @@ -3,18 +3,18 @@ (lux [io] (control [monad #+ do] pipe) - (data [bool "B/" Eq<Bool>] + (data [bool "B/" Equivalence<Bool>] ["R" error] [product] [maybe] - [text "T/" Eq<Text>] + [text "T/" Equivalence<Text>] text/format (coll [list "list/" Monad<List>] (set ["set" unordered]))) ["r" math/random "r/" Monad<Random>] [macro #+ Monad<Meta>] (macro [code]) - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] (type ["tc" check]) [".L" module] (compiler [analysis] diff --git a/stdlib/test/test/lux/lang/compiler/analysis/function.lux b/stdlib/test/test/lux/lang/compiler/analysis/function.lux index 3fab96a92..b8c5d23b6 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/function.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/function.lux @@ -6,14 +6,14 @@ (data ["e" error] [maybe] [product] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format (coll [list "list/" Functor<List>])) ["r" math/random "r/" Monad<Random>] [macro] (macro [code]) [lang] - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] [".L" reference] (compiler [".L" init] [".L" analysis #+ Analysis] diff --git a/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux b/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux index 6f4cd1afc..cf98a71ff 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/primitive.lux @@ -10,7 +10,7 @@ [macro] (macro [code]) [lang] - (lang [".L" type "type/" Eq<Type>] + (lang [".L" type "type/" Equivalence<Type>] (compiler [".L" init] [analysis #+ Analysis] (analysis [".A" type] diff --git a/stdlib/test/test/lux/lang/compiler/analysis/procedure/common.lux b/stdlib/test/test/lux/lang/compiler/analysis/procedure/common.lux index 581ce90b8..fc1a209d9 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/procedure/common.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/procedure/common.lux @@ -12,17 +12,17 @@ [macro #+ Monad<Meta>] (macro [code]) [lang] - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] [".L" scope] - [".L" init] - (analysis [".A" type])) + (compiler [".L" init] + (analysis [".A" type]))) test) (/// ["_." primitive])) (do-template [<name> <success> <failure>] [(def: (<name> procedure params output-type) (-> Text (List Code) Type Bool) - (|> (lang.with-scope + (|> (scopeL.with-scope "" (typeA.with-type output-type (_primitive.analyse (` ((~ (code.text procedure)) (~+ params)))))) (macro.run (initL.compiler [])) @@ -90,7 +90,7 @@ (check-success+ "lux int /" (list subjectC paramC) Int)) (test "Can calculate remainder of integers." (check-success+ "lux int %" (list subjectC paramC) Int)) - (test "Can test equality of integers." + (test "Can test equivalence of integers." (check-success+ "lux int =" (list subjectC paramC) Bool)) (test "Can compare integers." (check-success+ "lux int <" (list subjectC paramC) Bool)) @@ -123,7 +123,7 @@ (check-success+ "lux frac /" (list subjectC paramC) Frac)) (test "Can calculate remainder of frac numbers." (check-success+ "lux frac %" (list subjectC paramC) Frac)) - (test "Can test equality of frac numbers." + (test "Can test equivalence of frac numbers." (check-success+ "lux frac =" (list subjectC paramC) Bool)) (test "Can compare frac numbers." (check-success+ "lux frac <" (list subjectC paramC) Bool)) @@ -150,7 +150,7 @@ fromC (|> r.nat (:: @ map code.nat)) toC (|> r.nat (:: @ map code.nat))] ($_ seq - (test "Can test text equality." + (test "Can test text equivalence." (check-success+ "lux text =" (list subjectC paramC) Bool)) (test "Compare texts in lexicographical order." (check-success+ "lux text <" (list subjectC paramC) Bool)) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/procedure/host.jvm.lux b/stdlib/test/test/lux/lang/compiler/analysis/procedure/host.jvm.lux index 0a60149d5..af4741918 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/procedure/host.jvm.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/procedure/host.jvm.lux @@ -7,7 +7,7 @@ (data ["e" error] [product] [maybe] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format (coll [array] [list "list/" Fold<List>] @@ -17,9 +17,9 @@ (macro [code]) [lang] (lang [type] - [".L" init] - (analysis [".A" type]) - (extension (analysis [".AE" host]))) + (compiler [".L" init] + (analysis [".A" type]) + (extension (analysis [".AE" host])))) test) (/// ["_." primitive])) diff --git a/stdlib/test/test/lux/lang/compiler/analysis/reference.lux b/stdlib/test/test/lux/lang/compiler/analysis/reference.lux index c6fbf5da0..d1874bfee 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/reference.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/reference.lux @@ -4,13 +4,13 @@ (control [monad #+ do] pipe) (data ["e" error] - [ident "ident/" Eq<Ident>] - [text "text/" Eq<Text>]) + [ident "ident/" Equivalence<Ident>] + [text "text/" Equivalence<Text>]) ["r" math/random] [macro #+ Monad<Meta>] (macro [code]) [lang] - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] [".L" scope] [".L" module] [".L" reference] diff --git a/stdlib/test/test/lux/lang/compiler/analysis/structure.lux b/stdlib/test/test/lux/lang/compiler/analysis/structure.lux index 2342e0e5a..d9d029d31 100644 --- a/stdlib/test/test/lux/lang/compiler/analysis/structure.lux +++ b/stdlib/test/test/lux/lang/compiler/analysis/structure.lux @@ -3,7 +3,7 @@ (lux [io] (control [monad #+ do] pipe) - (data [bool "bool/" Eq<Bool>] + (data [bool "bool/" Equivalence<Bool>] ["e" error] [product] [maybe] @@ -15,7 +15,7 @@ [macro] (macro [code]) [lang] - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] (type ["tc" check]) [".L" module] (compiler [".L" init] diff --git a/stdlib/test/test/lux/lang/compiler/synthesis/function.lux b/stdlib/test/test/lux/lang/compiler/synthesis/function.lux index c7b16de27..92e5dcc72 100644 --- a/stdlib/test/test/lux/lang/compiler/synthesis/function.lux +++ b/stdlib/test/test/lux/lang/compiler/synthesis/function.lux @@ -11,7 +11,7 @@ (coll [list "list/" Functor<List> Fold<List>] (dictionary ["dict" unordered #+ Dict]) (set ["set" unordered]))) - (lang ["///." reference #+ Variable "variable/" Equality<Variable>] + (lang ["///." reference #+ Variable "variable/" Equivalence<Variable>] ["///." compiler] [".L" analysis #+ Arity Analysis] ["//" synthesis #+ Synthesis] diff --git a/stdlib/test/test/lux/lang/compiler/synthesis/structure.lux b/stdlib/test/test/lux/lang/compiler/synthesis/structure.lux index e61386044..eb970d3a3 100644 --- a/stdlib/test/test/lux/lang/compiler/synthesis/structure.lux +++ b/stdlib/test/test/lux/lang/compiler/synthesis/structure.lux @@ -3,7 +3,7 @@ (lux [io] (control [monad #+ do] pipe) - (data [bool "bool/" Eq<Bool>] + (data [bool "bool/" Equivalence<Bool>] [product] [error] (coll [list])) diff --git a/stdlib/test/test/lux/lang/syntax.lux b/stdlib/test/test/lux/lang/syntax.lux index 0ea9c5b9c..929ecaca0 100644 --- a/stdlib/test/test/lux/lang/syntax.lux +++ b/stdlib/test/test/lux/lang/syntax.lux @@ -88,7 +88,7 @@ false (#e.Success [_ parsed]) - (:: code.Eq<Code> = parsed sample))) + (:: code.Equivalence<Code> = parsed sample))) (test "Can parse Lux multiple code nodes." (case (&.read "" (dict.new text.Hash<Text>) [default-cursor +0 (format (code.to-text sample) " " @@ -103,8 +103,8 @@ false (#e.Success [_ =other]) - (and (:: code.Eq<Code> = sample =sample) - (:: code.Eq<Code> = other =other))))) + (and (:: code.Equivalence<Code> = sample =sample) + (:: code.Equivalence<Code> = other =other))))) )))) (context: "Frac special syntax." @@ -208,7 +208,7 @@ false (#e.Success [_ parsed]) - (:: code.Eq<Code> = + (:: code.Equivalence<Code> = parsed (code.text good-output))))) (test "Can handle comments." @@ -219,7 +219,7 @@ false (#e.Success [_ parsed]) - (:: code.Eq<Code> = parsed sample))) + (:: code.Equivalence<Code> = parsed sample))) (test "Will reject unbalanced multi-line comments." (and (case (&.read "" (dict.new text.Hash<Text>) [default-cursor +0 diff --git a/stdlib/test/test/lux/lang/type.lux b/stdlib/test/test/lux/lang/type.lux index 22cd568ee..26f59f7b1 100644 --- a/stdlib/test/test/lux/lang/type.lux +++ b/stdlib/test/test/lux/lang/type.lux @@ -47,7 +47,7 @@ (do @ [sample gen-type] (test "Every type is equal to itself." - (:: &.Eq<Type> = sample sample))))) + (:: &.Equivalence<Type> = sample sample))))) (context: "Type application" (test "Can apply quantified types (universal and existential quantification)." @@ -55,7 +55,7 @@ (do maybe.Monad<Maybe> [partial (&.apply (list Bool) Ann) full (&.apply (list Int) partial)] - (wrap (:: &.Eq<Type> = full (#.Product Bool Int))))) + (wrap (:: &.Equivalence<Type> = full (#.Product Bool Int))))) (|> (&.apply (list Bool) Text) (case> #.None true _ false))))) @@ -66,15 +66,15 @@ base))] ($_ seq (test "Can remove aliases from an already-named type." - (:: &.Eq<Type> = + (:: &.Equivalence<Type> = base (&.un-alias aliased))) (test "Can remove all names from a type." - (and (not (:: &.Eq<Type> = + (and (not (:: &.Equivalence<Type> = base (&.un-name aliased))) - (:: &.Eq<Type> = + (:: &.Equivalence<Type> = (&.un-name base) (&.un-name aliased))))))) @@ -92,8 +92,8 @@ true))) (list.repeat size) (M.seq @)) - #let [(^open "&/") &.Eq<Type> - (^open "L/") (list.Eq<List> &.Eq<Type>)]] + #let [(^open "&/") &.Equivalence<Type> + (^open "L/") (list.Equivalence<List> &.Equivalence<Type>)]] (with-expansions [<struct-tests> (do-template [<desc> <ctor> <dtor> <unit>] [(test (format "Can build and tear-down " <desc> " types.") @@ -122,8 +122,8 @@ _ true)))) - #let [(^open "&/") &.Eq<Type> - (^open "L/") (list.Eq<List> &.Eq<Type>)]] + #let [(^open "&/") &.Equivalence<Type> + (^open "L/") (list.Equivalence<List> &.Equivalence<Type>)]] ($_ seq (test "Can build and tear-down function types." (let [[inputs output] (|> (&.function members extra) &.flatten-function)] @@ -147,7 +147,7 @@ _ true)))) - #let [(^open "&/") &.Eq<Type>]] + #let [(^open "&/") &.Equivalence<Type>]] (with-expansions [<quant-tests> (do-template [<desc> <ctor> <dtor>] [(test (format "Can build and tear-down " <desc> " types.") diff --git a/stdlib/test/test/lux/lang/type/check.lux b/stdlib/test/test/lux/lang/type/check.lux index 57285c91c..2ffee1318 100644 --- a/stdlib/test/test/lux/lang/type/check.lux +++ b/stdlib/test/test/lux/lang/type/check.lux @@ -6,12 +6,12 @@ (data [product] [maybe] [number] - [text "text/" Monoid<Text> Eq<Text>] + [text "text/" Monoid<Text> Equivalence<Text>] text/format (coll [list "list/" Functor<List>] (set ["set" unordered]))) ["r" math/random] - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] ["@" type/check])) lux/test) @@ -215,11 +215,11 @@ headR (@.ring head-id) tailR (@.ring tail-id)] (@.assert "" - (let [same-rings? (:: set.Eq<Set> = headR tailR) + (let [same-rings? (:: set.Equivalence<Set> = headR tailR) expected-size? (n/= (inc num-connections) (set.size headR)) same-vars? (|> (set.to-list headR) (list.sort n/<) - (:: (list.Eq<List> number.Eq<Nat>) = (list.sort n/< (#.Cons head-id ids))))] + (:: (list.Equivalence<List> number.Equivalence<Nat>) = (list.sort n/< (#.Cons head-id ids))))] (and same-rings? expected-size? same-vars?)))))) @@ -251,10 +251,10 @@ headRL-post (@.ring head-idL) headRR-post (@.ring head-idR)] (@.assert "" - (let [same-rings? (:: set.Eq<Set> = headRL-post headRR-post) + (let [same-rings? (:: set.Equivalence<Set> = headRL-post headRR-post) expected-size? (n/= (n/* +2 (inc num-connections)) (set.size headRL-post)) - union? (:: set.Eq<Set> = headRL-post (set.union headRL-pre headRR-pre))] + union? (:: set.Equivalence<Set> = headRL-post (set.union headRL-pre headRR-pre))] (and same-rings? expected-size? union?)))))) diff --git a/stdlib/test/test/lux/macro/code.lux b/stdlib/test/test/lux/macro/code.lux index 08160c7e2..300adc53c 100644 --- a/stdlib/test/test/lux/macro/code.lux +++ b/stdlib/test/test/lux/macro/code.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad]) - (data [text "T/" Eq<Text>] + (data [text "T/" Equivalence<Text>] text/format [number]) ["r" math/random] @@ -14,7 +14,7 @@ [<tests> (do-template [<expr> <text>] [(test (format "Can produce Code node: " <text>) (and (T/= <text> (&.to-text <expr>)) - (:: &.Eq<Code> = <expr> <expr>)))] + (:: &.Equivalence<Code> = <expr> <expr>)))] [(&.bool true) "true"] [(&.bool false) "false"] diff --git a/stdlib/test/test/lux/macro/poly/equality.lux b/stdlib/test/test/lux/macro/poly/equivalence.lux index 832c72355..f37ad04b5 100644 --- a/stdlib/test/test/lux/macro/poly/equality.lux +++ b/stdlib/test/test/lux/macro/poly/equivalence.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad] - [equality #+ Eq]) + [equivalence #+ Equivalence]) (data text/format [bool] [number "int/" Number<Int>] @@ -12,7 +12,7 @@ ["r" math/random] [macro] (macro [poly #+ derived:] - ["&" poly/equality])) + ["&" poly/equivalence])) lux/test) ## [Utils] @@ -58,13 +58,13 @@ ($_ r.seq gen-int r.frac (r.unicode size)) gen-recursive))) -(derived: (&.Eq<?> Record)) +(derived: (&.Equivalence<?> Record)) ## [Tests] -(context: "Eq polytypism" +(context: "Equivalence polytypism" (<| (times +100) (do @ [sample gen-record - #let [(^open "&/") Eq<Record>]] + #let [(^open "&/") Equivalence<Record>]] (test "Every instance equals itself." (&/= sample sample))))) diff --git a/stdlib/test/test/lux/macro/poly/functor.lux b/stdlib/test/test/lux/macro/poly/functor.lux index 86c3eca7f..9db2ea282 100644 --- a/stdlib/test/test/lux/macro/poly/functor.lux +++ b/stdlib/test/test/lux/macro/poly/functor.lux @@ -1,17 +1,7 @@ (.module: lux - (lux [io] - (control [monad #+ do Monad] - [functor] - [equality #+ Eq] - [state]) - (data text/format - [bool] - [number] - [text] - [identity]) - ["r" math/random] - [macro] + (lux (control [state]) + (data [identity]) (macro [poly #+ derived:] ["&" poly/functor])) lux/test) @@ -27,4 +17,5 @@ ## [Tests] (context: "Functor polytypism." - (test "" true)) + (test "Can derive functors automatically." + true)) diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index 342845337..3b9815064 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Equivalence] ["p" parser]) (data [text "Text/" Monoid<Text>] text/format @@ -35,11 +35,11 @@ _ false)) -(def: (equals? Eq<a> reference parser input) - (All [a] (-> (Eq a) a (Syntax a) (List Code) Bool)) +(def: (equals? Equivalence<a> reference parser input) + (All [a] (-> (Equivalence a) a (Syntax a) (List Code) Bool)) (case (p.run input parser) (#.Right [_ output]) - (:: Eq<a> = reference output) + (:: Equivalence<a> = reference output) _ false)) @@ -64,20 +64,20 @@ ## [Tests] (context: "Simple value syntax." (with-expansions - [<simple-tests> (do-template [<assertion> <value> <ctor> <Eq> <get>] + [<simple-tests> (do-template [<assertion> <value> <ctor> <Equivalence> <get>] [(test <assertion> - (and (equals? <Eq> <value> <get> (list (<ctor> <value>))) + (and (equals? <Equivalence> <value> <get> (list (<ctor> <value>))) (found? (s.this? (<ctor> <value>)) (list (<ctor> <value>))) (enforced? (s.this (<ctor> <value>)) (list (<ctor> <value>)))))] - ["Can parse Bool syntax." true code.bool bool.Eq<Bool> s.bool] - ["Can parse Nat syntax." +123 code.nat number.Eq<Nat> s.nat] - ["Can parse Int syntax." 123 code.int number.Eq<Int> s.int] - ["Can parse Rev syntax." .123 code.rev number.Eq<Rev> s.rev] - ["Can parse Frac syntax." 123.0 code.frac number.Eq<Frac> s.frac] - ["Can parse Text syntax." "\n" code.text text.Eq<Text> s.text] - ["Can parse Symbol syntax." ["yolo" "lol"] code.symbol ident.Eq<Ident> s.symbol] - ["Can parse Tag syntax." ["yolo" "lol"] code.tag ident.Eq<Ident> s.tag] + ["Can parse Bool syntax." true code.bool bool.Equivalence<Bool> s.bool] + ["Can parse Nat syntax." +123 code.nat number.Equivalence<Nat> s.nat] + ["Can parse Int syntax." 123 code.int number.Equivalence<Int> s.int] + ["Can parse Rev syntax." .123 code.rev number.Equivalence<Rev> s.rev] + ["Can parse Frac syntax." 123.0 code.frac number.Equivalence<Frac> s.frac] + ["Can parse Text syntax." "\n" code.text text.Equivalence<Text> s.text] + ["Can parse Symbol syntax." ["yolo" "lol"] code.symbol ident.Equivalence<Ident> s.symbol] + ["Can parse Tag syntax." ["yolo" "lol"] code.tag ident.Equivalence<Ident> s.tag] )] ($_ seq <simple-tests> diff --git a/stdlib/test/test/lux/math.lux b/stdlib/test/test/lux/math.lux index 80ca6995c..4e7e29a1e 100644 --- a/stdlib/test/test/lux/math.lux +++ b/stdlib/test/test/lux/math.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [monad #+ do Monad]) - (data [bool "bool/" Eq<Bool>] + (data [bool "bool/" Equivalence<Bool>] [number "frac/" Number<Frac>]) ["r" math/random] ["&" math]) diff --git a/stdlib/test/test/lux/math/logic/fuzzy.lux b/stdlib/test/test/lux/math/logic/fuzzy.lux index c5c70c5a0..3fa7c66cc 100644 --- a/stdlib/test/test/lux/math/logic/fuzzy.lux +++ b/stdlib/test/test/lux/math/logic/fuzzy.lux @@ -4,7 +4,7 @@ (control [monad #+ do Monad]) (data (coll [list] (set ["set" unordered])) - [bool "B/" Eq<Bool>] + [bool "B/" Equivalence<Bool>] [number] text/format) ["r" math/random] diff --git a/stdlib/test/test/lux/math/modular.lux b/stdlib/test/test/lux/math/modular.lux index 7bb684695..7102e684d 100644 --- a/stdlib/test/test/lux/math/modular.lux +++ b/stdlib/test/test/lux/math/modular.lux @@ -2,12 +2,12 @@ lux (lux (control [monad #+ do]) (data [product] - [bool "bool/" Eq<Bool>] + [bool "bool/" Equivalence<Bool>] ["e" error] text/format) (math ["r" random] ["/" modular]) - (lang [type "type/" Eq<Type>])) + (lang [type "type/" Equivalence<Type>])) lux/test) (def: %3 (/.modulus 3)) diff --git a/stdlib/test/test/lux/math/random.lux b/stdlib/test/test/lux/math/random.lux index b2f4fe6ca..2096edcfe 100644 --- a/stdlib/test/test/lux/math/random.lux +++ b/stdlib/test/test/lux/math/random.lux @@ -49,7 +49,7 @@ (test "Can filter values." (n/<= top filtered)) (test "Can shuffle rows." - (let [(^open "v/") (row.Eq<Row> number.Eq<Nat>) + (let [(^open "v/") (row.Equivalence<Row> number.Equivalence<Nat>) sorted (row.from-list sorted)] (and (not (v/= sorted shuffled)) (v/= sorted (row.from-list re-sorted))))) diff --git a/stdlib/test/test/lux/time/date.lux b/stdlib/test/test/lux/time/date.lux index 8dba5517a..dbd925fda 100644 --- a/stdlib/test/test/lux/time/date.lux +++ b/stdlib/test/test/lux/time/date.lux @@ -25,11 +25,11 @@ (r.either (r/wrap #@.November) (r/wrap #@.December)))))) -(context: "(Month) Eq." +(context: "(Month) Equivalence." (<| (times +100) (do @ [sample month - #let [(^open "@/") @.Eq<Month>]] + #let [(^open "@/") @.Equivalence<Month>]] (test "Every value equals itself." (@/= sample sample))))) @@ -68,11 +68,11 @@ (r/wrap #@.Friday)) (r/wrap #@.Saturday)))) -(context: "(Day) Eq." +(context: "(Day) Equivalence." (<| (times +100) (do @ [sample day - #let [(^open "@/") @.Eq<Day>]] + #let [(^open "@/") @.Equivalence<Day>]] (test "Every value equals itself." (@/= sample sample))))) @@ -105,11 +105,11 @@ (r.Random @.Date) (|> _instant.instant (:: r.Monad<Random> map @instant.date))) -(context: "(Date) Eq." +(context: "(Date) Equivalence." (<| (times +100) (do @ [sample date - #let [(^open "@/") @.Eq<Date>]] + #let [(^open "@/") @.Equivalence<Date>]] (test "Every value equals itself." (@/= sample sample))))) @@ -130,7 +130,7 @@ ## (times +100) (do @ [sample date - #let [(^open "@/") @.Eq<Date> + #let [(^open "@/") @.Equivalence<Date> (^open "@/") @.Codec<Text,Date>]] (test "Can encode/decode dates." (|> sample diff --git a/stdlib/test/test/lux/time/duration.lux b/stdlib/test/test/lux/time/duration.lux index 3529852a0..6437a45a3 100644 --- a/stdlib/test/test/lux/time/duration.lux +++ b/stdlib/test/test/lux/time/duration.lux @@ -18,15 +18,15 @@ (test "Can convert from/to milliseconds." (|> millis @.from-millis @.to-millis (i/= millis)))))) -(context: "Equality" +(context: "Equivalence." (<| (times +100) (do @ [sample duration - #let [(^open "@/") @.Eq<Duration>]] + #let [(^open "@/") @.Equivalence<Duration>]] (test "Every duration equals itself." (@/= sample sample))))) -(context: "Order" +(context: "Order." (<| (times +100) (do @ [reference duration @@ -73,7 +73,7 @@ (<| (times +100) (do @ [sample duration - #let [(^open "@/") @.Eq<Duration> + #let [(^open "@/") @.Equivalence<Duration> (^open "@/") @.Codec<Text,Duration>]] (test "Can encode/decode durations." (E.default false diff --git a/stdlib/test/test/lux/time/instant.lux b/stdlib/test/test/lux/time/instant.lux index ee328ea3d..cff332527 100644 --- a/stdlib/test/test/lux/time/instant.lux +++ b/stdlib/test/test/lux/time/instant.lux @@ -27,11 +27,11 @@ (test "Can convert from/to milliseconds." (|> millis @.from-millis @.to-millis (i/= millis)))))) -(context: "Equality" +(context: "Equivalence." (<| (times +100) (do @ [sample instant - #let [(^open "@/") @.Eq<Instant>]] + #let [(^open "@/") @.Equivalence<Instant>]] (test "Every instant equals itself." (@/= sample sample))))) @@ -65,8 +65,8 @@ (do @ [sample instant span _duration.duration - #let [(^open "@/") @.Eq<Instant> - (^open "@d/") @d.Eq<Duration>]] + #let [(^open "@/") @.Equivalence<Instant> + (^open "@d/") @d.Equivalence<Duration>]] ($_ seq (test "The span of a instant and itself has an empty duration." (|> sample (@.span sample) (@d/= @d.empty))) @@ -82,7 +82,7 @@ ## ## (times +100) ## (do @ ## [sample instant -## #let [(^open "@/") @.Eq<Instant> +## #let [(^open "@/") @.Equivalence<Instant> ## (^open "@/") @.Codec<Text,Instant>]] ## (test "Can encode/decode instants." ## (|> sample diff --git a/stdlib/test/test/lux/type/implicit.lux b/stdlib/test/test/lux/type/implicit.lux index a5af06c5d..33c0bd6c5 100644 --- a/stdlib/test/test/lux/type/implicit.lux +++ b/stdlib/test/test/lux/type/implicit.lux @@ -1,11 +1,9 @@ (.module: lux (lux [io] - (control [monad #+ do Monad] - functor - [equality]) + (control [monad #+ do Monad]) (data [number] - [bool "bool/" Eq<Bool>] + [bool "bool/" Equivalence<Bool>] (coll [list])) ["r" math/random] (type implicit)) @@ -18,8 +16,8 @@ y r.nat] ($_ seq (test "Can automatically select first-order structures." - (let [(^open "list/") (list.Eq<List> number.Eq<Nat>)] - (and (bool/= (:: number.Eq<Nat> = x y) + (let [(^open "list/") (list.Equivalence<List> number.Equivalence<Nat>)] + (and (bool/= (:: number.Equivalence<Nat> = x y) (::: = x y)) (list/= (list.n/range +1 +10) (::: map inc (list.n/range +0 +9))) diff --git a/stdlib/test/test/lux/world/blob.lux b/stdlib/test/test/lux/world/blob.lux index a74fb20e0..8e69e4176 100644 --- a/stdlib/test/test/lux/world/blob.lux +++ b/stdlib/test/test/lux/world/blob.lux @@ -10,7 +10,7 @@ (world ["/" blob]) ["r" math/random]) lux/test - (test (lux (control ["_eq" equality])))) + (test (lux (control ["_eq" equivalence])))) (def: (succeed result) (-> (e.Error Bool) Bool) @@ -55,7 +55,7 @@ #let [[from to] [(n/min from to) (n/max from to)]]] ($_ seq ## TODO: De-comment... - ## (_eq.spec /.Eq<Blob> (:: @ map blob gen-size)) + ## (_eq.spec /.Equivalence<Blob> (:: @ map blob gen-size)) (test "Can get size of blob." (|> random-blob /.size (n/= blob-size))) (test "Can read/write 8-bit values." @@ -75,7 +75,7 @@ (case [(monad.map e.Monad<Error> (reader random-slice) idxs) (monad.map e.Monad<Error> (|>> (n/+ from) (reader random-blob)) idxs)] [(#e.Success slice-vals) (#e.Success blob-vals)] - (:: (list.Eq<List> number.Eq<Nat>) = slice-vals blob-vals) + (:: (list.Equivalence<List> number.Equivalence<Nat>) = slice-vals blob-vals) _ false)))) diff --git a/stdlib/test/test/lux/world/file.lux b/stdlib/test/test/lux/world/file.lux index 6d32a994b..75f08e97c 100644 --- a/stdlib/test/test/lux/world/file.lux +++ b/stdlib/test/test/lux/world/file.lux @@ -50,7 +50,7 @@ [_ (@.write dataL file) output (@.read file) _ (@.delete file)] - (wrap (:: blob.Eq<Blob> = dataL output))))] + (wrap (:: blob.Equivalence<Blob> = dataL output))))] (assert "Can write/read files." (e.default false result)))) (wrap (do P.Monad<Promise> @@ -73,8 +73,8 @@ read-size (@.size file) _ (@.delete file)] (wrap (and (n/= (n/* +2 file-size) read-size) - (:: blob.Eq<Blob> = dataL (e.assume (blob.slice +0 (dec file-size) output))) - (:: blob.Eq<Blob> = dataR (e.assume (blob.slice file-size (dec read-size) output)))))))] + (:: blob.Equivalence<Blob> = dataL (e.assume (blob.slice +0 (dec file-size) output))) + (:: blob.Equivalence<Blob> = dataR (e.assume (blob.slice file-size (dec read-size) output)))))))] (assert "Can append to files." (e.default false result)))) (wrap (do P.Monad<Promise> @@ -151,7 +151,7 @@ time-read (@.last-modified file) _ (@.delete file)] (wrap (and was-modified? - (:: i.Eq<Instant> = last-modified time-read)))))] + (:: i.Equivalence<Instant> = last-modified time-read)))))] (assert "Can change the time of last modification." (e.default false result)))) (wrap (do P.Monad<Promise> diff --git a/stdlib/test/test/lux/world/net/tcp.lux b/stdlib/test/test/lux/world/net/tcp.lux index 892f6ddc4..e49a06a1e 100644 --- a/stdlib/test/test/lux/world/net/tcp.lux +++ b/stdlib/test/test/lux/world/net/tcp.lux @@ -42,7 +42,7 @@ (do @ [bytes-from (@.read temp-from +0 size socket) #let [_ (io.run (P.resolve (#E.Success (and (n/= size bytes-from) - (:: blob.Eq<Blob> = from temp-from))) + (:: blob.Equivalence<Blob> = from temp-from))) from-worked?))]] (@.write to +0 size socket))) server)] @@ -53,7 +53,7 @@ #################### bytes-to (@.read temp-to +0 size client) #let [to-worked? (and (n/= size bytes-to) - (:: blob.Eq<Blob> = to temp-to))] + (:: blob.Equivalence<Blob> = to temp-to))] #################### _ (@.close client) _ (T.from-promise (P.future (P.resolve [] server-close)))] diff --git a/stdlib/test/test/lux/world/net/udp.lux b/stdlib/test/test/lux/world/net/udp.lux index 4cb268a4f..6a51e0bf4 100644 --- a/stdlib/test/test/lux/world/net/udp.lux +++ b/stdlib/test/test/lux/world/net/udp.lux @@ -40,12 +40,12 @@ _ (@.write localhost port from +0 size client) [bytes-from from-address from-port] (@.read temp +0 size server) #let [from-worked? (and (n/= size bytes-from) - (:: blob.Eq<Blob> = from temp))] + (:: blob.Equivalence<Blob> = from temp))] #################### _ (@.write from-address from-port to +0 size server) [bytes-to to-address to-port] (@.read temp +0 size client) #let [to-worked? (and (n/= size bytes-to) - (:: blob.Eq<Blob> = to temp) + (:: blob.Equivalence<Blob> = to temp) (n/= port to-port))] #################### _ (@.close client) |