diff options
author | Eduardo Julian | 2018-05-02 00:20:42 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-02 00:20:42 -0400 |
commit | 0144da58ba856bd6f6072b588bbd076c9c3fdb36 (patch) | |
tree | 19aa593327891ced4d28ef1fd0a3394c70ffa38d | |
parent | e4e67f0427d93b3686366ffe9f14a4751690101e (diff) |
- Re-named "Applicative" to "Apply".
37 files changed, 112 insertions, 113 deletions
diff --git a/stdlib/source/lux/concurrency/frp.lux b/stdlib/source/lux/concurrency/frp.lux index 93d3498d4..e160fec12 100644 --- a/stdlib/source/lux/concurrency/frp.lux +++ b/stdlib/source/lux/concurrency/frp.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad]) [io #+ IO io] (data (coll [list "list/" Monoid<List>])) @@ -103,7 +103,7 @@ input)) output)))) -(struct: #export _ (Applicative Channel) +(struct: #export _ (Apply Channel) (def: functor Functor<Channel>) (def: (apply ff fa) diff --git a/stdlib/source/lux/concurrency/promise.lux b/stdlib/source/lux/concurrency/promise.lux index 30895098f..0e3e0c695 100644 --- a/stdlib/source/lux/concurrency/promise.lux +++ b/stdlib/source/lux/concurrency/promise.lux @@ -3,7 +3,7 @@ (lux [io #+ IO io] [function] (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad]) (data [product]) (concurrency [atom #+ Atom atom]) @@ -79,7 +79,7 @@ fa) fb)))) -(struct: #export _ (Applicative Promise) +(struct: #export _ (Apply Promise) (def: functor Functor<Promise>) (def: (apply ff fa) diff --git a/stdlib/source/lux/concurrency/stm.lux b/stdlib/source/lux/concurrency/stm.lux index 6c86af772..707512821 100644 --- a/stdlib/source/lux/concurrency/stm.lux +++ b/stdlib/source/lux/concurrency/stm.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad]) [io #+ IO io] (data [product] @@ -133,7 +133,7 @@ (let [[tx' a] (fa tx)] [tx' (f a)])))) -(struct: #export _ (Applicative STM) +(struct: #export _ (Apply STM) (def: functor Functor<STM>) (def: (apply ff fa) diff --git a/stdlib/source/lux/concurrency/task.lux b/stdlib/source/lux/concurrency/task.lux index 1ebfa181c..0f95d428c 100644 --- a/stdlib/source/lux/concurrency/task.lux +++ b/stdlib/source/lux/concurrency/task.lux @@ -2,7 +2,7 @@ lux (lux (data ["E" error]) (control ["F" functor] - ["A" applicative] + ["A" apply] monad ["ex" exception #+ Exception]) (concurrency ["P" promise]) @@ -42,7 +42,7 @@ (#E.Success (f a)))) fa))) -(struct: #export _ (A.Applicative Task) +(struct: #export _ (A.Apply Task) (def: functor Functor<Task>) (def: (apply ff fa) diff --git a/stdlib/source/lux/control/applicative.lux b/stdlib/source/lux/control/applicative.lux deleted file mode 100644 index 2a926cc20..000000000 --- a/stdlib/source/lux/control/applicative.lux +++ /dev/null @@ -1,34 +0,0 @@ -(.module: - lux - (// [functor #+ Functor] - [monad #+ Monad])) - -(sig: #export (Applicative f) - {#.doc "Applicative functors."} - (: (Functor f) - functor) - (: (All [a b] - (-> (f (-> a b)) (f a) (f b))) - apply)) - -(struct: #export (compose Monad<F> Applicative<F> Applicative<G>) - {#.doc "Applicative functor composition."} - (All [F G] - (-> (Monad F) (Applicative F) (Applicative G) - (Applicative (All [a] (F (G a)))))) - - (def: functor (functor.compose (get@ #functor Applicative<F>) - (get@ #functor Applicative<G>))) - (def: (apply fgf fgx) - ## TODO: Switch from this version to the one below (in comments) ASAP. - (let [fgf' (:: Applicative<F> apply - (:: Monad<F> wrap (:: Applicative<G> apply)) - fgf)] - (:: Applicative<F> apply fgf' fgx)) - ## (let [applyF (:: Applicative<F> apply) - ## applyG (:: Applicative<G> apply)] - ## ($_ applyF - ## (:: Monad<F> wrap applyG) - ## fgf - ## fgx)) - )) diff --git a/stdlib/source/lux/control/apply.lux b/stdlib/source/lux/control/apply.lux new file mode 100644 index 000000000..eb9dbaf00 --- /dev/null +++ b/stdlib/source/lux/control/apply.lux @@ -0,0 +1,34 @@ +(.module: + lux + (// [functor #+ Functor] + [monad #+ Monad])) + +(sig: #export (Apply f) + {#.doc "Applicative functors."} + (: (Functor f) + functor) + (: (All [a b] + (-> (f (-> a b)) (f a) (f b))) + apply)) + +(struct: #export (compose Monad<F> Apply<F> Apply<G>) + {#.doc "Applicative functor composition."} + (All [F G] + (-> (Monad F) (Apply F) (Apply G) + (Apply (All [a] (F (G a)))))) + + (def: functor (functor.compose (get@ #functor Apply<F>) (get@ #functor Apply<G>))) + + (def: (apply fgf fgx) + ## TODO: Switch from this version to the one below (in comments) ASAP. + (let [fgf' (:: Apply<F> apply + (:: Monad<F> wrap (:: Apply<G> apply)) + fgf)] + (:: Apply<F> apply fgf' fgx)) + ## (let [applyF (:: Apply<F> apply) + ## applyG (:: Apply<G> apply)] + ## ($_ applyF + ## (:: Monad<F> wrap applyG) + ## fgf + ## fgx)) + )) diff --git a/stdlib/source/lux/control/continuation.lux b/stdlib/source/lux/control/continuation.lux index 2a145ae5a..d23ebec18 100644 --- a/stdlib/source/lux/control/continuation.lux +++ b/stdlib/source/lux/control/continuation.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] monad) function [macro #+ with-gensyms] @@ -26,7 +26,7 @@ (def: (map f fv) (function (_ k) (fv (compose k f))))) -(struct: #export Applicative<Cont> (All [o] (Applicative (All [i] (Cont i o)))) +(struct: #export Apply<Cont> (All [o] (Apply (All [i] (Cont i o)))) (def: functor Functor<Cont>) (def: (apply ff fv) diff --git a/stdlib/source/lux/control/monad/free.lux b/stdlib/source/lux/control/monad/free.lux index 7a41b3e9f..716ae805b 100644 --- a/stdlib/source/lux/control/monad/free.lux +++ b/stdlib/source/lux/control/monad/free.lux @@ -1,7 +1,7 @@ (.module: lux (/// [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ Monad])) (type: #export (Free F a) @@ -20,8 +20,8 @@ (#Effect value) (#Effect (:: dsl map (map f) value))))) -(struct: #export (Applicative<Free> dsl) - (All [F] (-> (Functor F) (Applicative (Free F)))) +(struct: #export (Apply<Free> dsl) + (All [F] (-> (Functor F) (Apply (Free F)))) (def: functor (Functor<Free> dsl)) diff --git a/stdlib/source/lux/control/parser.lux b/stdlib/source/lux/control/parser.lux index c4aaf35e3..d46b166e4 100644 --- a/stdlib/source/lux/control/parser.lux +++ b/stdlib/source/lux/control/parser.lux @@ -1,7 +1,7 @@ (.module: [lux #- not] (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad] [codec]) (data (coll [list "list/" Functor<List> Monoid<List>]) @@ -23,7 +23,7 @@ (#e.Success [input' a]) (#e.Success [input' (f a)]))))) -(struct: #export Applicative<Parser> (All [s] (Applicative (Parser s))) +(struct: #export Apply<Parser> (All [s] (Apply (Parser s))) (def: functor Functor<Parser>) (def: (apply ff fa) diff --git a/stdlib/source/lux/control/reader.lux b/stdlib/source/lux/control/reader.lux index fc2d6540b..228e474db 100644 --- a/stdlib/source/lux/control/reader.lux +++ b/stdlib/source/lux/control/reader.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control ["F" functor] - ["A" applicative] + ["A" apply] [monad #+ do Monad]))) ## [Types] @@ -17,8 +17,8 @@ (function (_ env) (f (fa env))))) -(struct: #export Applicative<Reader> - (All [r] (A.Applicative (Reader r))) +(struct: #export Apply<Reader> + (All [r] (A.Apply (Reader r))) (def: functor Functor<Reader>) diff --git a/stdlib/source/lux/control/region.lux b/stdlib/source/lux/control/region.lux index 1e2b4a47b..3729c00f2 100644 --- a/stdlib/source/lux/control/region.lux +++ b/stdlib/source/lux/control/region.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ Monad do] ["ex" exception #+ Exception exception:]) (data ["e" error #+ Error] @@ -80,10 +80,10 @@ (#e.Error error))]) (fa region+cleaners)))))) -(struct: #export (Applicative<Region> Monad<m>) +(struct: #export (Apply<Region> Monad<m>) (All [m] (-> (Monad m) - (All [r] (Applicative (Region r m))))) + (All [r] (Apply (Region r m))))) (def: functor (Functor<Region> (get@ #monad.functor Monad<m>))) diff --git a/stdlib/source/lux/control/state.lux b/stdlib/source/lux/control/state.lux index 86813bf69..422cf4fc6 100644 --- a/stdlib/source/lux/control/state.lux +++ b/stdlib/source/lux/control/state.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control ["F" functor] - ["A" applicative] + ["A" apply] [monad #+ do Monad]))) ## [Types] @@ -18,8 +18,8 @@ (let [[state' a] (ma state)] [state' (f a)])))) -(struct: #export Applicative<State> - (All [s] (A.Applicative (State s))) +(struct: #export Apply<State> + (All [s] (A.Apply (State s))) (def: functor Functor<State>) @@ -88,8 +88,8 @@ (:: Functor<M> map (function (_ [s a]) [s (f a)]) (sfa state))))) -(struct: (Applicative<StateT> Monad<M>) - (All [M s] (-> (Monad M) (A.Applicative (All [a] (-> s (M [s a])))))) +(struct: (Apply<StateT> Monad<M>) + (All [M s] (-> (Monad M) (A.Apply (All [a] (-> s (M [s a])))))) (def: functor (Functor<StateT> (:: Monad<M> functor))) diff --git a/stdlib/source/lux/control/thread.lux b/stdlib/source/lux/control/thread.lux index 9848ed5bc..d79cc0d10 100644 --- a/stdlib/source/lux/control/thread.lux +++ b/stdlib/source/lux/control/thread.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ Monad do]) [io #+ IO])) @@ -41,8 +41,8 @@ (function (_ !) (f (fa !)))))) -(struct: #export Applicative<Thread> - (All [!] (Applicative (Thread !))) +(struct: #export Apply<Thread> + (All [!] (Apply (Thread !))) (def: functor Functor<Thread>) diff --git a/stdlib/source/lux/control/writer.lux b/stdlib/source/lux/control/writer.lux index 5022620c8..c65a9b29e 100644 --- a/stdlib/source/lux/control/writer.lux +++ b/stdlib/source/lux/control/writer.lux @@ -2,7 +2,7 @@ lux (lux/control monoid ["F" functor] - ["A" applicative] + ["A" apply] [monad #+ do Monad])) (type: #export (Writer l a) @@ -18,9 +18,9 @@ (let [[log datum] fa] [log (f datum)]))) -(struct: #export (Applicative<Writer> mon) +(struct: #export (Apply<Writer> mon) (All [l] - (-> (Monoid l) (A.Applicative (Writer l)))) + (-> (Monoid l) (A.Apply (Writer l)))) (def: functor Functor<Writer>) diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index e558c592e..b9b743b2c 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -2,7 +2,7 @@ lux (lux (control [monoid #+ Monoid] [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad] [eq #+ Eq] [fold]) @@ -268,7 +268,7 @@ (open Functor<List>) -(struct: #export _ (Applicative List) +(struct: #export _ (Apply List) (def: functor Functor<List>) (def: (apply ff fa) diff --git a/stdlib/source/lux/data/coll/sequence.lux b/stdlib/source/lux/data/coll/sequence.lux index 0c3156f7f..b51e5034f 100644 --- a/stdlib/source/lux/data/coll/sequence.lux +++ b/stdlib/source/lux/data/coll/sequence.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad] [eq #+ Eq] monoid @@ -410,7 +410,7 @@ #tail (|> xs (get@ #tail) (array/map f)) })) -(struct: #export _ (Applicative Sequence) +(struct: #export _ (Apply Sequence) (def: functor Functor<Sequence>) (def: (apply ff fa) diff --git a/stdlib/source/lux/data/error.lux b/stdlib/source/lux/data/error.lux index 64cb5618e..5e7f07601 100644 --- a/stdlib/source/lux/data/error.lux +++ b/stdlib/source/lux/data/error.lux @@ -1,7 +1,7 @@ (.module: lux (lux (control ["F" functor] - ["A" applicative] + ["A" apply] ["M" monad #+ do Monad]))) ## [Types] @@ -16,7 +16,7 @@ (#Error msg) (#Error msg) (#Success datum) (#Success (f datum))))) -(struct: #export _ (A.Applicative Error) +(struct: #export _ (A.Apply Error) (def: functor Functor<Error>) (def: (apply ff fa) diff --git a/stdlib/source/lux/data/identity.lux b/stdlib/source/lux/data/identity.lux index 51198d11c..b14658619 100644 --- a/stdlib/source/lux/data/identity.lux +++ b/stdlib/source/lux/data/identity.lux @@ -1,7 +1,7 @@ (.module: lux (lux/control ["F" functor] - ["A" applicative] + ["A" apply] (monad #as M #refer #all) (comonad #as CM #refer #all))) @@ -13,7 +13,7 @@ (struct: #export _ (F.Functor Identity) (def: map id)) -(struct: #export _ (A.Applicative Identity) +(struct: #export _ (A.Apply Identity) (def: functor Functor<Identity>) (def: (apply ff fa) (ff fa))) diff --git a/stdlib/source/lux/data/lazy.lux b/stdlib/source/lux/data/lazy.lux index adcc1234e..fcd07cd5d 100644 --- a/stdlib/source/lux/data/lazy.lux +++ b/stdlib/source/lux/data/lazy.lux @@ -2,7 +2,7 @@ lux (lux [io] (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ Monad do]) (concurrency [atom]) [macro #+ with-gensyms] @@ -37,7 +37,7 @@ (def: (map f fa) (freeze (f (thaw fa))))) -(struct: #export _ (Applicative Lazy) +(struct: #export _ (Apply Lazy) (def: functor Functor<Lazy>) (def: (apply ff fa) (freeze ((thaw ff) (thaw fa))))) diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index e42af460f..89be2362c 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -2,7 +2,7 @@ lux (lux (control ["m" monoid] ["F" functor] - ["A" applicative] + ["A" apply] [monad #+ do Monad] [eq #+ Eq]))) @@ -25,7 +25,7 @@ #.None #.None (#.Some a) (#.Some (f a))))) -(struct: #export _ (A.Applicative Maybe) +(struct: #export _ (A.Apply Maybe) (def: functor Functor<Maybe>) (def: (apply ff fa) diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index 6e038aa7c..613959b4f 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -1,7 +1,7 @@ (.module: {#.doc "A method for abstracting I/O and effectful computations to make it safe while writing pure functional code."} lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad] ["ex" exception #+ Exception]) (data ["e" error #+ Error] @@ -29,7 +29,7 @@ (def: (map f ma) (io (f (ma (:! Void [])))))) -(struct: #export _ (Applicative IO) +(struct: #export _ (Apply IO) (def: functor Functor<IO>) (def: (apply ff fa) @@ -57,11 +57,11 @@ (def: (map f ma) (io (:: e.Functor<Error> map f (run ma))))) -(struct: #export _ (Applicative Process) +(struct: #export _ (Apply Process) (def: functor Functor<Process>) (def: (apply ff fa) - (io (:: e.Applicative<Error> apply (run ff) (run fa))))) + (io (:: e.Apply<Error> apply (run ff) (run fa))))) (struct: #export _ (Monad Process) (def: functor Functor<Process>) diff --git a/stdlib/source/lux/lang/type/check.lux b/stdlib/source/lux/lang/type/check.lux index cea574d0c..8a32b2c4c 100644 --- a/stdlib/source/lux/lang/type/check.lux +++ b/stdlib/source/lux/lang/type/check.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Type-checking functionality."} lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad] ["ex" exception #+ exception:]) (data [text "text/" Monoid<Text> Eq<Text>] @@ -57,7 +57,7 @@ (#e.Success [context' (f output)]) )))) -(struct: #export _ (Applicative Check) +(struct: #export _ (Apply Check) (def: functor Functor<Check>) (def: (apply ff fa) diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 4c56e9184..238028f52 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Functions for extracting information from the state of the compiler."} lux (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad]) (data [number] [product] @@ -26,7 +26,7 @@ (#e.Success [compiler' a]) (#e.Success [compiler' (f a)]))))) -(struct: #export _ (Applicative Meta) +(struct: #export _ (Apply Meta) (def: functor Functor<Meta>) (def: (apply ff fa) diff --git a/stdlib/source/lux/math/random.lux b/stdlib/source/lux/math/random.lux index 2b7c6598d..930f2929d 100644 --- a/stdlib/source/lux/math/random.lux +++ b/stdlib/source/lux/math/random.lux @@ -1,7 +1,7 @@ (.module: {#.doc "Pseudo-random number generation (PRNG) algorithms."} [lux #- list] (lux (control [functor #+ Functor] - [applicative #+ Applicative] + [apply #+ Apply] [monad #+ do Monad] hash) (data [bit] @@ -34,7 +34,7 @@ (let [[state' a] (fa state)] [state' (f a)])))) -(struct: #export _ (Applicative Random) +(struct: #export _ (Apply Random) (def: functor Functor<Random>) (def: (apply ff fa) diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index e537d0b62..9f54f3036 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -1,7 +1,6 @@ (.module: lux - (lux (control [applicative] - [monad #+ do Monad] + (lux (control [monad #+ do Monad] ["p" parser]) (data [text "text/" Eq<Text> Monoid<Text>] ["E" error] diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index 48af98a6f..e41f947fe 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -94,14 +94,14 @@ (do io.Monad<IO> [#let [>f< (: (Channel (-> Int Int)) (frp.channel [])) >a< (: (Channel Int) (frp.channel []))] - output (read! (let [(^open) frp.Applicative<Channel>] + output (read! (let [(^open) frp.Apply<Channel>] (apply >f< >a<))) _ (write! (list i/inc) >f<) _ (write! (list 12345) >a<)] (wrap output))) _ (promise.wait +100) output (promise.future (atom.read output))] - (assert "Applicative works over all channel values." + (assert "Apply works over all channel values." (list/= (list 12346) (list.reverse output))))) diff --git a/stdlib/test/test/lux/control/continuation.lux b/stdlib/test/test/lux/control/continuation.lux index ad50a5515..7f9ff00d9 100644 --- a/stdlib/test/test/lux/control/continuation.lux +++ b/stdlib/test/test/lux/control/continuation.lux @@ -15,7 +15,7 @@ (<| (times +100) (do @ [sample r.nat - #let [(^open "&/") &.Applicative<Cont> + #let [(^open "&/") &.Apply<Cont> (^open "&/") &.Monad<Cont>] elems (r.list +3 r.nat)] ($_ seq @@ -25,7 +25,7 @@ (test "Can use functor." (n/= (n/inc sample) (&.run (&/map n/inc (&/wrap sample))))) - (test "Can use applicative." + (test "Can use apply." (n/= (n/inc sample) (&.run (&/apply (&/wrap n/inc) (&/wrap sample))))) (test "Can use monad." diff --git a/stdlib/test/test/lux/control/reader.lux b/stdlib/test/test/lux/control/reader.lux index 4eab1d6f3..f84d8d16f 100644 --- a/stdlib/test/test/lux/control/reader.lux +++ b/stdlib/test/test/lux/control/reader.lux @@ -10,7 +10,7 @@ lux/test) (context: "Readers" - (let [(^open "&/") &.Applicative<Reader> + (let [(^open "&/") &.Apply<Reader> (^open "&/") &.Monad<Reader>] ($_ seq (test "" (i/= 123 (&.run 123 &.ask))) diff --git a/stdlib/test/test/lux/control/state.lux b/stdlib/test/test/lux/control/state.lux index 396b390e7..33a318a2f 100644 --- a/stdlib/test/test/lux/control/state.lux +++ b/stdlib/test/test/lux/control/state.lux @@ -52,13 +52,13 @@ [state r.nat value r.nat #let [(^open "&/") &.Functor<State> - (^open "&/") &.Applicative<State> + (^open "&/") &.Apply<State> (^open "&/") &.Monad<State>]] ($_ seq (test "Can use functor." (with-conditions [state (n/inc state)] (&/map n/inc &.get))) - (test "Can use applicative." + (test "Can use apply." (and (with-conditions [state value] (&/wrap value)) (with-conditions [state (n/+ value value)] diff --git a/stdlib/test/test/lux/control/writer.lux b/stdlib/test/test/lux/control/writer.lux index 6139db20e..09f37a957 100644 --- a/stdlib/test/test/lux/control/writer.lux +++ b/stdlib/test/test/lux/control/writer.lux @@ -11,12 +11,12 @@ (context: "Writer." (let [(^open "&/") (&.Monad<Writer> text.Monoid<Text>) - (^open "&/") (&.Applicative<Writer> text.Monoid<Text>)] + (^open "&/") (&.Apply<Writer> text.Monoid<Text>)] ($_ seq (test "Functor respects Writer." (i/= 11 (product.right (&/map i/inc ["" 10])))) - (test "Applicative respects Writer." + (test "Apply respects Writer." (and (i/= 20 (product.right (&/wrap 20))) (i/= 30 (product.right (&/apply (&/wrap (i/+ 10)) (&/wrap 20)))))) diff --git a/stdlib/test/test/lux/data/coll/list.lux b/stdlib/test/test/lux/data/coll/list.lux index f9e6e31b9..729519823 100644 --- a/stdlib/test/test/lux/data/coll/list.lux +++ b/stdlib/test/test/lux/data/coll/list.lux @@ -173,9 +173,9 @@ (and (= sample left) (= other-sample right)))))) - (test "Applicative allows you to create singleton lists, and apply lists of functions to lists of values." + (test "Apply allows you to create singleton lists, and apply lists of functions to lists of values." (let [(^open) &.Monad<List> - (^open) &.Applicative<List>] + (^open) &.Apply<List>] (and (= (list separator) (wrap separator)) (= (map n/inc sample) (apply (wrap n/inc) sample))))) diff --git a/stdlib/test/test/lux/data/coll/sequence.lux b/stdlib/test/test/lux/data/coll/sequence.lux index e64377f21..e1d561fb7 100644 --- a/stdlib/test/test/lux/data/coll/sequence.lux +++ b/stdlib/test/test/lux/data/coll/sequence.lux @@ -18,7 +18,7 @@ other-sample (r.sequence size r.nat) non-member (|> r.nat (r.filter (|>> (&.member? number.Eq<Nat> sample) not))) #let [(^open "&/") (&.Eq<Sequence> number.Eq<Nat>) - (^open "&/") &.Applicative<Sequence> + (^open "&/") &.Apply<Sequence> (^open "&/") &.Monad<Sequence> (^open "&/") &.Fold<Sequence> (^open "&/") &.Monoid<Sequence>]] @@ -63,7 +63,7 @@ (and (not (&/= sample there)) (&/= sample back-again)))) - (test "Applicative allows you to create singleton sequences, and apply sequences of functions to sequences of values." + (test "Apply allows you to create singleton sequences, and apply sequences of functions to sequences of values." (and (&/= (&.sequence non-member) (&/wrap non-member)) (&/= (&/map n/inc sample) (&/apply (&/wrap n/inc) sample)))) diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/error.lux index 84556fde7..fb66bc7fe 100644 --- a/stdlib/test/test/lux/data/error.lux +++ b/stdlib/test/test/lux/data/error.lux @@ -8,7 +8,7 @@ lux/test) (context: "Errors" - (let [(^open "&/") &.Applicative<Error> + (let [(^open "&/") &.Apply<Error> (^open "&/") &.Monad<Error>] ($_ seq (test "Functor correctly handles both cases." @@ -21,7 +21,7 @@ (case> (#&.Error "YOLO") true _ false)) )) - (test "Applicative correctly handles both cases." + (test "Apply correctly handles both cases." (and (|> (&/wrap 20) (case> (#&.Success 20) true _ false)) (|> (&/apply (&/wrap i/inc) (&/wrap 10)) diff --git a/stdlib/test/test/lux/data/identity.lux b/stdlib/test/test/lux/data/identity.lux index 9e36efda5..f5ac9c6ba 100644 --- a/stdlib/test/test/lux/data/identity.lux +++ b/stdlib/test/test/lux/data/identity.lux @@ -8,14 +8,14 @@ lux/test) (context: "Identity" - (let [(^open "&/") &.Applicative<Identity> + (let [(^open "&/") &.Apply<Identity> (^open "&/") &.Monad<Identity> (^open "&/") &.CoMonad<Identity>] ($_ seq (test "Functor does not affect values." (Text/= "yololol" (&/map (Text/compose "yolo") "lol"))) - (test "Applicative does not affect values." + (test "Apply does not affect values." (and (Text/= "yolo" (&/wrap "yolo")) (Text/= "yololol" (&/apply (&/wrap (Text/compose "yolo")) (&/wrap "lol"))))) diff --git a/stdlib/test/test/lux/data/lazy.lux b/stdlib/test/test/lux/data/lazy.lux index b683abb0f..07513adec 100644 --- a/stdlib/test/test/lux/data/lazy.lux +++ b/stdlib/test/test/lux/data/lazy.lux @@ -24,7 +24,7 @@ (&.thaw lazy)))) )))) -(context: "Functor, Applicative, Monad." +(context: "Functor, Apply, Monad." (<| (times +100) (do @ [sample r.nat] @@ -43,9 +43,9 @@ &.thaw (n/= (n/inc sample)))) - (test "Applicative apply." + (test "Apply apply." (let [(^open "&/") &.Monad<Lazy> - (^open "&/") &.Applicative<Lazy>] + (^open "&/") &.Apply<Lazy>] (|> (&/apply (&/wrap n/inc) (&/wrap sample)) &.thaw (n/= (n/inc sample))))) diff --git a/stdlib/test/test/lux/data/maybe.lux b/stdlib/test/test/lux/data/maybe.lux index ca11da17f..9723500f5 100644 --- a/stdlib/test/test/lux/data/maybe.lux +++ b/stdlib/test/test/lux/data/maybe.lux @@ -10,7 +10,7 @@ (context: "Maybe" (let [(^open "&/") &.Monoid<Maybe> - (^open "&/") &.Applicative<Maybe> + (^open "&/") &.Apply<Maybe> (^open "&/") &.Monad<Maybe> (^open "Maybe/") (&.Eq<Maybe> text.Eq<Text>)] ($_ seq @@ -31,7 +31,7 @@ (and (Maybe/= #.None (&/map (text/compose "yolo") #.None)) (Maybe/= (#.Some "yololol") (&/map (text/compose "yolo") (#.Some "lol"))))) - (test "Applicative respects Maybe." + (test "Apply respects Maybe." (and (Maybe/= (#.Some "yolo") (&/wrap "yolo")) (Maybe/= (#.Some "yololol") (&/apply (&/wrap (text/compose "yolo")) (&/wrap "lol"))))) diff --git a/stdlib/test/test/lux/io.lux b/stdlib/test/test/lux/io.lux index 5836e5844..43841a708 100644 --- a/stdlib/test/test/lux/io.lux +++ b/stdlib/test/test/lux/io.lux @@ -12,7 +12,7 @@ (test "" (Text/= "YOLO" (&.run (&.io "YOLO")))) (test "" (i/= 11 (&.run (:: &.Functor<IO> map i/inc (&.io 10))))) (test "" (i/= 10 (&.run (:: &.Monad<IO> wrap 10)))) - (test "" (i/= 30 (&.run (let [(^open "&/") &.Applicative<IO> + (test "" (i/= 30 (&.run (let [(^open "&/") &.Apply<IO> (^open "&/") &.Monad<IO>] (&/apply (&/wrap (i/+ 10)) (&/wrap 20)))))) (test "" (i/= 30 (&.run (do &.Monad<IO> |