diff options
Diffstat (limited to 'stdlib')
68 files changed, 202 insertions, 202 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index bbf765e9a..238d77bd8 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -3844,7 +3844,7 @@ (#Left "Not expecting any type."))))) (macro: #export (struct tokens) - {#.doc "Not meant to be used directly. Prefer \"struct:\"."} + {#.doc "Not meant to be used directly. Prefer \"structure:\"."} (do Monad<Meta> [tokens' (monad/map Monad<Meta> macro-expand tokens) struct-type get-expected-type @@ -3880,9 +3880,9 @@ (-> (List Text) Text) (|> parts list/reverse (list/fold text/compose ""))) -(macro: #export (struct: tokens) +(macro: #export (structure: tokens) {#.doc "## Definition of structures ala ML. - (struct: #export Ord<Int> (Ord Int) + (structure: #export Ord<Int> (Ord Int) (def: eq Equivalence<Int>) (def: (< test subject) (lux.< test subject)) @@ -3956,7 +3956,7 @@ (fail "Cannot infer name, so struct must have a name other than \"_\"!")) #None - (fail "Wrong syntax for struct:")))) + (fail "Wrong syntax for structure:")))) (def: #export (id x) {#.doc "Identity function. diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index 7b4bfbec0..dda469f62 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -96,14 +96,14 @@ output))) ## [Structures] -(struct: #export _ (Functor Channel) +(structure: #export _ (Functor Channel) (def: (map f input) (let [output (channel [])] (exec (io.run (listen (|>> f (publish output)) input)) output)))) -(struct: #export _ (Apply Channel) +(structure: #export _ (Apply Channel) (def: functor Functor<Channel>) (def: (apply ff fa) @@ -114,7 +114,7 @@ ff)) output)))) -(struct: #export _ (Monad Channel) +(structure: #export _ (Monad Channel) (def: functor Functor<Channel>) (def: (wrap a) diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 866cdd8da..b2597c2cc 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -72,14 +72,14 @@ (#.Some _) true)) -(struct: #export _ (Functor Promise) +(structure: #export _ (Functor Promise) (def: (map f fa) (let [fb (promise #.None)] (exec (await (function (_ a) (resolve (f a) fb)) fa) fb)))) -(struct: #export _ (Apply Promise) +(structure: #export _ (Apply Promise) (def: functor Functor<Promise>) (def: (apply ff fa) @@ -90,7 +90,7 @@ ff) fb)))) -(struct: #export _ (Monad Promise) +(structure: #export _ (Monad Promise) (def: functor Functor<Promise>) (def: (wrap a) diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 9fef9f59e..eddaabf2b 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -127,13 +127,13 @@ [(#.Cons [var (read!! var) value] tx) []]))) -(struct: #export _ (Functor STM) +(structure: #export _ (Functor STM) (def: (map f fa) (function (_ tx) (let [[tx' a] (fa tx)] [tx' (f a)])))) -(struct: #export _ (Apply STM) +(structure: #export _ (Apply STM) (def: functor Functor<STM>) (def: (apply ff fa) @@ -142,7 +142,7 @@ [tx'' a] (fa tx')] [tx'' (f a)])))) -(struct: #export _ (Monad STM) +(structure: #export _ (Monad STM) (def: functor Functor<STM>) (def: (wrap a) diff --git a/stdlib/source/lux/concurrency/task.lux b/stdlib/source/lux/concurrency/task.lux index 911fdd2d2..d51574bbc 100644 --- a/stdlib/source/lux/concurrency/task.lux +++ b/stdlib/source/lux/concurrency/task.lux @@ -30,7 +30,7 @@ (All [a] (-> (Task a) (Task (E.Error a)))) (:: P.Functor<Promise> map (|>> #E.Success) computation)) -(struct: #export _ (F.Functor Task) +(structure: #export _ (F.Functor Task) (def: (map f fa) (:: P.Functor<Promise> map (function (_ fa') @@ -42,7 +42,7 @@ (#E.Success (f a)))) fa))) -(struct: #export _ (A.Apply Task) +(structure: #export _ (A.Apply Task) (def: functor Functor<Task>) (def: (apply ff fa) @@ -54,7 +54,7 @@ a fa'] (wrap (f a))))))) -(struct: #export _ (Monad Task) +(structure: #export _ (Monad Task) (def: functor Functor<Task>) (def: wrap return) diff --git a/stdlib/source/lux/control/apply.lux b/stdlib/source/lux/control/apply.lux index 4c3d73ba1..2dd932140 100644 --- a/stdlib/source/lux/control/apply.lux +++ b/stdlib/source/lux/control/apply.lux @@ -11,7 +11,7 @@ (-> (f (-> a b)) (f a) (f b))) apply)) -(struct: #export (compose Monad<F> Apply<F> Apply<G>) +(structure: #export (compose Monad<F> Apply<F> Apply<G>) {#.doc "Applicative functor composition."} (All [F G] (-> (Monad F) (Apply F) (Apply G) diff --git a/stdlib/source/lux/control/codec.lux b/stdlib/source/lux/control/codec.lux index 1c0375831..b219c8522 100644 --- a/stdlib/source/lux/control/codec.lux +++ b/stdlib/source/lux/control/codec.lux @@ -12,7 +12,7 @@ decode)) ## [Values] -(struct: #export (compose Codec<c,b> Codec<b,a>) +(structure: #export (compose Codec<c,b> Codec<b,a>) {#.doc "Codec composition."} (All [a b c] (-> (Codec c b) (Codec b a) diff --git a/stdlib/source/lux/control/continuation.lux b/stdlib/source/lux/control/continuation.lux index d23ebec18..0cb7b5c7e 100644 --- a/stdlib/source/lux/control/continuation.lux +++ b/stdlib/source/lux/control/continuation.lux @@ -22,11 +22,11 @@ (All [a] (-> (Cont a a) a)) (cont id)) -(struct: #export Functor<Cont> (All [o] (Functor (All [i] (Cont i o)))) +(structure: #export Functor<Cont> (All [o] (Functor (All [i] (Cont i o)))) (def: (map f fv) (function (_ k) (fv (compose k f))))) -(struct: #export Apply<Cont> (All [o] (Apply (All [i] (Cont i o)))) +(structure: #export Apply<Cont> (All [o] (Apply (All [i] (Cont i o)))) (def: functor Functor<Cont>) (def: (apply ff fv) @@ -35,7 +35,7 @@ (function (_ v)) fv (function (_ f)) ff)))) -(struct: #export Monad<Cont> (All [o] (Monad (All [i] (Cont i o)))) +(structure: #export Monad<Cont> (All [o] (Monad (All [i] (Cont i o)))) (def: functor Functor<Cont>) (def: (wrap value) diff --git a/stdlib/source/lux/control/functor.lux b/stdlib/source/lux/control/functor.lux index c4478a710..8fcb40c55 100644 --- a/stdlib/source/lux/control/functor.lux +++ b/stdlib/source/lux/control/functor.lux @@ -18,7 +18,7 @@ (type: #export (<$> f g) (All [a] (f (g a)))) -(struct: #export (compose Functor<F> Functor<G>) +(structure: #export (compose Functor<F> Functor<G>) {#.doc "Functor composition."} (All [F G] (-> (Functor F) (Functor G) (Functor (All [a] (F (G a)))))) (def: (map f fga) diff --git a/stdlib/source/lux/control/interval.lux b/stdlib/source/lux/control/interval.lux index a53115576..1cc825070 100644 --- a/stdlib/source/lux/control/interval.lux +++ b/stdlib/source/lux/control/interval.lux @@ -133,7 +133,7 @@ [after? >] ) -(struct: #export Equivalence<Interval> (All [a] (Equivalence (Interval a))) +(structure: #export Equivalence<Interval> (All [a] (Equivalence (Interval a))) (def: (= reference sample) (let [(^open) reference] (and (= bottom (:: sample bottom)) diff --git a/stdlib/source/lux/control/monad/free.lux b/stdlib/source/lux/control/monad/free.lux index 716ae805b..400c5fc31 100644 --- a/stdlib/source/lux/control/monad/free.lux +++ b/stdlib/source/lux/control/monad/free.lux @@ -9,7 +9,7 @@ (#Pure a) (#Effect (F (Free F a)))) -(struct: #export (Functor<Free> dsl) +(structure: #export (Functor<Free> dsl) (All [F] (-> (Functor F) (Functor (Free F)))) (def: (map f ea) @@ -20,7 +20,7 @@ (#Effect value) (#Effect (:: dsl map (map f) value))))) -(struct: #export (Apply<Free> dsl) +(structure: #export (Apply<Free> dsl) (All [F] (-> (Functor F) (Apply (Free F)))) (def: functor (Functor<Free> dsl)) @@ -41,7 +41,7 @@ ff)) ))) -(struct: #export (Monad<Free> dsl) +(structure: #export (Monad<Free> dsl) (All [F] (-> (Functor F) (Monad (Free F)))) (def: functor (Functor<Free> dsl)) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index 91c3a84a8..1ad76a50a 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -13,7 +13,7 @@ (-> s (e.Error [s a]))) ## [Structures] -(struct: #export Functor<Parser> (All [s] (Functor (Parser s))) +(structure: #export Functor<Parser> (All [s] (Functor (Parser s))) (def: (map f ma) (function (_ input) (case (ma input) @@ -23,7 +23,7 @@ (#e.Success [input' a]) (#e.Success [input' (f a)]))))) -(struct: #export Apply<Parser> (All [s] (Apply (Parser s))) +(structure: #export Apply<Parser> (All [s] (Apply (Parser s))) (def: functor Functor<Parser>) (def: (apply ff fa) @@ -40,7 +40,7 @@ (#e.Error msg) (#e.Error msg))))) -(struct: #export Monad<Parser> (All [s] (Monad (Parser s))) +(structure: #export Monad<Parser> (All [s] (Monad (Parser s))) (def: functor Functor<Parser>) (def: (wrap x) diff --git a/stdlib/source/lux/control/predicate.lux b/stdlib/source/lux/control/predicate.lux index 44e273dee..56c048593 100644 --- a/stdlib/source/lux/control/predicate.lux +++ b/stdlib/source/lux/control/predicate.lux @@ -23,7 +23,7 @@ ) (do-template [<name> <identity> <composition>] - [(struct: #export <name> (All [a] (Monoid (Predicate a))) + [(structure: #export <name> (All [a] (Monoid (Predicate a))) (def: identity <identity>) (def: compose <composition>))] diff --git a/stdlib/source/lux/control/reader.lux b/stdlib/source/lux/control/reader.lux index 228e474db..274c5b1cc 100644 --- a/stdlib/source/lux/control/reader.lux +++ b/stdlib/source/lux/control/reader.lux @@ -10,14 +10,14 @@ (-> r a)) ## [Structures] -(struct: #export Functor<Reader> +(structure: #export Functor<Reader> (All [r] (F.Functor (Reader r))) (def: (map f fa) (function (_ env) (f (fa env))))) -(struct: #export Apply<Reader> +(structure: #export Apply<Reader> (All [r] (A.Apply (Reader r))) (def: functor Functor<Reader>) @@ -26,7 +26,7 @@ (function (_ env) ((ff env) (fa env))))) -(struct: #export Monad<Reader> +(structure: #export Monad<Reader> (All [r] (Monad (Reader r))) (def: functor Functor<Reader>) @@ -53,7 +53,7 @@ (All [r a] (-> r (Reader r a) a)) (proc env)) -(struct: #export (ReaderT Monad<M>) +(structure: #export (ReaderT Monad<M>) {#.doc "Monad transformer for Reader."} (All [M] (-> (Monad M) (All [e] (Monad (All [a] (Reader e (M a))))))) diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux index 7397d9781..d35495d93 100644 --- a/stdlib/source/lux/control/region.lux +++ b/stdlib/source/lux/control/region.lux @@ -62,7 +62,7 @@ cleaners) (#e.Success value)]))) -(struct: #export (Functor<Region> Functor<m>) +(structure: #export (Functor<Region> Functor<m>) (All [m] (-> (Functor m) (All [r] (Functor (Region r m))))) @@ -80,7 +80,7 @@ (#e.Error error))]) (fa region+cleaners)))))) -(struct: #export (Apply<Region> Monad<m>) +(structure: #export (Apply<Region> Monad<m>) (All [m] (-> (Monad m) (All [r] (Apply (Region r m))))) @@ -101,7 +101,7 @@ [_ (#e.Error error)]) (wrap [cleaners (#e.Error error)])))))) -(struct: #export (Monad<Region> Monad<m>) +(structure: #export (Monad<Region> Monad<m>) (All [m] (-> (Monad m) (All [r] (Monad (Region r m))))) diff --git a/stdlib/source/lux/control/state.lux b/stdlib/source/lux/control/state.lux index be8844a0c..244052f2d 100644 --- a/stdlib/source/lux/control/state.lux +++ b/stdlib/source/lux/control/state.lux @@ -10,7 +10,7 @@ (-> s [s a])) ## [Structures] -(struct: #export Functor<State> +(structure: #export Functor<State> (All [s] (F.Functor (State s))) (def: (map f ma) @@ -18,7 +18,7 @@ (let [[state' a] (ma state)] [state' (f a)])))) -(struct: #export Apply<State> +(structure: #export Apply<State> (All [s] (A.Apply (State s))) (def: functor Functor<State>) @@ -29,7 +29,7 @@ [state'' a] (fa state')] [state'' (f a)])))) -(struct: #export Monad<State> +(structure: #export Monad<State> (All [s] (Monad (State s))) (def: functor Functor<State>) @@ -80,7 +80,7 @@ (All [s a] (-> s (State s a) [s a])) (action state)) -(struct: (Functor<State'> Functor<M>) +(structure: (Functor<State'> Functor<M>) (All [M s] (-> (F.Functor M) (F.Functor (All [a] (-> s (M [s a])))))) (def: (map f sfa) @@ -88,7 +88,7 @@ (:: Functor<M> map (function (_ [s a]) [s (f a)]) (sfa state))))) -(struct: (Apply<State'> Monad<M>) +(structure: (Apply<State'> Monad<M>) (All [M s] (-> (Monad M) (A.Apply (All [a] (-> s (M [s a])))))) (def: functor (Functor<State'> (:: Monad<M> functor))) @@ -109,7 +109,7 @@ (All [M s a] (-> s (State' M s a) (M [s a]))) (action state)) -(struct: #export (Monad<State'> Monad<M>) +(structure: #export (Monad<State'> Monad<M>) {#.doc "A monad transformer to create composite stateful computations."} (All [M s] (-> (Monad M) (Monad (State' M s)))) diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux index 5709b41bb..b54de05ef 100644 --- a/stdlib/source/lux/control/thread.lux +++ b/stdlib/source/lux/control/thread.lux @@ -33,7 +33,7 @@ a)) (thread [])) -(struct: #export Functor<Thread> +(structure: #export Functor<Thread> (All [!] (Functor (Thread !))) (def: (map f) @@ -41,7 +41,7 @@ (function (_ !) (f (fa !)))))) -(struct: #export Apply<Thread> +(structure: #export Apply<Thread> (All [!] (Apply (Thread !))) (def: functor Functor<Thread>) @@ -50,7 +50,7 @@ (function (_ !) ((ff !) (fa !))))) -(struct: #export Monad<Thread> +(structure: #export Monad<Thread> (All [!] (Monad (Thread !))) (def: functor Functor<Thread>) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index 3dcf64cc3..33b0df8a9 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -10,7 +10,7 @@ {#log l #value a}) -(struct: #export Functor<Writer> +(structure: #export Functor<Writer> (All [l] (F.Functor (Writer l))) @@ -18,7 +18,7 @@ (let [[log datum] fa] [log (f datum)]))) -(struct: #export (Apply<Writer> mon) +(structure: #export (Apply<Writer> mon) (All [l] (-> (Monoid l) (A.Apply (Writer l)))) @@ -29,7 +29,7 @@ [log2 a] fa] [(:: mon compose log1 log2) (f a)]))) -(struct: #export (Monad<Writer> mon) +(structure: #export (Monad<Writer> mon) (All [l] (-> (Monoid l) (Monad (Writer l)))) @@ -47,7 +47,7 @@ (All [l] (-> l (Writer l Any))) [l []]) -(struct: #export (WriterT Monoid<l> Monad<M>) +(structure: #export (WriterT Monoid<l> Monad<M>) (All [l M] (-> (Monoid l) (Monad M) (Monad (All [a] (M (Writer l a)))))) (def: functor (F.compose (get@ #monad.functor Monad<M>) Functor<Writer>)) diff --git a/stdlib/source/lux/data/bool.lux b/stdlib/source/lux/data/bool.lux index 88c1011e5..eee9de319 100644 --- a/stdlib/source/lux/data/bool.lux +++ b/stdlib/source/lux/data/bool.lux @@ -7,13 +7,13 @@ function)) ## [Structures] -(struct: #export _ (Equivalence Bool) +(structure: #export _ (Equivalence Bool) (def: (= x y) (if x y (not y)))) -(struct: #export _ (Hash Bool) +(structure: #export _ (Hash Bool) (def: eq Equivalence<Bool>) (def: (hash value) (case value @@ -21,7 +21,7 @@ false +0))) (do-template [<name> <identity> <op>] - [(struct: #export <name> (Monoid Bool) + [(structure: #export <name> (Monoid Bool) (def: identity <identity>) (def: (compose x y) (<op> x y)))] @@ -30,7 +30,7 @@ [And@Monoid<Bool> true and] ) -(struct: #export _ (Codec Text Bool) +(structure: #export _ (Codec Text Bool) (def: (encode x) (if x "true" diff --git a/stdlib/source/lux/data/coll/array.lux b/stdlib/source/lux/data/coll/array.lux index 8f3bee0c3..842acec39 100644 --- a/stdlib/source/lux/data/coll/array.lux +++ b/stdlib/source/lux/data/coll/array.lux @@ -149,7 +149,7 @@ #.None output))))) -(struct: #export (Equivalence<Array> Equivalence<a>) +(structure: #export (Equivalence<Array> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Array a)))) (def: (= xs ys) (let [sxs (size xs) @@ -170,7 +170,7 @@ (list.n/range +0 (dec sxs))))) )) -(struct: #export Monoid<Array> (All [a] (Monoid (Array a))) +(structure: #export Monoid<Array> (All [a] (Monoid (Array a))) (def: identity (new +0)) (def: (compose xs ys) @@ -180,7 +180,7 @@ (copy sxs +0 xs +0) (copy sxy +0 ys sxs))))) -(struct: #export _ (Functor Array) +(structure: #export _ (Functor Array) (def: (map f ma) (let [arr-size (size ma)] (if (n/= +0 arr-size) @@ -196,7 +196,7 @@ (list.n/range +0 (dec arr-size))) )))) -(struct: #export _ (Fold Array) +(structure: #export _ (Fold Array) (def: (fold f init xs) (let [arr-size (size xs)] (loop [so-far init diff --git a/stdlib/source/lux/data/coll/bits.lux b/stdlib/source/lux/data/coll/bits.lux index 94d3398a0..426f830d2 100644 --- a/stdlib/source/lux/data/coll/bits.lux +++ b/stdlib/source/lux/data/coll/bits.lux @@ -151,7 +151,7 @@ [xor bit.xor] ) -(struct: #export _ (Equivalence Bits) +(structure: #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 6fbcb5a42..5c616fa0b 100644 --- a/stdlib/source/lux/data/coll/dictionary/ordered.lux +++ b/stdlib/source/lux/data/coll/dictionary/ordered.lux @@ -551,7 +551,7 @@ [values v (get@ #value node')] ) -(struct: #export (Equivalence<Dict> Equivalence<v>) (All [k v] (-> (Equivalence v) (Equivalence (Dict k v)))) +(structure: #export (Equivalence<Dict> Equivalence<v>) (All [k v] (-> (Equivalence v) (Equivalence (Dict k v)))) (def: (= reference sample) (let [Equivalence<k> (:: sample eq)] (loop [entriesR (entries reference) diff --git a/stdlib/source/lux/data/coll/dictionary/unordered.lux b/stdlib/source/lux/data/coll/dictionary/unordered.lux index bb6d12b24..61d21b425 100644 --- a/stdlib/source/lux/data/coll/dictionary/unordered.lux +++ b/stdlib/source/lux/data/coll/dictionary/unordered.lux @@ -671,7 +671,7 @@ keys))) ## [Structures] -(struct: #export (Equivalence<Dict> Equivalence<v>) (All [k v] (-> (Equivalence v) (Equivalence (Dict k v)))) +(structure: #export (Equivalence<Dict> Equivalence<v>) (All [k v] (-> (Equivalence v) (Equivalence (Dict k v)))) (def: (= test subject) (and (n/= (size test) (size subject)) diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index 4049fce8e..74ef2e5cc 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -16,7 +16,7 @@ ## (#Cons a (List a))) ## [Functions] -(struct: #export _ (fold.Fold List) +(structure: #export _ (fold.Fold List) (def: (fold f init xs) (case xs #.Nil @@ -265,7 +265,7 @@ (nth (dec i) xs')))) ## [Structures] -(struct: #export (Equivalence<List> Equivalence<a>) +(structure: #export (Equivalence<List> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (List a)))) (def: (= xs ys) (case [xs ys] @@ -280,7 +280,7 @@ false ))) -(struct: #export Monoid<List> (All [a] +(structure: #export Monoid<List> (All [a] (Monoid (List a))) (def: identity #.Nil) (def: (compose xs ys) @@ -290,7 +290,7 @@ (open: Monoid<List>) -(struct: #export _ (Functor List) +(structure: #export _ (Functor List) (def: (map f ma) (case ma #.Nil #.Nil @@ -298,7 +298,7 @@ (open: Functor<List>) -(struct: #export _ (Apply List) +(structure: #export _ (Apply List) (def: functor Functor<List>) (def: (apply ff fa) @@ -309,7 +309,7 @@ (#.Cons f ff') (compose (map f fa) (apply ff' fa))))) -(struct: #export _ (Monad List) +(structure: #export _ (Monad List) (def: functor Functor<List>) (def: (wrap a) @@ -511,7 +511,7 @@ (All [a] (-> (List (List a)) (List a))) (:: Monad<List> join xss)) -(struct: #export (ListT Monad<M>) +(structure: #export (ListT Monad<M>) (All [M] (-> (Monad M) (Monad (All [a] (M (List a)))))) (def: functor (functor.compose (get@ #monad.functor Monad<M>) Functor<List>)) diff --git a/stdlib/source/lux/data/coll/queue.lux b/stdlib/source/lux/data/coll/queue.lux index 490351d29..3b144a52a 100644 --- a/stdlib/source/lux/data/coll/queue.lux +++ b/stdlib/source/lux/data/coll/queue.lux @@ -67,12 +67,12 @@ _ (update@ #rear (|>> (#.Cons val)) queue))) -(struct: #export (Equivalence<Queue> Equivalence<a>) +(structure: #export (Equivalence<Queue> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Queue a)))) (def: (= qx qy) (:: (list.Equivalence<List> Equivalence<a>) = (to-list qx) (to-list qy)))) -(struct: #export _ (F.Functor Queue) +(structure: #export _ (F.Functor Queue) (def: (map f fa) {#front (|> fa (get@ #front) (L/map f)) #rear (|> fa (get@ #rear) (L/map f))})) diff --git a/stdlib/source/lux/data/coll/row.lux b/stdlib/source/lux/data/coll/row.lux index 2c50120ec..1d4dc648c 100644 --- a/stdlib/source/lux/data/coll/row.lux +++ b/stdlib/source/lux/data/coll/row.lux @@ -343,7 +343,7 @@ (wrap (list (` (from-list (list (~+ elems))))))) ## [Structures] -(struct: #export (Equivalence<Node> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Node a)))) +(structure: #export (Equivalence<Node> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Node a)))) (def: (= v1 v2) (case [v1 v2] [(#Base b1) (#Base b2)] @@ -355,7 +355,7 @@ _ false))) -(struct: #export (Equivalence<Row> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Row a)))) +(structure: #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/") (Equivalence<Node> Equivalence<a>)] @@ -364,7 +364,7 @@ (Node/= (#Hierarchy (get@ #root v1)) (#Hierarchy (get@ #root v2)))))))) -(struct: _ (Fold Node) +(structure: _ (Fold Node) (def: (fold f init xs) (case xs (#Base base) @@ -376,7 +376,7 @@ hierarchy)) )) -(struct: #export _ (Fold Row) +(structure: #export _ (Fold Row) (def: (fold f init xs) (let [(^open) Fold<Node>] (fold f @@ -386,12 +386,12 @@ (#Base (get@ #tail xs)))) )) -(struct: #export Monoid<Row> (All [a] (Monoid (Row a))) +(structure: #export Monoid<Row> (All [a] (Monoid (Row a))) (def: identity empty) (def: (compose xs ys) (list/fold add xs (to-list ys)))) -(struct: _ (Functor Node) +(structure: _ (Functor Node) (def: (map f xs) (case xs (#Base base) @@ -401,7 +401,7 @@ (#Hierarchy (array/map (map f) hierarchy))) )) -(struct: #export _ (Functor Row) +(structure: #export _ (Functor Row) (def: (map f xs) {#level (get@ #level xs) #size (get@ #size xs) @@ -409,7 +409,7 @@ #tail (|> xs (get@ #tail) (array/map f)) })) -(struct: #export _ (Apply Row) +(structure: #export _ (Apply Row) (def: functor Functor<Row>) (def: (apply ff fa) @@ -420,7 +420,7 @@ ff)] (fold compose identity results)))) -(struct: #export _ (Monad Row) +(structure: #export _ (Monad Row) (def: functor Functor<Row>) (def: wrap (|>> row)) diff --git a/stdlib/source/lux/data/coll/sequence.lux b/stdlib/source/lux/data/coll/sequence.lux index b8908403b..ab8f1d625 100644 --- a/stdlib/source/lux/data/coll/sequence.lux +++ b/stdlib/source/lux/data/coll/sequence.lux @@ -117,12 +117,12 @@ [(filter p xs) (filter (complement p) xs)]) ## [Structures] -(struct: #export _ (Functor Sequence) +(structure: #export _ (Functor Sequence) (def: (map f fa) (let [[h t] (continuation.run fa)] (pending [(f h) (map f t)])))) -(struct: #export _ (CoMonad Sequence) +(structure: #export _ (CoMonad Sequence) (def: functor Functor<Sequence>) (def: unwrap head) (def: (split wa) diff --git a/stdlib/source/lux/data/coll/set/ordered.lux b/stdlib/source/lux/data/coll/set/ordered.lux index 0862d62c2..45a6b0cb0 100644 --- a/stdlib/source/lux/data/coll/set/ordered.lux +++ b/stdlib/source/lux/data/coll/set/ordered.lux @@ -80,7 +80,7 @@ (All [a] (-> (Set a) (Set a) Bool)) (sub? super sub)) -(struct: #export Equivalence<Set> (All [a] (Equivalence (Set a))) +(structure: #export Equivalence<Set> (All [a] (Equivalence (Set a))) (def: (= reference sample) (:: (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 4fcc0c1cc..6f0007412 100644 --- a/stdlib/source/lux/data/coll/set/unordered.lux +++ b/stdlib/source/lux/data/coll/set/unordered.lux @@ -63,11 +63,11 @@ (sub? super sub)) ## [Structures] -(struct: #export Equivalence<Set> (All [a] (Equivalence (Set a))) +(structure: #export Equivalence<Set> (All [a] (Equivalence (Set a))) (def: (= (^@ test [Hash<a> _]) subject) (:: (list.Equivalence<List> (get@ #hash.eq Hash<a>)) = (to-list test) (to-list subject)))) -(struct: #export Hash<Set> (All [a] (Hash (Set a))) +(structure: #export Hash<Set> (All [a] (Hash (Set a))) (def: eq Equivalence<Set>) (def: (hash (^@ set [Hash<a> _])) diff --git a/stdlib/source/lux/data/coll/tree/rose.lux b/stdlib/source/lux/data/coll/tree/rose.lux index 8171dcdaa..1fb5fc85a 100644 --- a/stdlib/source/lux/data/coll/tree/rose.lux +++ b/stdlib/source/lux/data/coll/tree/rose.lux @@ -54,18 +54,18 @@ #children (list (~+ (L/map recur children)))}))))))) ## [Structs] -(struct: #export (Equivalence<Tree> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Tree a)))) +(structure: #export (Equivalence<Tree> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Tree a)))) (def: (= tx 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) +(structure: #export _ (Functor Tree) (def: (map f fa) {#value (f (get@ #value fa)) #children (L/map (map f) (get@ #children fa))})) -(struct: #export _ (Fold Tree) +(structure: #export _ (Fold Tree) (def: (fold f init tree) (L/fold (function (_ tree' init') (fold f init' tree')) (f (get@ #value tree) diff --git a/stdlib/source/lux/data/coll/tree/rose/zipper.lux b/stdlib/source/lux/data/coll/tree/rose/zipper.lux index 845dd4c4c..ba47b9f0a 100644 --- a/stdlib/source/lux/data/coll/tree/rose/zipper.lux +++ b/stdlib/source/lux/data/coll/tree/rose/zipper.lux @@ -211,7 +211,7 @@ [insert-right #rights] ) -(struct: #export _ (Functor Zipper) +(structure: #export _ (Functor Zipper) (def: (map f fa) {#parent (|> fa (get@ #parent) (M/map (map f))) #lefts (|> fa (get@ #lefts) (L/map (T/map f))) @@ -219,7 +219,7 @@ #node (T/map f (get@ #node fa))})) ## TODO: Add again once new-luxc becomes the standard compiler. -## (struct: #export _ (CoMonad Zipper) +## (structure: #export _ (CoMonad Zipper) ## (def: functor Functor<Zipper>) ## (def: unwrap (get@ [#node #rose.value])) diff --git a/stdlib/source/lux/data/color.lux b/stdlib/source/lux/data/color.lux index 67c9c3388..7a23be703 100644 --- a/stdlib/source/lux/data/color.lux +++ b/stdlib/source/lux/data/color.lux @@ -33,7 +33,7 @@ (-> Color [Nat Nat Nat]) (|>> :representation)) - (struct: #export _ (eq.Equivalence Color) + (structure: #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/env.lux b/stdlib/source/lux/data/env.lux index 880bfa621..68d0affc0 100644 --- a/stdlib/source/lux/data/env.lux +++ b/stdlib/source/lux/data/env.lux @@ -7,11 +7,11 @@ {#env e #value a}) -(struct: #export Functor<Env> (All [e] (F.Functor (Env e))) +(structure: #export Functor<Env> (All [e] (F.Functor (Env e))) (def: (map f fa) (update@ #value f fa))) -(struct: #export CoMonad<Env> (All [e] (CoMonad (Env e))) +(structure: #export CoMonad<Env> (All [e] (CoMonad (Env e))) (def: functor Functor<Env>) (def: unwrap (get@ #value)) diff --git a/stdlib/source/lux/data/error.lux b/stdlib/source/lux/data/error.lux index 5e7f07601..6e9f12cb0 100644 --- a/stdlib/source/lux/data/error.lux +++ b/stdlib/source/lux/data/error.lux @@ -10,13 +10,13 @@ (#Success a)) ## [Structures] -(struct: #export _ (F.Functor Error) +(structure: #export _ (F.Functor Error) (def: (map f ma) (case ma (#Error msg) (#Error msg) (#Success datum) (#Success (f datum))))) -(struct: #export _ (A.Apply Error) +(structure: #export _ (A.Apply Error) (def: functor Functor<Error>) (def: (apply ff fa) @@ -33,7 +33,7 @@ (#Error msg)) )) -(struct: #export _ (Monad Error) +(structure: #export _ (Monad Error) (def: functor Functor<Error>) (def: (wrap a) @@ -44,7 +44,7 @@ (#Error msg) (#Error msg) (#Success ma) ma))) -(struct: #export (ErrorT Monad<M>) +(structure: #export (ErrorT Monad<M>) (All [M] (-> (Monad M) (Monad (All [a] (M (Error a)))))) (def: functor (F.compose (get@ #M.functor Monad<M>) Functor<Error>)) diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 984fbb1aa..01652968f 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -147,7 +147,7 @@ [get-object #Object Object "objects"] ) -(struct: #export _ (Equivalence JSON) +(structure: #export _ (Equivalence JSON) (def: (= x y) (case [x y] [#Null #Null] @@ -495,6 +495,6 @@ (-> Any (l.Lexer JSON)) ($_ p.alt null~ boolean~ number~ string~ (array~ json~') (object~ json~'))) -(struct: #export _ (Codec Text JSON) +(structure: #export _ (Codec Text JSON) (def: encode show-json) (def: decode (function (_ input) (l.run input (json~' []))))) diff --git a/stdlib/source/lux/data/format/xml.lux b/stdlib/source/lux/data/format/xml.lux index 7d1614fca..ddfb06249 100644 --- a/stdlib/source/lux/data/format/xml.lux +++ b/stdlib/source/lux/data/format/xml.lux @@ -220,11 +220,11 @@ (text.join-with "")) "</" tag ">"))))))) -(struct: #export _ (Codec Text XML) +(structure: #export _ (Codec Text XML) (def: encode write) (def: decode read)) -(struct: #export _ (Equivalence XML) +(structure: #export _ (Equivalence XML) (def: (= reference sample) (case [reference sample] [(#Text reference/value) (#Text sample/value)] diff --git a/stdlib/source/lux/data/ident.lux b/stdlib/source/lux/data/ident.lux index cb0b35b1f..f75b89ab8 100644 --- a/stdlib/source/lux/data/ident.lux +++ b/stdlib/source/lux/data/ident.lux @@ -20,12 +20,12 @@ ) ## [Structures] -(struct: #export _ (Equivalence Ident) +(structure: #export _ (Equivalence Ident) (def: (= [xmodule xname] [ymodule yname]) (and (text/= xmodule ymodule) (text/= xname yname)))) -(struct: #export _ (Codec Text Ident) +(structure: #export _ (Codec Text Ident) (def: (encode [module name]) (case module "" name @@ -44,7 +44,7 @@ _ (#.Left (text/compose "Invalid format for Ident: " input)))))) -(struct: #export _ (Hash Ident) +(structure: #export _ (Hash Ident) (def: eq Equivalence<Ident>) (def: (hash [module name]) diff --git a/stdlib/source/lux/data/identity.lux b/stdlib/source/lux/data/identity.lux index b14658619..969b89e4d 100644 --- a/stdlib/source/lux/data/identity.lux +++ b/stdlib/source/lux/data/identity.lux @@ -10,20 +10,20 @@ a) ## [Structures] -(struct: #export _ (F.Functor Identity) +(structure: #export _ (F.Functor Identity) (def: map id)) -(struct: #export _ (A.Apply Identity) +(structure: #export _ (A.Apply Identity) (def: functor Functor<Identity>) (def: (apply ff fa) (ff fa))) -(struct: #export _ (Monad Identity) +(structure: #export _ (Monad Identity) (def: functor Functor<Identity>) (def: wrap id) (def: join id)) -(struct: #export _ (CoMonad Identity) +(structure: #export _ (CoMonad Identity) (def: functor Functor<Identity>) (def: unwrap id) (def: split id)) diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index 94932a497..5a7228935 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -33,16 +33,16 @@ (with-gensyms [g!_] (wrap (list (` ((~! freeze') (function ((~ g!_) (~ g!_)) (~ expr)))))))) -(struct: #export _ (Functor Lazy) +(structure: #export _ (Functor Lazy) (def: (map f fa) (freeze (f (thaw fa))))) -(struct: #export _ (Apply Lazy) +(structure: #export _ (Apply Lazy) (def: functor Functor<Lazy>) (def: (apply ff fa) (freeze ((thaw ff) (thaw fa))))) -(struct: #export _ (Monad Lazy) +(structure: #export _ (Monad Lazy) (def: functor Functor<Lazy>) (def: wrap (|>> freeze)) (def: join thaw)) diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index bfdb0fbe5..dfc2a557b 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -12,20 +12,20 @@ ## (#.Some a)) ## [Structures] -(struct: #export Monoid<Maybe> (All [a] (m.Monoid (Maybe a))) +(structure: #export Monoid<Maybe> (All [a] (m.Monoid (Maybe a))) (def: identity #.None) (def: (compose xs ys) (case xs #.None ys (#.Some x) (#.Some x)))) -(struct: #export _ (F.Functor Maybe) +(structure: #export _ (F.Functor Maybe) (def: (map f ma) (case ma #.None #.None (#.Some a) (#.Some (f a))))) -(struct: #export _ (A.Apply Maybe) +(structure: #export _ (A.Apply Maybe) (def: functor Functor<Maybe>) (def: (apply ff fa) @@ -36,7 +36,7 @@ _ #.None))) -(struct: #export _ (Monad Maybe) +(structure: #export _ (Monad Maybe) (def: functor Functor<Maybe>) (def: (wrap x) @@ -47,7 +47,7 @@ #.None #.None (#.Some xs) xs))) -(struct: #export (Equivalence<Maybe> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Maybe a)))) +(structure: #export (Equivalence<Maybe> Equivalence<a>) (All [a] (-> (Equivalence a) (Equivalence (Maybe a)))) (def: (= mx my) (case [mx my] [#.None #.None] @@ -59,7 +59,7 @@ _ false))) -(struct: #export (MaybeT Monad<M>) +(structure: #export (MaybeT Monad<M>) (All [M] (-> (Monad M) (Monad (All [a] (M (Maybe a)))))) (def: functor (F.compose (get@ #monad.functor Monad<M>) Functor<Maybe>)) diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index 637d0d0ba..5a32e6ada 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -14,7 +14,7 @@ ## [Structures] (do-template [<type> <test>] - [(struct: #export _ (Equivalence <type>) + [(structure: #export _ (Equivalence <type>) (def: = <test>))] [ Nat n/=] @@ -24,7 +24,7 @@ ) (do-template [<type> <eq> <lt> <lte> <gt> <gte>] - [(struct: #export _ (order.Order <type>) + [(structure: #export _ (order.Order <type>) (def: eq <eq>) (def: < <lt>) (def: <= <lte>) @@ -37,7 +37,7 @@ [Frac Equivalence<Frac> f/< f/<= f/> f/>=] ) -(struct: #export _ (Number Nat) +(structure: #export _ (Number Nat) (def: + n/+) (def: - n/-) (def: * n/*) @@ -52,7 +52,7 @@ ) (do-template [<type> <order> <+> <-> <*> </> <%> <=> <<> <0> <1> <-1>] - [(struct: #export _ (Number <type>) + [(structure: #export _ (Number <type>) (def: + <+>) (def: - <->) (def: * <*>) @@ -74,7 +74,7 @@ [Frac Order<Frac> f/+ f/- f/* f// f/% f/= f/< 0.0 1.0 -1.0] ) -(struct: #export _ (Number Rev) +(structure: #export _ (Number Rev) (def: + r/+) (def: - r/-) (def: * r/*) @@ -86,7 +86,7 @@ (:coerce Rev -1))) (do-template [<type> <order> <succ> <pred>] - [(struct: #export _ (Enum <type>) + [(structure: #export _ (Enum <type>) (def: order <order>) (def: succ <succ>) (def: pred <pred>))] @@ -98,7 +98,7 @@ ) (do-template [<type> <enum> <top> <bottom>] - [(struct: #export _ (Interval <type>) + [(structure: #export _ (Interval <type>) (def: enum <enum>) (def: top <top>) (def: bottom <bottom>))] @@ -110,7 +110,7 @@ ) (do-template [<name> <type> <identity> <compose>] - [(struct: #export <name> (Monoid <type>) + [(structure: #export <name> (Monoid <type>) (def: identity <identity>) (def: compose <compose>))] @@ -155,7 +155,7 @@ (f/= negative-infinity value)))) (do-template [<type> <encoder> <decoder> <error>] - [(struct: #export _ (Codec Text <type>) + [(structure: #export _ (Codec Text <type>) (def: (encode x) (<encoder> [x])) @@ -288,7 +288,7 @@ _ #.None)) (do-template [<struct> <base> <to-character> <to-value> <error>] - [(struct: #export <struct> (Codec Text Nat) + [(structure: #export <struct> (Codec Text Nat) (def: (encode value) (loop [input value output ""] @@ -328,7 +328,7 @@ ) (do-template [<struct> <base> <to-character> <to-value> <error>] - [(struct: #export <struct> (Codec Text Int) + [(structure: #export <struct> (Codec Text Int) (def: (encode value) (if (i/= 0 value) "0" @@ -379,7 +379,7 @@ (maybe.assume ("lux text clip" input +1 ("lux text size" input)))) (do-template [<struct> <nat> <char-bit-size> <error>] - [(struct: #export <struct> (Codec Text Rev) + [(structure: #export <struct> (Codec Text Rev) (def: (encode value) (let [raw-output (de-prefix (:: <nat> encode (:coerce Nat value))) max-num-chars (n// <char-bit-size> +64) @@ -412,7 +412,7 @@ ) (do-template [<struct> <int> <base> <char-set> <error>] - [(struct: #export <struct> (Codec Text Frac) + [(structure: #export <struct> (Codec Text Frac) (def: (encode value) (let [whole (frac-to-int value) whole-part (:: <int> encode whole) @@ -602,7 +602,7 @@ ) (do-template [<struct> <error> <from> <to>] - [(struct: #export <struct> (Codec Text Frac) + [(structure: #export <struct> (Codec Text Frac) (def: (encode value) (let [sign (:: Number<Frac> signum value) raw-bin (:: Binary@Codec<Text,Frac> encode value) @@ -853,7 +853,7 @@ (digits-sub-once! idx (digits-get idx param) output)) output))) -(struct: #export _ (Codec Text Rev) +(structure: #export _ (Codec Text Rev) (def: (encode input) (let [input (:coerce Nat input) last-idx (dec bit.width)] @@ -994,19 +994,19 @@ (f/* -1.0 shifted)))))) ## [Hash] -(struct: #export _ (Hash Nat) +(structure: #export _ (Hash Nat) (def: eq Equivalence<Nat>) (def: hash id)) -(struct: #export _ (Hash Int) +(structure: #export _ (Hash Int) (def: eq Equivalence<Int>) (def: hash .nat)) -(struct: #export _ (Hash Frac) +(structure: #export _ (Hash Frac) (def: eq Equivalence<Frac>) (def: hash frac-to-bits)) -(struct: #export _ (Hash Rev) +(structure: #export _ (Hash 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 a7e535f08..91a10fd59 100644 --- a/stdlib/source/lux/data/number/complex.lux +++ b/stdlib/source/lux/data/number/complex.lux @@ -56,7 +56,7 @@ [- f/-] ) -(struct: #export _ (Equivalence Complex) +(structure: #export _ (Equivalence Complex) (def: = ..=)) (def: #export negate @@ -187,7 +187,7 @@ (frac/abs real)))) )))) -(struct: #export _ (Number Complex) +(structure: #export _ (Number Complex) (def: + ..+) (def: - ..-) (def: * ..*) diff --git a/stdlib/source/lux/data/number/ratio.lux b/stdlib/source/lux/data/number/ratio.lux index c96c66882..b23128348 100644 --- a/stdlib/source/lux/data/number/ratio.lux +++ b/stdlib/source/lux/data/number/ratio.lux @@ -100,17 +100,17 @@ [max >] ) -(struct: #export _ (Equivalence Ratio) +(structure: #export _ (Equivalence Ratio) (def: = ..=)) -(struct: #export _ (order.Order Ratio) +(structure: #export _ (order.Order Ratio) (def: eq Equivalence<Ratio>) (def: < ..<) (def: <= ..<=) (def: > ..>) (def: >= ..>=)) -(struct: #export _ (Number Ratio) +(structure: #export _ (Number Ratio) (def: + ..+) (def: - ..-) (def: * ..*) @@ -134,7 +134,7 @@ (-> Text (E.Error Nat)) (|>> (format "+") nat/decode)) -(struct: #export _ (Codec Text Ratio) +(structure: #export _ (Codec Text Ratio) (def: (encode (^slots [#numerator #denominator])) ($_ text/compose (part-encode numerator) separator (part-encode denominator))) diff --git a/stdlib/source/lux/data/store.lux b/stdlib/source/lux/data/store.lux index 06b1315a2..96e4988b3 100644 --- a/stdlib/source/lux/data/store.lux +++ b/stdlib/source/lux/data/store.lux @@ -13,13 +13,13 @@ {#cursor (get@ #cursor wa) #peek (function (_ s) (f (set@ #cursor s wa)))}) -(struct: #export Functor<Store> (All [s] (F.Functor (Store s))) +(structure: #export Functor<Store> (All [s] (F.Functor (Store s))) (def: (map f fa) (extend (function (_ store) (f (:: store peek (:: store cursor)))) fa))) -(struct: #export CoMonad<Store> (All [s] (CoMonad (Store s))) +(structure: #export CoMonad<Store> (All [s] (CoMonad (Store s))) (def: functor Functor<Store>) (def: (unwrap wa) (::: peek (::: cursor))) diff --git a/stdlib/source/lux/data/text.lux b/stdlib/source/lux/data/text.lux index 04af675c4..d09b713c9 100644 --- a/stdlib/source/lux/data/text.lux +++ b/stdlib/source/lux/data/text.lux @@ -123,11 +123,11 @@ (split-all-with "\n")) ## [Structures] -(struct: #export _ (Equivalence Text) +(structure: #export _ (Equivalence Text) (def: (= test subject) ("lux text =" subject test))) -(struct: #export _ (order.Order Text) +(structure: #export _ (order.Order Text) (def: eq Equivalence<Text>) (def: (< test subject) @@ -145,7 +145,7 @@ ("lux text =" test subject))) ) -(struct: #export _ (Monoid Text) +(structure: #export _ (Monoid Text) (def: identity "") (def: (compose left right) ("lux text concat" left right))) @@ -166,7 +166,7 @@ )] ($_ text/compose "\"" escaped "\""))) -(struct: #export _ (Hash Text) +(structure: #export _ (Hash Text) (def: eq Equivalence<Text>) (def: (hash input) diff --git a/stdlib/source/lux/data/text/unicode.lux b/stdlib/source/lux/data/text/unicode.lux index 6f76d053b..e00f23e84 100644 --- a/stdlib/source/lux/data/text/unicode.lux +++ b/stdlib/source/lux/data/text/unicode.lux @@ -15,7 +15,7 @@ (def: empty (:abstraction (interval.between number.Enum<Nat> nat/top nat/bottom))) - (struct: _ (Monoid Segment) + (structure: _ (Monoid Segment) (def: identity ..empty) (def: (compose left right) (let [left (:representation left) diff --git a/stdlib/source/lux/data/trace.lux b/stdlib/source/lux/data/trace.lux index 5bd37bbca..9958d94be 100644 --- a/stdlib/source/lux/data/trace.lux +++ b/stdlib/source/lux/data/trace.lux @@ -9,11 +9,11 @@ {#monoid (Monoid t) #trace (-> t a)}) -(struct: #export Functor<Trace> (All [t] (Functor (Trace t))) +(structure: #export Functor<Trace> (All [t] (Functor (Trace t))) (def: (map f fa) (update@ #trace (compose f) fa))) -(struct: #export CoMonad<Trace> (All [t] (CoMonad (Trace t))) +(structure: #export CoMonad<Trace> (All [t] (CoMonad (Trace t))) (def: functor Functor<Trace>) (def: (unwrap wa) diff --git a/stdlib/source/lux/function.lux b/stdlib/source/lux/function.lux index 919e19371..5c318eb78 100644 --- a/stdlib/source/lux/function.lux +++ b/stdlib/source/lux/function.lux @@ -19,6 +19,6 @@ (-> (-> a b c) (-> b a c))) (function (_ x y) (f y x))) -(struct: #export Monoid<Function> (All [a] (Monoid (-> a a))) +(structure: #export Monoid<Function> (All [a] (Monoid (-> a a))) (def: identity id) (def: compose ..compose)) diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index 726191aea..7579a1463 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -25,17 +25,17 @@ _ (#.Left "Wrong syntax for io"))) -(struct: #export _ (Functor IO) +(structure: #export _ (Functor IO) (def: (map f ma) (io (f (ma (:coerce Nothing [])))))) -(struct: #export _ (Apply IO) +(structure: #export _ (Apply IO) (def: functor Functor<IO>) (def: (apply ff fa) (io ((ff (:coerce Nothing [])) (fa (:coerce Nothing [])))))) -(struct: #export _ (Monad IO) +(structure: #export _ (Monad IO) (def: functor Functor<IO>) (def: (wrap x) @@ -57,17 +57,17 @@ (type: #export (Process a) (IO (Error a))) -(struct: #export _ (Functor Process) +(structure: #export _ (Functor Process) (def: (map f ma) (io (:: e.Functor<Error> map f (run ma))))) -(struct: #export _ (Apply Process) +(structure: #export _ (Apply Process) (def: functor Functor<Process>) (def: (apply ff fa) (io (:: e.Apply<Error> apply (run ff) (run fa))))) -(struct: #export _ (Monad Process) +(structure: #export _ (Monad Process) (def: functor Functor<Process>) (def: (wrap x) diff --git a/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux b/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux index c6a36e022..825a9e9df 100644 --- a/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux +++ b/stdlib/source/lux/lang/compiler/analysis/case/coverage.lux @@ -142,7 +142,7 @@ _ (list coverage))) -(struct: _ (Equivalence Coverage) +(structure: _ (Equivalence Coverage) (def: (= reference sample) (case [reference sample] [#Exhaustive #Exhaustive] diff --git a/stdlib/source/lux/lang/compiler/meta/archive.lux b/stdlib/source/lux/lang/compiler/meta/archive.lux index 371164ee4..fa3b91d7c 100644 --- a/stdlib/source/lux/lang/compiler/meta/archive.lux +++ b/stdlib/source/lux/lang/compiler/meta/archive.lux @@ -30,7 +30,7 @@ Signature - (struct: #export Equivalence<Key> + (structure: #export Equivalence<Key> (All [k] (Equivalence (Key k))) (def: (= reference sample) (:: Equivalence<Signature> = (:representation reference) (:representation sample)))) diff --git a/stdlib/source/lux/lang/reference.lux b/stdlib/source/lux/lang/reference.lux index c76f78d87..43c8f0d48 100644 --- a/stdlib/source/lux/lang/reference.lux +++ b/stdlib/source/lux/lang/reference.lux @@ -14,7 +14,7 @@ (#Variable Variable) (#Constant Ident)) -(struct: #export _ (Equivalence Variable) +(structure: #export _ (Equivalence Variable) (def: (= reference sample) (case [reference sample] (^template [<tag>] @@ -25,7 +25,7 @@ _ false))) -(struct: #export _ (Hash Variable) +(structure: #export _ (Hash Variable) (def: eq Equivalence<Variable>) (def: (hash var) (case var diff --git a/stdlib/source/lux/lang/type.lux b/stdlib/source/lux/lang/type.lux index 793d1c8be..8f3c2eb77 100644 --- a/stdlib/source/lux/lang/type.lux +++ b/stdlib/source/lux/lang/type.lux @@ -46,7 +46,7 @@ )) ## [Structures] -(struct: #export _ (Equivalence Type) +(structure: #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 5e6ab2714..ab1b6be1d 100644 --- a/stdlib/source/lux/lang/type/check.lux +++ b/stdlib/source/lux/lang/type/check.lux @@ -44,7 +44,7 @@ (type: #export Type-Vars (List [Var (Maybe Type)])) -(struct: #export _ (Functor Check) +(structure: #export _ (Functor Check) (def: (map f fa) (function (_ context) (case (fa context) @@ -55,7 +55,7 @@ (#e.Success [context' (f output)]) )))) -(struct: #export _ (Apply Check) +(structure: #export _ (Apply Check) (def: functor Functor<Check>) (def: (apply ff fa) @@ -74,7 +74,7 @@ ))) ) -(struct: #export _ (Monad Check) +(structure: #export _ (Monad Check) (def: functor Functor<Check>) (def: (wrap x) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index a8494f047..8aaa567ae 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -15,7 +15,7 @@ ## (type: (Meta a) ## (-> Lux (e.Error [Lux a]))) -(struct: #export _ (Functor Meta) +(structure: #export _ (Functor Meta) (def: (map f fa) (function (_ compiler) (case (fa compiler) @@ -25,7 +25,7 @@ (#e.Success [compiler' a]) (#e.Success [compiler' (f a)]))))) -(struct: #export _ (Apply Meta) +(structure: #export _ (Apply Meta) (def: functor Functor<Meta>) (def: (apply ff fa) @@ -42,7 +42,7 @@ (#e.Error msg) (#e.Error msg))))) -(struct: #export _ (Monad Meta) +(structure: #export _ (Monad Meta) (def: functor Functor<Meta>) (def: (wrap x) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index 1094d7e0e..42f575a57 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -56,7 +56,7 @@ [local-tag #.Tag "Produces a local tag (a tag with no module prefix)."]) ## [Structures] -(struct: #export _ (Equivalence Code) +(structure: #export _ (Equivalence Code) (def: (= x y) (case [x y] (^template [<tag> <eq>] diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index fd85087d7..2a708ee2e 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -43,7 +43,7 @@ (def: low-mask Nat (|> +1 (bit.left-shift +32) dec)) (def: high-mask Nat (|> low-mask (bit.left-shift +32))) -(struct: _ (Codec JSON Nat) +(structure: _ (Codec JSON Nat) (def: (encode input) (let [high (|> input (bit.and high-mask) (bit.logical-right-shift +32)) low (bit.and low-mask input)] @@ -58,7 +58,7 @@ (wrap (n/+ (|> high frac-to-int .nat (bit.left-shift +32)) (|> low frac-to-int .nat)))))) -(struct: _ (Codec JSON Int) +(structure: _ (Codec JSON Int) (def: encode (|>> .nat (:: Codec<JSON,Nat> encode))) (def: decode (|>> (:: Codec<JSON,Nat> decode) (:: e.Functor<Error> map .int)))) @@ -71,7 +71,7 @@ #.None #//.Null (#.Some value) (writer value)))) -(struct: Codec<JSON,Qty> +(structure: Codec<JSON,Qty> (All [unit] (Codec JSON (unit.Qty unit))) (def: encode (|>> unit.out (:: Codec<JSON,Int> encode))) diff --git a/stdlib/source/lux/math/modular.lux b/stdlib/source/lux/math/modular.lux index 01e02a706..15b7f5193 100644 --- a/stdlib/source/lux/math/modular.lux +++ b/stdlib/source/lux/math/modular.lux @@ -83,7 +83,7 @@ (def: separator Text " mod ") - (struct: #export (Codec<Text,Mod> modulus) + (structure: #export (Codec<Text,Mod> modulus) (All [m] (-> (Modulus m) (Codec Text (Mod m)))) (def: (encode modular) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 5e560ea01..198095bc8 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -31,13 +31,13 @@ {#.doc "A producer of random values based on a PRNG."} (-> PRNG [PRNG a])) -(struct: #export _ (Functor Random) +(structure: #export _ (Functor Random) (def: (map f fa) (function (_ state) (let [[state' a] (fa state)] [state' (f a)])))) -(struct: #export _ (Apply Random) +(structure: #export _ (Apply Random) (def: functor Functor<Random>) (def: (apply ff fa) @@ -46,7 +46,7 @@ [state'' a] (fa state')] [state'' (f a)])))) -(struct: #export _ (Monad Random) +(structure: #export _ (Monad Random) (def: functor Functor<Random>) (def: (wrap a) diff --git a/stdlib/source/lux/time/date.lux b/stdlib/source/lux/time/date.lux index f4680a6ca..38fc89800 100644 --- a/stdlib/source/lux/time/date.lux +++ b/stdlib/source/lux/time/date.lux @@ -29,7 +29,7 @@ #November #December) -(struct: #export _ (Equivalence Month) +(structure: #export _ (Equivalence Month) (def: (= reference sample) (case [reference sample] (^template [<tag>] @@ -67,7 +67,7 @@ #November +10 #December +11)) -(struct: #export _ (Order Month) +(structure: #export _ (Order Month) (def: eq Equivalence<Month>) (do-template [<name> <comp>] [(def: (<name> reference sample) @@ -79,7 +79,7 @@ [>= n/>=] )) -(struct: #export _ (Enum Month) +(structure: #export _ (Enum Month) (def: order Order<Month>) (def: (succ month) (case month @@ -119,7 +119,7 @@ #Friday #Saturday) -(struct: #export _ (Equivalence Day) +(structure: #export _ (Equivalence Day) (def: (= reference sample) (case [reference sample] (^template [<tag>] @@ -147,7 +147,7 @@ #Friday +5 #Saturday +6)) -(struct: #export _ (Order Day) +(structure: #export _ (Order Day) (def: eq Equivalence<Day>) (do-template [<name> <comp>] [(def: (<name> reference sample) @@ -159,7 +159,7 @@ [>= n/>=] )) -(struct: #export _ (Enum Day) +(structure: #export _ (Enum Day) (def: order Order<Day>) (def: (succ day) (case day @@ -185,7 +185,7 @@ #month Month #day Nat}) -(struct: #export _ (Equivalence Date) +(structure: #export _ (Equivalence Date) (def: (= reference sample) (and (i/= (get@ #year reference) (get@ #year sample)) @@ -205,7 +205,7 @@ (n/< (get@ #day reference) (get@ #day sample)))) -(struct: #export _ (Order Date) +(structure: #export _ (Order Date) (def: eq Equivalence<Date>) (def: < date/<) (def: (> reference sample) @@ -314,7 +314,7 @@ (-> Text (e.Error Date)) (l.run input lex-date)) -(struct: #export _ +(structure: #export _ {#.doc "Based on ISO 8601. For example: 2017-01-15"} diff --git a/stdlib/source/lux/time/duration.lux b/stdlib/source/lux/time/duration.lux index 5df655018..b38dfa977 100644 --- a/stdlib/source/lux/time/duration.lux +++ b/stdlib/source/lux/time/duration.lux @@ -41,11 +41,11 @@ (-> Duration Duration Int) (i// (:representation param) (:representation subject))) - (struct: #export _ (Equivalence Duration) + (structure: #export _ (Equivalence Duration) (def: (= param subject) (i/= (:representation param) (:representation subject)))) - (struct: #export _ (Order Duration) + (structure: #export _ (Order Duration) (def: eq Equivalence<Duration>) (do-template [<name> <op>] [(def: (<name> param subject) @@ -77,7 +77,7 @@ (def: #export normal-year Duration (scale 365 day)) (def: #export leap-year Duration (merge day normal-year)) -(struct: #export _ (Monoid Duration) +(structure: #export _ (Monoid Duration) (def: identity empty) (def: compose merge)) @@ -142,7 +142,7 @@ (-> Text (e.Error Duration)) (l.run input lex-duration)) -(struct: #export _ +(structure: #export _ {#.doc "For example: 15D21h14m51s827ms"} (Codec Text Duration) (def: encode encode) diff --git a/stdlib/source/lux/time/instant.lux b/stdlib/source/lux/time/instant.lux index 4f14555f9..88058868b 100644 --- a/stdlib/source/lux/time/instant.lux +++ b/stdlib/source/lux/time/instant.lux @@ -46,11 +46,11 @@ (-> duration.Duration Instant) (|> offset duration.to-millis :abstraction)) - (struct: #export _ (Equivalence Instant) + (structure: #export _ (Equivalence Instant) (def: (= param subject) (:: number.Equivalence<Int> = (:representation param) (:representation subject)))) - (struct: #export _ (Order Instant) + (structure: #export _ (Order Instant) (def: eq Equivalence<Instant>) (do-template [<name>] [(def: (<name> param subject) @@ -59,7 +59,7 @@ [<] [<=] [>] [>=] )) - (struct: #export _ (Enum Instant) + (structure: #export _ (Enum Instant) (def: order Order<Instant>) (do-template [<name>] [(def: <name> @@ -298,7 +298,7 @@ (-> Text (e.Error Instant)) (l.run input lex-instant)) -## (struct: #export _ +## (structure: #export _ ## {#.doc "Based on ISO 8601. ## For example: 2017-01-15T21:14:51.827Z"} diff --git a/stdlib/source/lux/type/object/interface.lux b/stdlib/source/lux/type/object/interface.lux index c2c54dd4f..e16a89f44 100644 --- a/stdlib/source/lux/type/object/interface.lux +++ b/stdlib/source/lux/type/object/interface.lux @@ -491,7 +491,7 @@ ((~ g!state) (~+ g!parameters)) (~ g!extension)])))))))) - (` (struct: (~+ (csw.export export)) (~ g!struct) + (` (structure: (~+ (csw.export export)) (~ g!struct) (All [(~+ g!parameters) (~ g!extension)] ((~ g!signature) (~+ interface-mappings) ((~ g!interface) (~+ interface-mappings) diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index ea86f45e8..7cac8b536 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -34,7 +34,7 @@ (All [keys] (Procedure monad [permissions keys] keys value))) -(struct: (IxMonad<Procedure> Monad<m>) +(structure: (IxMonad<Procedure> Monad<m>) (All [m] (-> (Monad m) (IxMonad (Procedure m)))) (def: (wrap value) diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index b487571e1..9a5c2d054 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -93,7 +93,7 @@ (wrap (list (` (type: (~+ (csw.export export)) ((~ g!scale) (~' u)) (~ (csw.annotations annotations)) (primitive (~ (code.text (scale-name name))) [(~' u)]))) - (` (struct: (~+ (csw.export export)) (~ (code.local-symbol (format "@" name))) + (` (structure: (~+ (csw.export export)) (~ (code.local-symbol (format "@" name))) (..Scale (~ g!scale)) (def: (~' scale) (|>> ..out @@ -156,11 +156,11 @@ (unit: #export Litre) (unit: #export Second) -(struct: #export Equivalence<Unit> (All [unit] (Equivalence (Qty unit))) +(structure: #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))) +(structure: #export Order<Unit> (All [unit] (Order (Qty unit))) (def: eq Equivalence<Unit>) (do-template [<name> <func>] @@ -172,7 +172,7 @@ [> i/>] [>= i/>=])) -(struct: #export Enum<Unit> (All [unit] (Enum (Qty unit))) +(structure: #export Enum<Unit> (All [unit] (Enum (Qty unit))) (def: order Order<Unit>) (def: succ (|>> ..out inc ..in)) (def: pred (|>> ..out dec ..in))) diff --git a/stdlib/source/lux/world/blob.jvm.lux b/stdlib/source/lux/world/blob.jvm.lux index 452dc9db5..67bfded53 100644 --- a/stdlib/source/lux/world/blob.jvm.lux +++ b/stdlib/source/lux/world/blob.jvm.lux @@ -143,7 +143,7 @@ (-> Nat Blob (Error Blob)) (slice from (dec (host.array-length blob)) blob)) -(struct: #export _ (eq.Equivalence Blob) +(structure: #export _ (eq.Equivalence Blob) (def: (= reference sample) (Arrays::equals [reference sample]))) diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux index 7afd12b4b..3e0a6c65e 100644 --- a/stdlib/source/lux/world/file.lux +++ b/stdlib/source/lux/world/file.lux @@ -130,7 +130,7 @@ (import: java/io/FileInputStream (new [java/io/File] #io #try)) - (struct: #export JVM@System (System Process) + (structure: #export JVM@System (System Process) (def: &monad io.Monad<Process>) (def: throw io.throw) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index e630b7a49..cb90b5df5 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -125,7 +125,7 @@ (derived: (poly/json.Codec<JSON,?> Record)) -(struct: _ (Equivalence Record) +(structure: _ (Equivalence Record) (def: (= recL recR) (let [variant/= (function (_ left right) (case [left right] |