diff options
Diffstat (limited to 'stdlib')
-rw-r--r-- | stdlib/source/lux.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/control/equivalence.lux | 26 | ||||
-rw-r--r-- | stdlib/source/lux/control/interval.lux | 30 | ||||
-rw-r--r-- | stdlib/source/lux/control/monoid.lux | 13 | ||||
-rw-r--r-- | stdlib/source/lux/control/order.lux | 19 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly/functor.lux | 4 | ||||
-rw-r--r-- | stdlib/source/lux/macro/poly/json.lux | 6 |
7 files changed, 50 insertions, 52 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index 238d77bd8..0389a64f8 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -3843,7 +3843,7 @@ #None (#Left "Not expecting any type."))))) -(macro: #export (struct tokens) +(macro: #export (structure tokens) {#.doc "Not meant to be used directly. Prefer \"structure:\"."} (do Monad<Meta> [tokens' (monad/map Monad<Meta> macro-expand tokens) @@ -3950,7 +3950,7 @@ (~ (meta-code-merge (` {#.struct? true}) meta)) (~ type) - (struct (~+ definitions))))))) + (structure (~+ definitions))))))) #None (fail "Cannot infer name, so struct must have a name other than \"_\"!")) diff --git a/stdlib/source/lux/control/equivalence.lux b/stdlib/source/lux/control/equivalence.lux index 6ee8630e2..cddf72542 100644 --- a/stdlib/source/lux/control/equivalence.lux +++ b/stdlib/source/lux/control/equivalence.lux @@ -7,24 +7,24 @@ (def: #export (product left right) (All [l r] (-> (Equivalence l) (Equivalence r) (Equivalence [l r]))) - (struct (def: (= [a b] [x y]) - (and (:: left = a x) - (:: right = b y))))) + (structure (def: (= [a b] [x y]) + (and (:: left = a x) + (:: right = b y))))) (def: #export (sum left right) (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)] - (:: left = a x) + (structure (def: (= a|b x|y) + (case [a|b x|y] + [(+0 a) (+0 x)] + (:: left = a x) - [(+1 b) (+1 y)] - (:: right = b y) + [(+1 b) (+1 y)] + (:: right = b y) - _ - false)))) + _ + false)))) (def: #export (rec sub) (All [a] (-> (-> (Equivalence a) (Equivalence a)) (Equivalence a))) - (struct (def: (= left right) - (sub (rec sub) left right)))) + (structure (def: (= left right) + (sub (rec sub) left right)))) diff --git a/stdlib/source/lux/control/interval.lux b/stdlib/source/lux/control/interval.lux index 1cc825070..c000d0cec 100644 --- a/stdlib/source/lux/control/interval.lux +++ b/stdlib/source/lux/control/interval.lux @@ -18,15 +18,15 @@ (def: #export (between Enum<a> bottom top) (All [a] (-> (Enum a) a a (Interval a))) - (struct (def: enum Enum<a>) - (def: bottom bottom) - (def: top top))) + (structure (def: enum Enum<a>) + (def: bottom bottom) + (def: top top))) (def: #export (singleton Enum<a> elem) (All [a] (-> (Enum a) a (Interval a))) - (struct (def: enum Enum<a>) - (def: bottom elem) - (def: top elem))) + (structure (def: enum Enum<a>) + (def: bottom elem) + (def: top elem))) (do-template [<name> <comp>] [(def: #export (<name> interval) @@ -71,22 +71,22 @@ (def: #export (union left right) (All [a] (-> (Interval a) (Interval a) (Interval a))) - (struct (def: enum (get@ #enum right)) - (def: bottom (order.min (:: right order) (:: left bottom) (:: right bottom))) - (def: top (order.max (:: right order) (:: left top) (:: right top))))) + (structure (def: enum (get@ #enum right)) + (def: bottom (order.min (:: right order) (:: left bottom) (:: right bottom))) + (def: top (order.max (:: right order) (:: left top) (:: right top))))) (def: #export (intersection left right) (All [a] (-> (Interval a) (Interval a) (Interval a))) - (struct (def: enum (get@ #enum right)) - (def: bottom (order.max (:: right order) (:: left bottom) (:: right bottom))) - (def: top (order.min (:: right order) (:: left top) (:: right top))))) + (structure (def: enum (get@ #enum right)) + (def: bottom (order.max (:: right order) (:: left bottom) (:: right bottom))) + (def: top (order.min (:: right order) (:: left top) (:: right top))))) (def: #export (complement interval) (All [a] (-> (Interval a) (Interval a))) (let [(^open) interval] - (struct (def: enum (get@ #enum interval)) - (def: bottom (succ top)) - (def: top (pred bottom))))) + (structure (def: enum (get@ #enum interval)) + (def: bottom (succ top)) + (def: top (pred bottom))))) (def: #export (precedes? reference sample) (All [a] (-> (Interval a) (Interval a) Bool)) diff --git a/stdlib/source/lux/control/monoid.lux b/stdlib/source/lux/control/monoid.lux index a71f2335e..301511971 100644 --- a/stdlib/source/lux/control/monoid.lux +++ b/stdlib/source/lux/control/monoid.lux @@ -12,13 +12,12 @@ (def: #export (compose Monoid<l> Monoid<r>) (All [l r] (-> (Monoid l) (Monoid r) (Monoid [l r]))) - (struct - (def: identity - [(:: Monoid<l> identity) (:: Monoid<r> identity)]) - - (def: (compose [lL rL] [lR rR]) - [(:: Monoid<l> compose lL lR) - (:: Monoid<r> compose rL rR)]))) + (structure (def: identity + [(:: Monoid<l> identity) (:: Monoid<r> identity)]) + + (def: (compose [lL rL] [lR rR]) + [(:: Monoid<l> compose lL lR) + (:: Monoid<r> compose rL rR)]))) (def: #export (fold Monoid<a> Fold<F> data) (All [a F] (-> (Monoid a) (Fold F) (F a) a)) diff --git a/stdlib/source/lux/control/order.lux b/stdlib/source/lux/control/order.lux index 153b1fa9a..c06658b21 100644 --- a/stdlib/source/lux/control/order.lux +++ b/stdlib/source/lux/control/order.lux @@ -22,16 +22,15 @@ (All [a] (-> (Equivalence a) (-> a a Bool) (Order a))) (let [> (flip <)] - (struct - (def: eq eq) - (def: < <) - (def: (<= test subject) - (or (< test subject) - (:: eq = test subject))) - (def: > >) - (def: (>= test subject) - (or (> test subject) - (:: eq = test subject)))))) + (structure (def: eq eq) + (def: < <) + (def: (<= test subject) + (or (< test subject) + (:: eq = test subject))) + (def: > >) + (def: (>= test subject) + (or (> test subject) + (:: eq = test subject)))))) (do-template [<name> <op>] [(def: #export (<name> order x y) diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux index 0f7b67b57..a0e5bb463 100644 --- a/stdlib/source/lux/macro/poly/functor.lux +++ b/stdlib/source/lux/macro/poly/functor.lux @@ -92,5 +92,5 @@ (Arg<?> inputC)) (p.fail (format "Cannot create Functor for: " (%type inputT)))))] (wrap (` (: (~ (@Functor inputT)) - (struct (def: ((~' map) (~ funcC) (~ inputC)) - (~ outputC)))))))) + (structure (def: ((~' map) (~ funcC) (~ inputC)) + (~ outputC)))))))) diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 2a708ee2e..18fd0ea2c 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -310,6 +310,6 @@ (derived: (Codec<JSON,?> Record)))} (with-gensyms [g!inputs] (wrap (list (` (: (Codec //.JSON (~ inputT)) - (struct (def: (~' encode) ((~! Codec<JSON,?>//encode) (~ inputT))) - (def: ((~' decode) (~ g!inputs)) (//.run (~ g!inputs) ((~! Codec<JSON,?>//decode) (~ inputT)))) - ))))))) + (structure (def: (~' encode) ((~! Codec<JSON,?>//encode) (~ inputT))) + (def: ((~' decode) (~ g!inputs)) (//.run (~ g!inputs) ((~! Codec<JSON,?>//decode) (~ inputT)))) + ))))))) |