diff options
Diffstat (limited to 'stdlib/source')
55 files changed, 266 insertions, 266 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index d2d39783a..5a484598e 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -2206,7 +2206,7 @@ (def:''' #export (n/= test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Nat(ural) equality.")]) + (text$ "Nat(ural) equivalence.")]) (-> Nat Nat Bool) ("lux i64 =" test subject)) @@ -2296,7 +2296,7 @@ (def:''' #export (r/= test subject) (list [(tag$ ["lux" "doc"]) - (text$ "Rev(olution) equality.")]) + (text$ "Rev(olution) equivalence.")]) (-> Rev Rev Bool) ("lux i64 =" test subject)) @@ -2368,10 +2368,10 @@ (<eq-proc> subject test)))] [ Int "lux i64 =" "lux int <" i/= i/< i/<= i/> i/>= - "Int(eger) equality." "Int(eger) less-than." "Int(eger) less-than-equal." "Int(eger) greater-than." "Int(eger) greater-than-equal."] + "Int(eger) equivalence." "Int(eger) less-than." "Int(eger) less-than-equal." "Int(eger) greater-than." "Int(eger) greater-than-equal."] [Frac "lux frac =" "lux frac <" f/= f/< f/<= f/> f/>= - "Frac(tion) equality." "Frac(tion) less-than." "Frac(tion) less-than-equal." "Frac(tion) greater-than." "Frac(tion) greater-than-equal."] + "Frac(tion) equivalence." "Frac(tion) less-than." "Frac(tion) less-than-equal." "Frac(tion) greater-than." "Frac(tion) greater-than-equal."] ) (def:''' #export (n// param subject) @@ -3492,7 +3492,7 @@ (macro: #export (sig: tokens) {#.doc "## Definition of signatures ala ML. (sig: #export (Ord a) - (: (Eq a) + (: (Equivalence a) eq) (: (-> a a Bool) <) @@ -3901,7 +3901,7 @@ (macro: #export (struct: tokens) {#.doc "## Definition of structures ala ML. (struct: #export Ord<Int> (Ord Int) - (def: eq Eq<Int>) + (def: eq Equivalence<Int>) (def: (< test subject) (lux.< test subject)) (def: (<= test subject) @@ -4971,7 +4971,7 @@ (ident #open (\"ident/\" Codec<Text,Ident>))) meta (macro code)) - (// (type #open (\"\" Eq<Type>)))) + (// (type #open (\"\" Equivalence<Type>)))) (.module: {#.doc \"Some documentation...\"} lux @@ -4982,7 +4982,7 @@ [ident \"ident/\" Codec<Text,Ident>]) meta (macro code)) - (// [type \"\" Eq<Type>]))"} + (// [type \"\" Equivalence<Type>]))"} (do Monad<Meta> [#let [[_meta _imports] (: [(List [Code Code]) (List Code)] (case tokens @@ -5633,7 +5633,7 @@ [<tests> (do-template [<expr> <text> <pattern>] [(compare <pattern> <expr>) (compare <text> (:: Code/encode show <expr>)) - (compare true (:: Eq<Code> = <expr> <expr>))] + (compare true (:: Equivalence<Code> = <expr> <expr>))] [(bool true) "true" [_ (#.Bool true)]] [(bool false) "false" [_ (#.Bool false)]] @@ -5883,9 +5883,9 @@ {#.doc (doc "Allows you to refer to the type-variables in a polymorphic function's type, by their index." "In the example below, +0 corresponds to the 'a' variable." (def: #export (from-list list) - (All [a] (-> (List a) (Sequence a))) + (All [a] (-> (List a) (Row a))) (list/fold add - (: (Sequence ($ +0)) + (: (Row ($ +0)) empty) list)))} (case tokens diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux index 281dfd9d5..c2e8e2c0f 100644 --- a/stdlib/source/lux/cli.lux +++ b/stdlib/source/lux/cli.lux @@ -3,7 +3,7 @@ (lux (control monad ["p" parser]) (data (coll [list "list/" Monoid<List> Monad<List>]) - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] text/format ["E" error]) [io] diff --git a/stdlib/source/lux/control/equality.lux b/stdlib/source/lux/control/equivalence.lux index f75a78fdd..eabe1165e 100644 --- a/stdlib/source/lux/control/equality.lux +++ b/stdlib/source/lux/control/equivalence.lux @@ -1,18 +1,18 @@ (.module: lux) -(sig: #export (Eq a) - {#.doc "Equality for a type's instances."} +(sig: #export (Equivalence a) + {#.doc "Equivalence for a type's instances."} (: (-> a a Bool) =)) (def: #export (product left right) - (All [l r] (-> (Eq l) (Eq r) (Eq [l r]))) + (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) (struct (def: (= [a b] [x y]) (and (:: left = a x) (:: right = b y))))) (def: #export (sum left right) - (All [l r] (-> (Eq l) (Eq r) (Eq (| l r)))) + (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence (| l r)))) (struct (def: (= a|b x|y) (case [a|b x|y] [(+0 a) (+0 x)] @@ -25,6 +25,6 @@ false)))) (def: #export (rec sub) - (All [a] (-> (-> (Eq a) (Eq a)) (Eq a))) + (All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) (struct (def: (= left right) (sub (rec sub) left right)))) diff --git a/stdlib/source/lux/control/hash.lux b/stdlib/source/lux/control/hash.lux index 6399307bf..76fcd2730 100644 --- a/stdlib/source/lux/control/hash.lux +++ b/stdlib/source/lux/control/hash.lux @@ -1,13 +1,13 @@ (.module: lux - (// [equality #+ Eq])) + (// [equivalence #+ Equivalence])) ## [Signatures] (sig: #export (Hash a) {#.doc "A way to produce hash-codes for a type's instances. A necessity when working with some data-structures, such as dictionaries or sets."} - (: (Eq a) + (: (Equivalence a) eq) (: (-> a Nat) hash)) diff --git a/stdlib/source/lux/control/interval.lux b/stdlib/source/lux/control/interval.lux index 70540622f..92cb9599f 100644 --- a/stdlib/source/lux/control/interval.lux +++ b/stdlib/source/lux/control/interval.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] [order] [enum #+ Enum]))) @@ -133,7 +133,7 @@ [after? >] ) -(struct: #export Eq<Interval> (All [a] (Eq (Interval a))) +(struct: #export Equivalence<Interval> (All [a] (Equivalence (Interval a))) (def: (= reference sample) (let [(^open) reference] (and (= bottom (:: sample bottom)) @@ -163,7 +163,7 @@ (def: #export (overlaps? reference sample) (All [a] (-> (Interval a) (Interval a) Bool)) (let [(^open) reference] - (and (not (:: Eq<Interval> = reference sample)) + (and (not (:: Equivalence<Interval> = reference sample)) (cond (singleton? sample) false diff --git a/stdlib/source/lux/control/order.lux b/stdlib/source/lux/control/order.lux index fd595b1f3..04d0e6a82 100644 --- a/stdlib/source/lux/control/order.lux +++ b/stdlib/source/lux/control/order.lux @@ -1,13 +1,13 @@ (.module: lux (lux function) - (// [equality #+ Eq])) + (// [equivalence #+ Equivalence])) ## [Signatures] (sig: #export (Order a) {#.doc "A signature for types that possess some sense of ordering among their elements."} - (: (Eq a) + (: (Equivalence a) eq) (do-template [<name>] @@ -20,7 +20,7 @@ ## [Values] (def: #export (order eq <) (All [a] - (-> (Eq a) (-> a a Bool) (Order a))) + (-> (Equivalence a) (-> a a Bool) (Order a))) (let [> (flip <)] (struct (def: eq eq) diff --git a/stdlib/source/lux/data/bool.lux b/stdlib/source/lux/data/bool.lux index 21ae0526f..88c1011e5 100644 --- a/stdlib/source/lux/data/bool.lux +++ b/stdlib/source/lux/data/bool.lux @@ -1,20 +1,20 @@ (.module: lux (lux (control [monoid #+ Monoid] - [equality #+ Eq] + [equivalence #+ Equivalence] hash [codec #+ Codec]) function)) ## [Structures] -(struct: #export _ (Eq Bool) +(struct: #export _ (Equivalence Bool) (def: (= x y) (if x y (not y)))) (struct: #export _ (Hash Bool) - (def: eq Eq<Bool>) + (def: eq Equivalence<Bool>) (def: (hash value) (case value true +1 diff --git a/stdlib/source/lux/data/coll/array.lux b/stdlib/source/lux/data/coll/array.lux index 3e649fc7d..8f3bee0c3 100644 --- a/stdlib/source/lux/data/coll/array.lux +++ b/stdlib/source/lux/data/coll/array.lux @@ -2,7 +2,7 @@ lux (lux (control [monoid #+ Monoid] [functor #+ Functor] - [equality #+ Eq] + [equivalence #+ Equivalence] fold) (data (coll [list "list/" Fold<List>]) [product]) @@ -149,8 +149,8 @@ #.None output))))) -(struct: #export (Eq<Array> Eq<a>) - (All [a] (-> (Eq a) (Eq (Array a)))) +(struct: #export (Equivalence<Array> Equivalence<a>) + (All [a] (-> (Equivalence a) (Equivalence (Array a)))) (def: (= xs ys) (let [sxs (size xs) sxy (size ys)] @@ -162,7 +162,7 @@ true [(#.Some x) (#.Some y)] - (:: Eq<a> = x y) + (:: Equivalence<a> = x y) _ false))) diff --git a/stdlib/source/lux/data/coll/bits.lux b/stdlib/source/lux/data/coll/bits.lux index 950aadd0f..94d3398a0 100644 --- a/stdlib/source/lux/data/coll/bits.lux +++ b/stdlib/source/lux/data/coll/bits.lux @@ -1,6 +1,6 @@ (.module: [lux #- not and or] - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] pipe) (data [maybe] [bit] @@ -151,7 +151,7 @@ [xor bit.xor] ) -(struct: #export _ (Eq Bits) +(struct: #export _ (Equivalence Bits) (def: (= reference sample) (let [size (n/max (array.size reference) (array.size sample))] diff --git a/stdlib/source/lux/data/coll/dictionary/ordered.lux b/stdlib/source/lux/data/coll/dictionary/ordered.lux index aec44d943..6fbcb5a42 100644 --- a/stdlib/source/lux/data/coll/dictionary/ordered.lux +++ b/stdlib/source/lux/data/coll/dictionary/ordered.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [monad #+ do Monad] - equality + equivalence [order #+ Order]) (data (coll [list "L/" Monad<List> Monoid<List> Fold<List>]) ["p" product] @@ -551,9 +551,9 @@ [values v (get@ #value node')] ) -(struct: #export (Eq<Dict> Eq<v>) (All [k v] (-> (Eq v) (Eq (Dict k v)))) +(struct: #export (Equivalence<Dict> Equivalence<v>) (All [k v] (-> (Equivalence v) (Equivalence (Dict k v)))) (def: (= reference sample) - (let [Eq<k> (:: sample eq)] + (let [Equivalence<k> (:: sample eq)] (loop [entriesR (entries reference) entriesS (entries sample)] (case [entriesR entriesS] @@ -561,8 +561,8 @@ true [(#.Cons [keyR valueR] entriesR') (#.Cons [keyS valueS] entriesS')] - (and (:: Eq<k> = keyR keyS) - (:: Eq<v> = valueR valueS) + (and (:: Equivalence<k> = keyR keyS) + (:: Equivalence<v> = valueR valueS) (recur entriesR' entriesS')) _ diff --git a/stdlib/source/lux/data/coll/dictionary/plist.lux b/stdlib/source/lux/data/coll/dictionary/plist.lux index e9e08107a..c483a3287 100644 --- a/stdlib/source/lux/data/coll/dictionary/plist.lux +++ b/stdlib/source/lux/data/coll/dictionary/plist.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (data [text "text/" Eq<Text>]))) + (lux (data [text "text/" Equivalence<Text>]))) (type: #export (PList a) (List [Text a])) diff --git a/stdlib/source/lux/data/coll/dictionary/unordered.lux b/stdlib/source/lux/data/coll/dictionary/unordered.lux index 12c58a2fd..bb6d12b24 100644 --- a/stdlib/source/lux/data/coll/dictionary/unordered.lux +++ b/stdlib/source/lux/data/coll/dictionary/unordered.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control hash - [equality #+ Eq]) + [equivalence #+ Equivalence]) (data [maybe] (coll [list "list/" Fold<List> Functor<List> Monoid<List>] [array "array/" Functor<Array> Fold<Array>]) @@ -671,14 +671,14 @@ keys))) ## [Structures] -(struct: #export (Eq<Dict> Eq<v>) (All [k v] (-> (Eq v) (Eq (Dict k v)))) +(struct: #export (Equivalence<Dict> Equivalence<v>) (All [k v] (-> (Equivalence v) (Equivalence (Dict k v)))) (def: (= test subject) (and (n/= (size test) (size subject)) (list.every? (function (_ k) (case [(get k test) (get k subject)] [(#.Some tk) (#.Some sk)] - (:: Eq<v> = tk sk) + (:: Equivalence<v> = tk sk) _ false)) diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index 7f5a71994..4049fce8e 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -4,7 +4,7 @@ [functor #+ Functor] [apply #+ Apply] [monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Equivalence] [fold]) (data [number "nat/" Codec<Text,Nat>] bool @@ -265,15 +265,15 @@ (nth (dec i) xs')))) ## [Structures] -(struct: #export (Eq<List> Eq<a>) - (All [a] (-> (Eq a) (Eq (List a)))) +(struct: #export (Equivalence<List> Equivalence<a>) + (All [a] (-> (Equivalence a) (Equivalence (List a)))) (def: (= xs ys) (case [xs ys] [#.Nil #.Nil] true [(#.Cons x xs') (#.Cons y ys')] - (and (:: Eq<a> = x y) + (and (:: Equivalence<a> = x y) (= xs' ys')) [_ _] @@ -357,7 +357,7 @@ _ false)) (def: #export (member? eq xs x) - (All [a] (-> (Eq a) (List a) a Bool)) + (All [a] (-> (Equivalence a) (List a) a Bool)) (case xs #.Nil false (#.Cons x' xs') (or (:: eq = x x') diff --git a/stdlib/source/lux/data/coll/queue.lux b/stdlib/source/lux/data/coll/queue.lux index 3a39a3e41..490351d29 100644 --- a/stdlib/source/lux/data/coll/queue.lux +++ b/stdlib/source/lux/data/coll/queue.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] ["F" functor]) (data (coll [list "L/" Monoid<List> Functor<List>])))) @@ -37,11 +37,11 @@ (All [a] (-> (Queue a) Bool)) (|>> (get@ #front) list.empty?)) -(def: #export (member? Eq<a> queue member) - (All [a] (-> (Eq a) (Queue a) a Bool)) +(def: #export (member? Equivalence<a> queue member) + (All [a] (-> (Equivalence a) (Queue a) a Bool)) (let [(^slots [#front #rear]) queue] - (or (list.member? Eq<a> front member) - (list.member? Eq<a> rear member)))) + (or (list.member? Equivalence<a> front member) + (list.member? Equivalence<a> rear member)))) (def: #export (pop queue) (All [a] (-> (Queue a) (Queue a))) @@ -67,10 +67,10 @@ _ (update@ #rear (|>> (#.Cons val)) queue))) -(struct: #export (Eq<Queue> Eq<a>) - (All [a] (-> (Eq a) (Eq (Queue a)))) +(struct: #export (Equivalence<Queue> Equivalence<a>) + (All [a] (-> (Equivalence a) (Equivalence (Queue a)))) (def: (= qx qy) - (:: (list.Eq<List> Eq<a>) = (to-list qx) (to-list qy)))) + (:: (list.Equivalence<List> Equivalence<a>) = (to-list qx) (to-list qy)))) (struct: #export _ (F.Functor Queue) (def: (map f fa) diff --git a/stdlib/source/lux/data/coll/queue/priority.lux b/stdlib/source/lux/data/coll/queue/priority.lux index a1e765fc3..443a54908 100644 --- a/stdlib/source/lux/data/coll/queue/priority.lux +++ b/stdlib/source/lux/data/coll/queue/priority.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] [monad #+ do Monad]) (data (coll (tree [finger #+ Tree])) [number "nat/" Interval<Nat>] @@ -39,8 +39,8 @@ (#finger.Branch _ left right) (n/+ (recur left) (recur right)))))) -(def: #export (member? Eq<a> queue member) - (All [a] (-> (Eq a) (Queue a) a Bool)) +(def: #export (member? Equivalence<a> queue member) + (All [a] (-> (Equivalence a) (Queue a) a Bool)) (case queue #.None false @@ -49,7 +49,7 @@ (loop [node (get@ #finger.node fingers)] (case node (#finger.Leaf _ reference) - (:: Eq<a> = reference member) + (:: Equivalence<a> = reference member) (#finger.Branch _ left right) (or (recur left) diff --git a/stdlib/source/lux/data/coll/row.lux b/stdlib/source/lux/data/coll/row.lux index 0b258a2ec..2c50120ec 100644 --- a/stdlib/source/lux/data/coll/row.lux +++ b/stdlib/source/lux/data/coll/row.lux @@ -3,7 +3,7 @@ (lux (control [functor #+ Functor] [apply #+ Apply] [monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Equivalence] monoid fold ["p" parser]) @@ -328,9 +328,9 @@ empty list)) -(def: #export (member? a/Eq vec val) - (All [a] (-> (Eq a) (Row a) a Bool)) - (list.member? a/Eq (to-list vec) val)) +(def: #export (member? a/Equivalence vec val) + (All [a] (-> (Equivalence a) (Row a) a Bool)) + (list.member? a/Equivalence (to-list vec) val)) (def: #export empty? (All [a] (-> (Row a) Bool)) @@ -343,22 +343,22 @@ (wrap (list (` (from-list (list (~+ elems))))))) ## [Structures] -(struct: #export (Eq<Node> Eq<a>) (All [a] (-> (Eq a) (Eq (Node a)))) +(struct: #export (Equivalence<Node> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Node a)))) (def: (= v1 v2) (case [v1 v2] [(#Base b1) (#Base b2)] - (:: (array.Eq<Array> Eq<a>) = b1 b2) + (:: (array.Equivalence<Array> Equivalence<a>) = b1 b2) [(#Hierarchy h1) (#Hierarchy h2)] - (:: (array.Eq<Array> (Eq<Node> Eq<a>)) = h1 h2) + (:: (array.Equivalence<Array> (Equivalence<Node> Equivalence<a>)) = h1 h2) _ false))) -(struct: #export (Eq<Row> Eq<a>) (All [a] (-> (Eq a) (Eq (Row a)))) +(struct: #export (Equivalence<Row> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Row a)))) (def: (= v1 v2) (and (n/= (get@ #size v1) (get@ #size v2)) - (let [(^open "Node/") (Eq<Node> Eq<a>)] + (let [(^open "Node/") (Equivalence<Node> Equivalence<a>)] (and (Node/= (#Base (get@ #tail v1)) (#Base (get@ #tail v2))) (Node/= (#Hierarchy (get@ #root v1)) diff --git a/stdlib/source/lux/data/coll/set/ordered.lux b/stdlib/source/lux/data/coll/set/ordered.lux index 5b7524a8a..0862d62c2 100644 --- a/stdlib/source/lux/data/coll/set/ordered.lux +++ b/stdlib/source/lux/data/coll/set/ordered.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [monad #+ do Monad] - equality + equivalence [order #+ Order]) (data (coll [list "L/" Monad<List> Monoid<List> Fold<List>] (dictionary ["d" ordered])) @@ -80,7 +80,7 @@ (All [a] (-> (Set a) (Set a) Bool)) (sub? super sub)) -(struct: #export Eq<Set> (All [a] (Eq (Set a))) +(struct: #export Equivalence<Set> (All [a] (Equivalence (Set a))) (def: (= reference sample) - (:: (list.Eq<List> (:: sample eq)) + (:: (list.Equivalence<List> (:: sample eq)) = (to-list reference) (to-list sample)))) diff --git a/stdlib/source/lux/data/coll/set/unordered.lux b/stdlib/source/lux/data/coll/set/unordered.lux index e977f35e5..4fcc0c1cc 100644 --- a/stdlib/source/lux/data/coll/set/unordered.lux +++ b/stdlib/source/lux/data/coll/set/unordered.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] [hash #*]) (data (coll (dictionary ["dict" unordered #+ Dict]) [list "list/" Fold<List> Functor<List>])))) @@ -63,12 +63,12 @@ (sub? super sub)) ## [Structures] -(struct: #export Eq<Set> (All [a] (Eq (Set a))) +(struct: #export Equivalence<Set> (All [a] (Equivalence (Set a))) (def: (= (^@ test [Hash<a> _]) subject) - (:: (list.Eq<List> (get@ #hash.eq Hash<a>)) = (to-list test) (to-list subject)))) + (:: (list.Equivalence<List> (get@ #hash.eq Hash<a>)) = (to-list test) (to-list subject)))) (struct: #export Hash<Set> (All [a] (Hash (Set a))) - (def: eq Eq<Set>) + (def: eq Equivalence<Set>) (def: (hash (^@ set [Hash<a> _])) (list/fold (function (_ elem acc) (n/+ (:: Hash<a> hash elem) acc)) diff --git a/stdlib/source/lux/data/coll/tree/rose.lux b/stdlib/source/lux/data/coll/tree/rose.lux index 28ca96d41..8171dcdaa 100644 --- a/stdlib/source/lux/data/coll/tree/rose.lux +++ b/stdlib/source/lux/data/coll/tree/rose.lux @@ -2,7 +2,7 @@ lux (lux (control functor [monad #+ do Monad] - equality + equivalence ["p" parser] fold) (data (coll [list "L/" Monad<List> Fold<List>])) @@ -54,10 +54,10 @@ #children (list (~+ (L/map recur children)))}))))))) ## [Structs] -(struct: #export (Eq<Tree> Eq<a>) (All [a] (-> (Eq a) (Eq (Tree a)))) +(struct: #export (Equivalence<Tree> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Tree a)))) (def: (= tx ty) - (and (:: Eq<a> = (get@ #value tx) (get@ #value ty)) - (:: (list.Eq<List> (Eq<Tree> Eq<a>)) = (get@ #children tx) (get@ #children ty))))) + (and (:: Equivalence<a> = (get@ #value tx) (get@ #value ty)) + (:: (list.Equivalence<List> (Equivalence<Tree> Equivalence<a>)) = (get@ #children tx) (get@ #children ty))))) (struct: #export _ (Functor Tree) (def: (map f fa) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 241347859..67c9c3388 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control ["eq" equality]) + (lux (control ["eq" equivalence]) (data (coll [list "L/" Functor<List>])) [math] (type abstract))) @@ -33,7 +33,7 @@ (-> Color [Nat Nat Nat]) (|>> :representation)) - (struct: #export _ (eq.Eq Color) + (struct: #export _ (eq.Equivalence Color) (def: (= reference sample) (let [[rr rg rb] (:representation reference) [sr sg sb] (:representation sample)] diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index a5c81ad6b..984fbb1aa 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -3,11 +3,11 @@ For more information, please see: http://www.json.org/"} [lux #- Array] (lux (control [monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Equivalence] codec ["p" parser "parser/" Monad<Parser>]) (data [bool] - [text "text/" Eq<Text> Monoid<Text>] + [text "text/" Equivalence<Text> Monoid<Text>] (text ["l" lexer]) [number "frac/" Codec<Text,Frac> "nat/" Codec<Text,Nat>] [maybe] @@ -147,7 +147,7 @@ [get-object #Object Object "objects"] ) -(struct: #export _ (Eq JSON) +(struct: #export _ (Equivalence JSON) (def: (= x y) (case [x y] [#Null #Null] @@ -156,9 +156,9 @@ (^template [<tag> <struct>] [(<tag> x') (<tag> y')] (:: <struct> = x' y')) - ([#Boolean bool.Eq<Bool>] - [#Number number.Eq<Frac>] - [#String text.Eq<Text>]) + ([#Boolean bool.Equivalence<Bool>] + [#Number number.Equivalence<Frac>] + [#String text.Equivalence<Text>]) [(#Array xs) (#Array ys)] (and (n/= (row.size xs) (row.size ys)) @@ -268,9 +268,9 @@ _ (fail ($_ text/compose "JSON value is not a " <desc> ".")))))] - [boolean? boolean! Bool bool.Eq<Bool> (:: bool.Codec<Text,Bool> encode) #Boolean "boolean" id] - [number? number! Frac number.Eq<Frac> (:: number.Codec<Text,Frac> encode) #Number "number" id] - [string? string! Text text.Eq<Text> text.encode #String "string" id] + [boolean? boolean! Bool bool.Equivalence<Bool> (:: bool.Codec<Text,Bool> encode) #Boolean "boolean" id] + [number? number! Frac number.Equivalence<Frac> (:: number.Codec<Text,Frac> encode) #Number "number" id] + [string? string! Text text.Equivalence<Text> text.encode #String "string" id] ) (def: #export (nullable parser) diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index a725263af..7d1614fca 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -1,17 +1,17 @@ (.module: {#.doc "Functionality for reading, generating and processing values in the XML format."} lux (lux (control monad - [equality #+ Eq] + [equivalence #+ Equivalence] codec ["p" parser "p/" Monad<Parser>] ["ex" exception #+ exception:]) - (data [text "text/" Eq<Text> Monoid<Text>] + (data [text "text/" Equivalence<Text> Monoid<Text>] (text ["l" lexer]) [number] ["E" error] [product] [maybe "m/" Monad<Maybe>] - [ident "ident/" Eq<Ident> Codec<Text,Ident>] + [ident "ident/" Equivalence<Ident> Codec<Text,Ident>] (coll [list "list/" Monad<List>] (dictionary ["d" unordered]))))) @@ -224,7 +224,7 @@ (def: encode write) (def: decode read)) -(struct: #export _ (Eq XML) +(struct: #export _ (Equivalence XML) (def: (= reference sample) (case [reference sample] [(#Text reference/value) (#Text sample/value)] @@ -233,7 +233,7 @@ [(#Node reference/tag reference/attrs reference/children) (#Node sample/tag sample/attrs sample/children)] (and (ident/= reference/tag sample/tag) - (:: (d.Eq<Dict> text.Eq<Text>) = reference/attrs sample/attrs) + (:: (d.Equivalence<Dict> text.Equivalence<Text>) = reference/attrs sample/attrs) (n/= (list.size reference/children) (list.size sample/children)) (|> (list.zip2 reference/children sample/children) diff --git a/stdlib/source/lux/data/ident.lux b/stdlib/source/lux/data/ident.lux index 867f96d8b..cb0b35b1f 100644 --- a/stdlib/source/lux/data/ident.lux +++ b/stdlib/source/lux/data/ident.lux @@ -1,9 +1,9 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] [codec #+ Codec] hash) - (data [text "text/" Monoid<Text> Eq<Text>]))) + (data [text "text/" Monoid<Text> Equivalence<Text>]))) ## [Types] ## (type: Ident @@ -20,7 +20,7 @@ ) ## [Structures] -(struct: #export _ (Eq Ident) +(struct: #export _ (Equivalence Ident) (def: (= [xmodule xname] [ymodule yname]) (and (text/= xmodule ymodule) (text/= xname yname)))) @@ -45,7 +45,7 @@ (#.Left (text/compose "Invalid format for Ident: " input)))))) (struct: #export _ (Hash Ident) - (def: eq Eq<Ident>) + (def: eq Equivalence<Ident>) (def: (hash [module name]) (let [(^open) text.Hash<Text>] diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index 6c5a7d02e..bfdb0fbe5 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -4,7 +4,7 @@ ["F" functor] ["A" apply] [monad #+ do Monad] - [equality #+ Eq]))) + [equivalence #+ Equivalence]))) ## [Types] ## (type: (Maybe a) @@ -47,14 +47,14 @@ #.None #.None (#.Some xs) xs))) -(struct: #export (Eq<Maybe> Eq<a>) (All [a] (-> (Eq a) (Eq (Maybe a)))) +(struct: #export (Equivalence<Maybe> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Maybe a)))) (def: (= mx my) (case [mx my] [#.None #.None] true [(#.Some x) (#.Some y)] - (:: Eq<a> = x y) + (:: Equivalence<a> = x y) _ false))) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 8c9e663cb..637d0d0ba 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -2,7 +2,7 @@ lux (lux (control number [monoid #+ Monoid] - [equality #+ Eq] + [equivalence #+ Equivalence] hash [order] enum @@ -14,7 +14,7 @@ ## [Structures] (do-template [<type> <test>] - [(struct: #export _ (Eq <type>) + [(struct: #export _ (Equivalence <type>) (def: = <test>))] [ Nat n/=] @@ -31,10 +31,10 @@ (def: > <gt>) (def: >= <gte>))] - [ Nat Eq<Nat> n/< n/<= n/> n/>=] - [ Int Eq<Int> i/< i/<= i/> i/>=] - [Rev Eq<Rev> r/< r/<= r/> r/>=] - [Frac Eq<Frac> f/< f/<= f/> f/>=] + [ Nat Equivalence<Nat> n/< n/<= n/> n/>=] + [ Int Equivalence<Int> i/< i/<= i/> i/>=] + [Rev Equivalence<Rev> r/< r/<= r/> r/>=] + [Frac Equivalence<Frac> f/< f/<= f/> f/>=] ) (struct: #export _ (Number Nat) @@ -995,18 +995,18 @@ ## [Hash] (struct: #export _ (Hash Nat) - (def: eq Eq<Nat>) + (def: eq Equivalence<Nat>) (def: hash id)) (struct: #export _ (Hash Int) - (def: eq Eq<Int>) + (def: eq Equivalence<Int>) (def: hash .nat)) (struct: #export _ (Hash Frac) - (def: eq Eq<Frac>) + (def: eq Equivalence<Frac>) (def: hash frac-to-bits)) (struct: #export _ (Hash Rev) - (def: eq Eq<Rev>) + (def: eq Equivalence<Rev>) (def: hash (|>> (:coerce Nat)))) diff --git a/stdlib/source/lux/data/number/complex.lux b/stdlib/source/lux/data/number/complex.lux index 792d2ce53..a7e535f08 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Complex arithmetic."} lux (lux [math] - (control [equality #+ Eq] + (control [equivalence #+ Equivalence] number codec ["M" monad #+ do Monad] @@ -56,7 +56,7 @@ [- f/-] ) -(struct: #export _ (Eq Complex) +(struct: #export _ (Equivalence Complex) (def: = ..=)) (def: #export negate diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index 6d241064a..c96c66882 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Rational arithmetic."} lux (lux [math] - (control [equality #+ Eq] + (control [equivalence #+ Equivalence] [order] number codec @@ -100,11 +100,11 @@ [max >] ) -(struct: #export _ (Eq Ratio) +(struct: #export _ (Equivalence Ratio) (def: = ..=)) (struct: #export _ (order.Order Ratio) - (def: eq Eq<Ratio>) + (def: eq Equivalence<Ratio>) (def: < ..<) (def: <= ..<=) (def: > ..>) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 58826e2c9..04af675c4 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [monoid #+ Monoid] - [equality #+ Eq] + [equivalence #+ Equivalence] [order] [monad #+ do Monad] [codec #+ Codec] @@ -123,12 +123,12 @@ (split-all-with "\n")) ## [Structures] -(struct: #export _ (Eq Text) +(struct: #export _ (Equivalence Text) (def: (= test subject) ("lux text =" subject test))) (struct: #export _ (order.Order Text) - (def: eq Eq<Text>) + (def: eq Equivalence<Text>) (def: (< test subject) ("lux text <" subject test)) @@ -167,7 +167,7 @@ ($_ text/compose "\"" escaped "\""))) (struct: #export _ (Hash Text) - (def: eq Eq<Text>) + (def: eq Equivalence<Text>) (def: (hash input) ("lux text hash" input))) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 78a190505..6628cb81d 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -9,13 +9,13 @@ number [maybe] [product] - [text "text/" Eq<Text> Monoid<Text>] + [text "text/" Equivalence<Text> Monoid<Text>] text/format [bool "bool/" Codec<Text,Bool>]) [macro #+ with-gensyms Functor<Meta> Monad<Meta>] (macro [code] ["s" syntax #+ syntax: Syntax]) - (lang [type "type/" Eq<Type>]) + (lang [type "type/" Equivalence<Type>]) )) (do-template [<name> <op> <from> <to>] @@ -462,7 +462,7 @@ (def: (qualify imports name) (-> Class-Imports Text Text) - (if (list.member? text.Eq<Text> java/lang/* name) + (if (list.member? text.Equivalence<Text> java/lang/* name) (format "java/lang/" name) (maybe.default name (get-import name imports)))) @@ -675,7 +675,7 @@ (do p.Monad<Parser> [name (full-class-name^ imports) _ (assert-no-periods name)] - (if (list.member? text.Eq<Text> (list/map product.left type-vars) name) + (if (list.member? text.Equivalence<Text> (list/map product.left type-vars) name) (wrap (#GenericTypeVar name)) (wrap (#GenericClass name (list))))) (s.form (do p.Monad<Parser> @@ -701,7 +701,7 @@ _ (assert-no-periods name) params (p.some (generic-type^ imports type-vars)) _ (p.assert (format name " cannot be a type-parameter!") - (not (list.member? text.Eq<Text> (list/map product.left type-vars) name)))] + (not (list.member? text.Equivalence<Text> (list/map product.left type-vars) name)))] (wrap (#GenericClass name params)))) )) diff --git a/stdlib/source/lux/lang/compiler/analysis.lux b/stdlib/source/lux/lang/compiler/analysis.lux index 9d35ff92c..c9e9b8be1 100644 --- a/stdlib/source/lux/lang/compiler/analysis.lux +++ b/stdlib/source/lux/lang/compiler/analysis.lux @@ -2,7 +2,7 @@ [lux #- nat int rev] (lux (data [product] [error] - [text "text/" Eq<Text>] + [text "text/" Equivalence<Text>] (coll [list "list/" Fold<List>])) [function]) [///reference #+ Register Variable Reference] diff --git a/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux b/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux index 3a63a76fc..c6a36e022 100644 --- a/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux @@ -2,8 +2,8 @@ lux (lux (control [monad #+ do] ["ex" exception #+ exception:] - equality) - (data [bool "bool/" Eq<Bool>] + equivalence) + (data [bool "bool/" Equivalence<Bool>] [number] ["e" error "error/" Monad<Error>] [maybe] @@ -142,7 +142,7 @@ _ (list coverage))) -(struct: _ (Eq Coverage) +(struct: _ (Equivalence Coverage) (def: (= reference sample) (case [reference sample] [#Exhaustive #Exhaustive] @@ -154,7 +154,7 @@ [(#Variant allR casesR) (#Variant allS casesS)] (and (n/= (cases allR) (cases allS)) - (:: (dict.Eq<Dict> =) = casesR casesS)) + (:: (dict.Equivalence<Dict> =) = casesR casesS)) [(#Seq leftR rightR) (#Seq leftS rightS)] (and (= leftR leftS) @@ -171,7 +171,7 @@ _ false))) -(open: "C/" Eq<Coverage>) +(open: "C/" Equivalence<Coverage>) ## After determining the coverage of each individual pattern, it is ## necessary to merge them all to figure out if the entire @@ -200,7 +200,7 @@ (cond (not (n/= (cases allSF) (cases allA))) (e.fail "Variants do not match.") - (:: (dict.Eq<Dict> Eq<Coverage>) = casesSF casesA) + (:: (dict.Equivalence<Dict> Equivalence<Coverage>) = casesSF casesA) redundant-pattern ## else diff --git a/stdlib/source/lux/lang/compiler/analysis/reference.lux b/stdlib/source/lux/lang/compiler/analysis/reference.lux index 5652e21fc..a3436d15b 100644 --- a/stdlib/source/lux/lang/compiler/analysis/reference.lux +++ b/stdlib/source/lux/lang/compiler/analysis/reference.lux @@ -5,7 +5,7 @@ [macro] (macro [code]) (lang (type ["tc" check])) - (data [text "text/" Eq<Text>] + (data [text "text/" Equivalence<Text>] text/format)) [///] [// #+ Analysis Operation] diff --git a/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux b/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux index 9b742b415..826650ccc 100644 --- a/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux +++ b/stdlib/source/lux/lang/compiler/extension/analysis/host.jvm.lux @@ -6,8 +6,8 @@ (data ["e" error] [maybe] [product] - [bool "bool/" Eq<Bool>] - [text "text/" Eq<Text>] + [bool "bool/" Equivalence<Bool>] + [text "text/" Equivalence<Text>] (text format ["l" lexer]) (coll [list "list/" Fold<List> Functor<List> Monoid<List>] @@ -200,13 +200,13 @@ (def: #export boxes (Dict Text Text) (|> (list ["boolean" "java.lang.Boolean"] - ["byte" "java.lang.Byte"] - ["short" "java.lang.Short"] - ["int" "java.lang.Integer"] - ["long" "java.lang.Long"] - ["float" "java.lang.Float"] - ["double" "java.lang.Double"] - ["char" "java.lang.Character"]) + ["byte" "java.lang.Byte"] + ["short" "java.lang.Short"] + ["int" "java.lang.Integer"] + ["long" "java.lang.Long"] + ["float" "java.lang.Float"] + ["double" "java.lang.Double"] + ["char" "java.lang.Character"]) (dict.from-list text.Hash<Text>))) (def: (array//length proc) diff --git a/stdlib/source/lux/lang/compiler/synthesis/case.lux b/stdlib/source/lux/lang/compiler/synthesis/case.lux index 88bfd36e9..bdf06f05f 100644 --- a/stdlib/source/lux/lang/compiler/synthesis/case.lux +++ b/stdlib/source/lux/lang/compiler/synthesis/case.lux @@ -1,13 +1,13 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] pipe [monad #+ do]) (data [product] - [bool "bool/" Eq<Bool>] - [text "text/" Eq<Text>] + [bool "bool/" Equivalence<Bool>] + [text "text/" Equivalence<Text>] text/format - [number "frac/" Eq<Frac>] + [number "frac/" Equivalence<Frac>] (coll [list "list/" Fold<List> Monoid<List>]))) [///reference] [///compiler #+ Operation "operation/" Monad<Operation>] @@ -99,7 +99,7 @@ rightP <default>)) ([#//.Bool bool/=] - [#//.I64 (:coerce (Eq I64) i/=)] + [#//.I64 (:coerce (Equivalence I64) i/=)] [#//.F64 frac/=] [#//.Text text/=]) diff --git a/stdlib/source/lux/lang/module.lux b/stdlib/source/lux/lang/module.lux index d6b66da74..b93b5e27b 100644 --- a/stdlib/source/lux/lang/module.lux +++ b/stdlib/source/lux/lang/module.lux @@ -3,7 +3,7 @@ (lux (control [monad #+ do] ["ex" exception #+ exception:] pipe) - (data [text "text/" Eq<Text>] + (data [text "text/" Equivalence<Text>] text/format ["e" error] (coll [list "list/" Fold<List> Functor<List>] diff --git a/stdlib/source/lux/lang/reference.lux b/stdlib/source/lux/lang/reference.lux index 0f7438345..c76f78d87 100644 --- a/stdlib/source/lux/lang/reference.lux +++ b/stdlib/source/lux/lang/reference.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] [hash #+ Hash] pipe))) @@ -14,7 +14,7 @@ (#Variable Variable) (#Constant Ident)) -(struct: #export _ (Eq Variable) +(struct: #export _ (Equivalence Variable) (def: (= reference sample) (case [reference sample] (^template [<tag>] @@ -26,7 +26,7 @@ false))) (struct: #export _ (Hash Variable) - (def: eq Eq<Variable>) + (def: eq Equivalence<Variable>) (def: (hash var) (case var (#Local register) diff --git a/stdlib/source/lux/lang/scope.lux b/stdlib/source/lux/lang/scope.lux index 217b7fcb3..191eb5e5d 100644 --- a/stdlib/source/lux/lang/scope.lux +++ b/stdlib/source/lux/lang/scope.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control monad) - (data [text "text/" Eq<Text>] + (data [text "text/" Equivalence<Text>] text/format [maybe "maybe/" Monad<Maybe>] [product] diff --git a/stdlib/source/lux/lang/type.lux b/stdlib/source/lux/lang/type.lux index cd18e103d..96ea1a9b0 100644 --- a/stdlib/source/lux/lang/type.lux +++ b/stdlib/source/lux/lang/type.lux @@ -1,10 +1,10 @@ (.module: {#.doc "Basic functionality for working with types."} [lux #- function] - (lux (control [equality #+ Eq] + (lux (control [equivalence #+ Equivalence] [monad #+ do Monad] ["p" parser]) - (data [text "text/" Monoid<Text> Eq<Text>] - [ident "ident/" Eq<Ident> Codec<Text,Ident>] + (data [text "text/" Monoid<Text> Equivalence<Text>] + [ident "ident/" Equivalence<Ident> Codec<Text,Ident>] [number "nat/" Codec<Text,Nat>] [maybe] (coll [list #+ "list/" Functor<List> Monoid<List> Fold<List>])) @@ -46,7 +46,7 @@ )) ## [Structures] -(struct: #export _ (Eq Type) +(struct: #export _ (Equivalence Type) (def: (= x y) (case [x y] [(#.Primitive xname xparams) (#.Primitive yname yparams)] diff --git a/stdlib/source/lux/lang/type/check.lux b/stdlib/source/lux/lang/type/check.lux index 482ea66bf..5e6ab2714 100644 --- a/stdlib/source/lux/lang/type/check.lux +++ b/stdlib/source/lux/lang/type/check.lux @@ -4,14 +4,14 @@ [apply #+ Apply] [monad #+ do Monad] ["ex" exception #+ exception:]) - (data [text "text/" Monoid<Text> Eq<Text>] + (data [text "text/" Monoid<Text> Equivalence<Text>] [number "nat/" Codec<Text,Nat>] [maybe] [product] (coll [list] (set ["set" unordered #+ Set])) ["e" error]) - (lang [type "type/" Eq<Type>]) + (lang [type "type/" Equivalence<Type>]) )) (exception: #export (unknown-type-var {id Nat}) @@ -419,7 +419,7 @@ (do @ [ringE (ring idE) ringA (ring idA)] - (if (:: set.Eq<Set> = ringE ringA) + (if (:: set.Equivalence<Set> = ringE ringA) (wrap assumptions) ## Fuse 2 rings (do @ diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 470406482..a8494f047 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -5,10 +5,10 @@ [monad #+ do Monad]) (data [number "nat/" Codec<Text,Nat>] [product] - [ident "ident/" Codec<Text,Ident> Eq<Ident>] + [ident "ident/" Codec<Text,Ident> Equivalence<Ident>] [maybe] ["e" error] - [text "text/" Monoid<Text> Eq<Text>] + [text "text/" Monoid<Text> Equivalence<Text>] (coll [list "list/" Monoid<List> Monad<List>]))) (/ [code])) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 67da53982..1094d7e0e 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -1,9 +1,9 @@ (.module: [lux #- nat int rev] - (lux (control [equality #+ Eq]) + (lux (control [equivalence #+ Equivalence]) (data bool number - [text #+ Eq<Text> "text/" Monoid<Text>] + [text #+ Equivalence<Text> "text/" Monoid<Text>] ident (coll [list #* "" Functor<List> Fold<List>]) ))) @@ -56,24 +56,24 @@ [local-tag #.Tag "Produces a local tag (a tag with no module prefix)."]) ## [Structures] -(struct: #export _ (Eq Code) +(struct: #export _ (Equivalence Code) (def: (= x y) (case [x y] (^template [<tag> <eq>] [[_ (<tag> x')] [_ (<tag> y')]] (:: <eq> = x' y')) - ([#.Bool Eq<Bool>] - [#.Nat Eq<Nat>] - [#.Int Eq<Int>] - [#.Rev Eq<Rev>] - [#.Frac Eq<Frac>] - [#.Text Eq<Text>] - [#.Symbol Eq<Ident>] - [#.Tag Eq<Ident>]) + ([#.Bool Equivalence<Bool>] + [#.Nat Equivalence<Nat>] + [#.Int Equivalence<Int>] + [#.Rev Equivalence<Rev>] + [#.Frac Equivalence<Frac>] + [#.Text Equivalence<Text>] + [#.Symbol Equivalence<Ident>] + [#.Tag Equivalence<Ident>]) (^template [<tag>] [[_ (<tag> xs')] [_ (<tag> ys')]] - (and (:: Eq<Nat> = (size xs') (size ys')) + (and (:: Equivalence<Nat> = (size xs') (size ys')) (fold (function (_ [x' y'] old) (and old (= x' y'))) true @@ -82,7 +82,7 @@ [#.Tuple]) [[_ (#.Record xs')] [_ (#.Record ys')]] - (and (:: Eq<Nat> = (size xs') (size ys')) + (and (:: Equivalence<Nat> = (size xs') (size ys')) (fold (function (_ [[xl' xr'] [yl' yr']] old) (and old (= xl' yl') (= xr' yr'))) true @@ -124,7 +124,7 @@ (def: #export (replace original substitute ast) {#.doc "Replaces all code that looks like the 'original' with the 'substitute'."} (-> Code Code Code Code) - (if (:: Eq<Code> = original ast) + (if (:: Equivalence<Code> = original ast) substitute (case ast (^template [<tag>] diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 2eb2e9ebc..4cf25eff7 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -1,7 +1,7 @@ (.module: [lux #- function] (lux (control [monad #+ do Monad] - [equality] + [equivalence] ["p" parser] ["ex" exception #+ exception:]) [function] @@ -12,7 +12,7 @@ [product] [bool] [maybe] - [ident "ident/" Eq<Ident> Codec<Text,Ident>] + [ident "ident/" Equivalence<Ident> Codec<Text,Ident>] ["e" error]) [macro #+ with-gensyms] (macro [code] @@ -20,7 +20,7 @@ (syntax ["cs" common] (common ["csr" reader] ["csw" writer]))) - (lang [type "type/" Eq<Type>] + (lang [type "type/" Equivalence<Type>] (type [check])) )) diff --git a/stdlib/source/lux/macro/poly/equality.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 6eb6ce4ce..89e403104 100644 --- a/stdlib/source/lux/macro/poly/equality.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [monad #+ do Monad] - ["eq" equality] + ["eq" equivalence] ["p" parser]) (data [text "text/" Monoid<Text>] text/format @@ -29,76 +29,76 @@ )) ## [Derivers] -(poly: #export Eq<?> +(poly: #export Equivalence<?> (`` (do @ [#let [g!_ (code.local-symbol "_____________")] *env* poly.env inputT poly.peek - #let [@Eq (: (-> Type Code) - (function (_ type) - (` (eq.Eq (~ (poly.to-code *env* type))))))]] + #let [@Equivalence (: (-> Type Code) + (function (_ type) + (` (eq.Equivalence (~ (poly.to-code *env* type))))))]] ($_ p.either ## Basic types (~~ (do-template [<matcher> <eq>] [(do @ [_ <matcher>] - (wrap (` (: (~ (@Eq inputT)) + (wrap (` (: (~ (@Equivalence inputT)) <eq>))))] [(poly.this Any) (function ((~ g!_) (~ g!_) (~ g!_)) true)] - [(poly.like Bool) bool.Eq<Bool>] - [(poly.like Nat) number.Eq<Nat>] - [(poly.like Int) number.Eq<Int>] - [(poly.like Rev) number.Eq<Rev>] - [(poly.like Frac) number.Eq<Frac>] - [(poly.like Text) text.Eq<Text>])) + [(poly.like Bool) bool.Equivalence<Bool>] + [(poly.like Nat) number.Equivalence<Nat>] + [(poly.like Int) number.Equivalence<Int>] + [(poly.like Rev) number.Equivalence<Rev>] + [(poly.like Frac) number.Equivalence<Frac>] + [(poly.like Text) text.Equivalence<Text>])) ## Composite types (~~ (do-template [<name> <eq>] [(do @ [[_ argC] (poly.apply (p.seq (poly.this <name>) - Eq<?>))] - (wrap (` (: (~ (@Eq inputT)) + Equivalence<?>))] + (wrap (` (: (~ (@Equivalence inputT)) (<eq> (~ argC))))))] - [.Maybe maybe.Eq<Maybe>] - [.List list.Eq<List>] - [row.Row row.Eq<Row>] - [.Array array.Eq<Array>] - [queue.Queue queue.Eq<Queue>] - [set.Set set.Eq<Set>] - [rose.Tree rose.Eq<Tree>] + [.Maybe maybe.Equivalence<Maybe>] + [.List list.Equivalence<List>] + [row.Row row.Equivalence<Row>] + [.Array array.Equivalence<Array>] + [queue.Queue queue.Equivalence<Queue>] + [set.Set set.Equivalence<Set>] + [rose.Tree rose.Equivalence<Tree>] )) (do @ [[_ _ valC] (poly.apply ($_ p.seq (poly.this dict.Dict) poly.any - Eq<?>))] - (wrap (` (: (~ (@Eq inputT)) - (dict.Eq<Dict> (~ valC)))))) + Equivalence<?>))] + (wrap (` (: (~ (@Equivalence inputT)) + (dict.Equivalence<Dict> (~ valC)))))) ## Models (~~ (do-template [<type> <eq>] [(do @ [_ (poly.this <type>)] - (wrap (` (: (~ (@Eq inputT)) + (wrap (` (: (~ (@Equivalence inputT)) <eq>))))] - [du.Duration du.Eq<Duration>] - [i.Instant i.Eq<Instant>] - [da.Date da.Eq<Date>] - [da.Day da.Eq<Day>] - [da.Month da.Eq<Month>])) + [du.Duration du.Equivalence<Duration>] + [i.Instant i.Equivalence<Instant>] + [da.Date da.Equivalence<Date>] + [da.Day da.Equivalence<Day>] + [da.Month da.Equivalence<Month>])) (do @ [_ (poly.apply (p.seq (poly.this unit.Qty) poly.any))] - (wrap (` (: (~ (@Eq inputT)) - unit.Eq<Qty>)))) + (wrap (` (: (~ (@Equivalence inputT)) + unit.Equivalence<Qty>)))) ## Variants (do @ - [members (poly.variant (p.many Eq<?>)) + [members (poly.variant (p.many Equivalence<?>)) #let [g!_ (code.local-symbol "_____________") g!left (code.local-symbol "_____________left") g!right (code.local-symbol "_____________right")]] - (wrap (` (: (~ (@Eq inputT)) + (wrap (` (: (~ (@Equivalence inputT)) (function ((~ g!_) (~ g!left) (~ g!right)) (case [(~ g!left) (~ g!right)] (~+ (list/join (list/map (function (_ [tag g!eq]) @@ -110,41 +110,41 @@ false)))))) ## Tuples (do @ - [g!eqs (poly.tuple (p.many Eq<?>)) + [g!eqs (poly.tuple (p.many Equivalence<?>)) #let [g!_ (code.local-symbol "_____________") indices (|> (list.size g!eqs) dec (list.n/range +0)) g!lefts (list/map (|>> nat/encode (text/compose "left") code.local-symbol) indices) g!rights (list/map (|>> nat/encode (text/compose "right") code.local-symbol) indices)]] - (wrap (` (: (~ (@Eq inputT)) + (wrap (` (: (~ (@Equivalence inputT)) (function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)]) (and (~+ (|> (list.zip3 g!eqs g!lefts g!rights) (list/map (function (_ [g!eq g!left g!right]) (` ((~ g!eq) (~ g!left) (~ g!right))))))))))))) ## Type recursion (do @ - [[g!self bodyC] (poly.recursive Eq<?>) + [[g!self bodyC] (poly.recursive Equivalence<?>) #let [g!_ (code.local-symbol "_____________")]] - (wrap (` (: (~ (@Eq inputT)) + (wrap (` (: (~ (@Equivalence inputT)) (eq.rec (.function ((~ g!_) (~ g!self)) (~ bodyC))))))) poly.recursive-self ## Type applications (do @ - [[funcC argsC] (poly.apply (p.seq Eq<?> (p.many Eq<?>)))] + [[funcC argsC] (poly.apply (p.seq Equivalence<?> (p.many Equivalence<?>)))] (wrap (` ((~ funcC) (~+ argsC))))) ## Parameters poly.parameter ## Polymorphism (do @ - [[funcC varsC bodyC] (poly.polymorphic Eq<?>)] + [[funcC varsC bodyC] (poly.polymorphic Equivalence<?>)] (wrap (` (: (All [(~+ varsC)] - (-> (~+ (list/map (|>> (~) eq.Eq (`)) varsC)) - (eq.Eq ((~ (poly.to-code *env* inputT)) (~+ varsC))))) + (-> (~+ (list/map (|>> (~) eq.Equivalence (`)) varsC)) + (eq.Equivalence ((~ (poly.to-code *env* inputT)) (~+ varsC))))) (function ((~ funcC) (~+ varsC)) (~ bodyC)))))) poly.recursive-call ## If all else fails... (|> poly.any - (:: @ map (|>> %type (format "Cannot create Eq for: ") p.fail)) + (:: @ map (|>> %type (format "Cannot create Equivalence for: ") p.fail)) (:: @ join)) )))) diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index dac1874e9..775b86b69 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Codecs for values in the JSON format."} lux (lux (control [monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Eq] codec ["p" parser "p/" Monad<Parser>]) (data [bool] diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 7e787ec95..3b0efaa8a 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -2,7 +2,7 @@ [lux #- nat int rev] (lux [macro #+ with-gensyms] (control [monad #+ do Monad] - [equality #+ Eq] + [equivalence #+ Equivalence] ["p" parser]) (data [bool] [number] @@ -11,7 +11,7 @@ (coll [list "list/" Functor<List>]) [maybe] [error #+ Error])) - (// [code "code/" Eq<Code>])) + (// [code "code/" Equivalence<Code>])) ## [Utils] (def: (join-pairs pairs) @@ -52,14 +52,14 @@ _ (#error.Error ($_ text/compose "Cannot parse " <desc> (remaining-inputs tokens))))))] - [ bool Bool #.Bool bool.Eq<Bool> "bool"] - [ nat Nat #.Nat number.Eq<Nat> "nat"] - [ int Int #.Int number.Eq<Int> "int"] - [ rev Rev #.Rev number.Eq<Rev> "rev"] - [ frac Frac #.Frac number.Eq<Frac> "frac"] - [ text Text #.Text text.Eq<Text> "text"] - [symbol Ident #.Symbol ident.Eq<Ident> "symbol"] - [ tag Ident #.Tag ident.Eq<Ident> "tag"] + [ bool Bool #.Bool bool.Equivalence<Bool> "bool"] + [ nat Nat #.Nat number.Equivalence<Nat> "nat"] + [ int Int #.Int number.Equivalence<Int> "int"] + [ rev Rev #.Rev number.Equivalence<Rev> "rev"] + [ frac Frac #.Frac number.Equivalence<Frac> "frac"] + [ text Text #.Text text.Equivalence<Text> "text"] + [symbol Ident #.Symbol ident.Equivalence<Ident> "symbol"] + [ tag Ident #.Tag ident.Equivalence<Ident> "tag"] ) (def: #export (this? ast) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index c84cc5624..0237d579a 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -3,7 +3,7 @@ (lux (control monad ["p" parser "p/" Monad<Parser>]) (data (coll [list]) - [ident "ident/" Eq<Ident>] + [ident "ident/" Equivalence<Ident>] [product] [maybe]) [macro] diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index 2a937c84d..f4680a6ca 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control equality + (lux (control equivalence order enum codec @@ -29,7 +29,7 @@ #November #December) -(struct: #export _ (Eq Month) +(struct: #export _ (Equivalence Month) (def: (= reference sample) (case [reference sample] (^template [<tag>] @@ -68,7 +68,7 @@ #December +11)) (struct: #export _ (Order Month) - (def: eq Eq<Month>) + (def: eq Equivalence<Month>) (do-template [<name> <comp>] [(def: (<name> reference sample) (<comp> (month-to-nat reference) (month-to-nat sample)))] @@ -119,7 +119,7 @@ #Friday #Saturday) -(struct: #export _ (Eq Day) +(struct: #export _ (Equivalence Day) (def: (= reference sample) (case [reference sample] (^template [<tag>] @@ -148,7 +148,7 @@ #Saturday +6)) (struct: #export _ (Order Day) - (def: eq Eq<Day>) + (def: eq Equivalence<Day>) (do-template [<name> <comp>] [(def: (<name> reference sample) (<comp> (day-to-nat reference) (day-to-nat sample)))] @@ -185,11 +185,11 @@ #month Month #day Nat}) -(struct: #export _ (Eq Date) +(struct: #export _ (Equivalence Date) (def: (= reference sample) (and (i/= (get@ #year reference) (get@ #year sample)) - (:: Eq<Month> = + (:: Equivalence<Month> = (get@ #month reference) (get@ #month sample)) (n/= (get@ #day reference) @@ -206,16 +206,16 @@ (get@ #day sample)))) (struct: #export _ (Order Date) - (def: eq Eq<Date>) + (def: eq Equivalence<Date>) (def: < date/<) (def: (> reference sample) (date/< sample reference)) (def: (<= reference sample) (or (date/< reference sample) - (:: Eq<Date> = reference sample))) + (:: Equivalence<Date> = reference sample))) (def: (>= reference sample) (or (date/< sample reference) - (:: Eq<Date> = sample reference)))) + (:: Equivalence<Date> = sample reference)))) ## Based on this: https://stackoverflow.com/a/42936293/6823464 (def: (pad value) diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index a29eda6da..5df655018 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -1,6 +1,6 @@ (.module: lux - (lux (control equality + (lux (control equivalence order codec [monoid #+ Monoid] @@ -41,12 +41,12 @@ (-> Duration Duration Int) (i// (:representation param) (:representation subject))) - (struct: #export _ (Eq Duration) + (struct: #export _ (Equivalence Duration) (def: (= param subject) (i/= (:representation param) (:representation subject)))) (struct: #export _ (Order Duration) - (def: eq Eq<Duration>) + (def: eq Equivalence<Duration>) (do-template [<name> <op>] [(def: (<name> param subject) (<op> (:representation param) (:representation subject)))] @@ -83,7 +83,7 @@ (def: (encode duration) (-> Duration Text) - (if (:: Eq<Duration> = empty duration) + (if (:: Equivalence<Duration> = empty duration) "0ms" (let [signed? (negative? duration) [days time-left] [(query day duration) (frame day duration)] diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 68a86bf9d..4f14555f9 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -1,7 +1,7 @@ (.module: lux (lux [io #- run] - (control equality + (control equivalence order enum codec @@ -46,12 +46,12 @@ (-> duration.Duration Instant) (|> offset duration.to-millis :abstraction)) - (struct: #export _ (Eq Instant) + (struct: #export _ (Equivalence Instant) (def: (= param subject) - (:: number.Eq<Int> = (:representation param) (:representation subject)))) + (:: number.Equivalence<Int> = (:representation param) (:representation subject)))) (struct: #export _ (Order Instant) - (def: eq Eq<Instant>) + (def: eq Equivalence<Instant>) (do-template [<name>] [(def: (<name> param subject) (:: number.Order<Int> <name> (:representation param) (:representation subject)))] diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index f7594852d..d9aa8a8bb 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -2,7 +2,7 @@ lux (lux (control [monad #+ do Monad] ["p" parser]) - (data [text "text/" Eq<Text> Monoid<Text>] + (data [text "text/" Equivalence<Text> Monoid<Text>] [error] (coll [list "list/" Functor<List> Monoid<List>])) [macro #+ "meta/" Monad<Meta>] diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index 84bff5ec9..b7e970685 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -1,9 +1,9 @@ (.module: lux (lux (control [monad #+ do Monad] - ["eq" equality] + ["eq" equivalence] ["p" parser]) - (data [text "text/" Eq<Text>] + (data [text "text/" Equivalence<Text>] text/format [number] (coll [list "list/" Monad<List> Fold<List>] @@ -318,12 +318,12 @@ "If no alternative is found, or if more than one alternative is found (ambiguity)" "a compile-time error will be raised, to alert the user." "Examples:" - "Nat equality" - (:: number.Eq<Nat> = x y) + "Nat equivalence" + (:: number.Equivalence<Nat> = x y) (::: = x y) "Can optionally add the prefix of the module where the signature was defined." (::: eq.= x y) - "(List Nat) equality" + "(List Nat) equivalence" (::: = (list.n/range +1 +10) (list.n/range +1 +10)) diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux index e4b08c9ac..80bf6cd3f 100644 --- a/stdlib/source/lux/type/object/interface.lux +++ b/stdlib/source/lux/type/object/interface.lux @@ -6,7 +6,7 @@ text/format [product] [maybe] - [ident #+ "ident/" Eq<Ident>] + [ident #+ "ident/" Equivalence<Ident>] (coll [list "list/" Functor<List> Fold<List> Monoid<List>] (set ["set" unordered #+ Set]))) [macro #+ Monad<Meta> "meta/" Monad<Meta>] diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux index afc190c4f..39b6393ce 100644 --- a/stdlib/source/lux/type/refinement.lux +++ b/stdlib/source/lux/type/refinement.lux @@ -4,7 +4,7 @@ [monad #+ do] ["p" parser]) (data ["e" error #+ Error]) - (lang [type "type/" Eq<Type>]) + (lang [type "type/" Equivalence<Type>]) (type abstract) [macro] (macro ["s" syntax #+ syntax:] diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index 0b5e2dcec..5072a677f 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -2,7 +2,7 @@ lux (lux (control [monad #+ do Monad] ["p" parser "p/" Monad<Parser>] - [equality #+ Eq] + [equivalence #+ Equivalence] [order #+ Order] [enum #+ Enum]) (data text/format @@ -156,12 +156,12 @@ (unit: #export Litre) (unit: #export Second) -(struct: #export Eq<Unit> (All [unit] (Eq (Qty unit))) +(struct: #export Equivalence<Unit> (All [unit] (Equivalence (Qty unit))) (def: (= reference sample) (i/= (out reference) (out sample)))) (struct: #export Order<Unit> (All [unit] (Order (Qty unit))) - (def: eq Eq<Unit>) + (def: eq Equivalence<Unit>) (do-template [<name> <func>] [(def: (<name> reference sample) diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index 3d30d2b93..162574ba9 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -2,7 +2,7 @@ [lux #- i64] (lux (control [monad #+ do] ["ex" exception #+ exception:] - ["eq" equality]) + ["eq" equivalence]) (data [bit] [maybe] ["e" error] @@ -140,6 +140,6 @@ (-> Nat Blob (e.Error Blob)) (slice from (dec (host.array-length blob)) blob)) -(struct: #export _ (eq.Eq Blob) +(struct: #export _ (eq.Equivalence Blob) (def: (= reference sample) (Arrays::equals [reference sample]))) |