From 0144da58ba856bd6f6072b588bbd076c9c3fdb36 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 2 May 2018 00:20:42 -0400 Subject: - Re-named "Applicative" to "Apply". --- stdlib/source/lux/concurrency/frp.lux | 4 ++-- stdlib/source/lux/concurrency/promise.lux | 4 ++-- stdlib/source/lux/concurrency/stm.lux | 4 ++-- stdlib/source/lux/concurrency/task.lux | 4 ++-- stdlib/source/lux/control/applicative.lux | 34 --------------------------- stdlib/source/lux/control/apply.lux | 34 +++++++++++++++++++++++++++ stdlib/source/lux/control/continuation.lux | 4 ++-- stdlib/source/lux/control/monad/free.lux | 6 ++--- stdlib/source/lux/control/parser.lux | 4 ++-- stdlib/source/lux/control/reader.lux | 6 ++--- stdlib/source/lux/control/region.lux | 6 ++--- stdlib/source/lux/control/state.lux | 10 ++++---- stdlib/source/lux/control/thread.lux | 6 ++--- stdlib/source/lux/control/writer.lux | 6 ++--- stdlib/source/lux/data/coll/list.lux | 4 ++-- stdlib/source/lux/data/coll/sequence.lux | 4 ++-- stdlib/source/lux/data/error.lux | 4 ++-- stdlib/source/lux/data/identity.lux | 4 ++-- stdlib/source/lux/data/lazy.lux | 4 ++-- stdlib/source/lux/data/maybe.lux | 4 ++-- stdlib/source/lux/io.lux | 8 +++---- stdlib/source/lux/lang/type/check.lux | 4 ++-- stdlib/source/lux/macro.lux | 4 ++-- stdlib/source/lux/math/random.lux | 4 ++-- stdlib/source/lux/type/abstract.lux | 3 +-- stdlib/test/test/lux/concurrency/frp.lux | 4 ++-- stdlib/test/test/lux/control/continuation.lux | 4 ++-- stdlib/test/test/lux/control/reader.lux | 2 +- stdlib/test/test/lux/control/state.lux | 4 ++-- stdlib/test/test/lux/control/writer.lux | 4 ++-- stdlib/test/test/lux/data/coll/list.lux | 4 ++-- stdlib/test/test/lux/data/coll/sequence.lux | 4 ++-- stdlib/test/test/lux/data/error.lux | 4 ++-- stdlib/test/test/lux/data/identity.lux | 4 ++-- stdlib/test/test/lux/data/lazy.lux | 6 ++--- stdlib/test/test/lux/data/maybe.lux | 4 ++-- stdlib/test/test/lux/io.lux | 2 +- 37 files changed, 112 insertions(+), 113 deletions(-) delete mode 100644 stdlib/source/lux/control/applicative.lux create mode 100644 stdlib/source/lux/control/apply.lux (limited to 'stdlib') 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])) @@ -103,7 +103,7 @@ input)) output)))) -(struct: #export _ (Applicative Channel) +(struct: #export _ (Apply Channel) (def: functor Functor) (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) (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) (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) (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 Applicative Applicative) - {#.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) - (get@ #functor Applicative))) - (def: (apply fgf fgx) - ## TODO: Switch from this version to the one below (in comments) ASAP. - (let [fgf' (:: Applicative apply - (:: Monad wrap (:: Applicative apply)) - fgf)] - (:: Applicative apply fgf' fgx)) - ## (let [applyF (:: Applicative apply) - ## applyG (:: Applicative apply)] - ## ($_ applyF - ## (:: Monad 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 Apply Apply) + {#.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) (get@ #functor Apply))) + + (def: (apply fgf fgx) + ## TODO: Switch from this version to the one below (in comments) ASAP. + (let [fgf' (:: Apply apply + (:: Monad wrap (:: Apply apply)) + fgf)] + (:: Apply apply fgf' fgx)) + ## (let [applyF (:: Apply apply) + ## applyG (:: Apply apply)] + ## ($_ applyF + ## (:: Monad 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 (All [o] (Applicative (All [i] (Cont i o)))) +(struct: #export Apply (All [o] (Apply (All [i] (Cont i o)))) (def: functor Functor) (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 dsl) - (All [F] (-> (Functor F) (Applicative (Free F)))) +(struct: #export (Apply dsl) + (All [F] (-> (Functor F) (Apply (Free F)))) (def: functor (Functor 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 Monoid]) @@ -23,7 +23,7 @@ (#e.Success [input' a]) (#e.Success [input' (f a)]))))) -(struct: #export Applicative (All [s] (Applicative (Parser s))) +(struct: #export Apply (All [s] (Apply (Parser s))) (def: functor Functor) (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 - (All [r] (A.Applicative (Reader r))) +(struct: #export Apply + (All [r] (A.Apply (Reader r))) (def: functor Functor) 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 Monad) +(struct: #export (Apply Monad) (All [m] (-> (Monad m) - (All [r] (Applicative (Region r m))))) + (All [r] (Apply (Region r m))))) (def: functor (Functor (get@ #monad.functor Monad))) 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 - (All [s] (A.Applicative (State s))) +(struct: #export Apply + (All [s] (A.Apply (State s))) (def: functor Functor) @@ -88,8 +88,8 @@ (:: Functor map (function (_ [s a]) [s (f a)]) (sfa state))))) -(struct: (Applicative Monad) - (All [M s] (-> (Monad M) (A.Applicative (All [a] (-> s (M [s a])))))) +(struct: (Apply Monad) + (All [M s] (-> (Monad M) (A.Apply (All [a] (-> s (M [s a])))))) (def: functor (Functor (:: Monad 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 - (All [!] (Applicative (Thread !))) +(struct: #export Apply + (All [!] (Apply (Thread !))) (def: functor Functor) 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 mon) +(struct: #export (Apply mon) (All [l] - (-> (Monoid l) (A.Applicative (Writer l)))) + (-> (Monoid l) (A.Apply (Writer l)))) (def: functor Functor) 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) -(struct: #export _ (Applicative List) +(struct: #export _ (Apply List) (def: functor Functor) (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) (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) (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) (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) (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) (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) (def: (apply ff fa) @@ -57,11 +57,11 @@ (def: (map f ma) (io (:: e.Functor map f (run ma))))) -(struct: #export _ (Applicative Process) +(struct: #export _ (Apply Process) (def: functor Functor) (def: (apply ff fa) - (io (:: e.Applicative apply (run ff) (run fa))))) + (io (:: e.Apply apply (run ff) (run fa))))) (struct: #export _ (Monad Process) (def: functor Functor) 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 Eq] @@ -57,7 +57,7 @@ (#e.Success [context' (f output)]) )))) -(struct: #export _ (Applicative Check) +(struct: #export _ (Apply Check) (def: functor Functor) (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) (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) (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 Monoid] ["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 [#let [>f< (: (Channel (-> Int Int)) (frp.channel [])) >a< (: (Channel Int) (frp.channel []))] - output (read! (let [(^open) frp.Applicative] + output (read! (let [(^open) frp.Apply] (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 + #let [(^open "&/") &.Apply (^open "&/") &.Monad] 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 + (let [(^open "&/") &.Apply (^open "&/") &.Monad] ($_ 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 - (^open "&/") &.Applicative + (^open "&/") &.Apply (^open "&/") &.Monad]] ($_ 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 text.Monoid) - (^open "&/") (&.Applicative text.Monoid)] + (^open "&/") (&.Apply text.Monoid)] ($_ 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 - (^open) &.Applicative] + (^open) &.Apply] (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 sample) not))) #let [(^open "&/") (&.Eq number.Eq) - (^open "&/") &.Applicative + (^open "&/") &.Apply (^open "&/") &.Monad (^open "&/") &.Fold (^open "&/") &.Monoid]] @@ -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 + (let [(^open "&/") &.Apply (^open "&/") &.Monad] ($_ 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 + (let [(^open "&/") &.Apply (^open "&/") &.Monad (^open "&/") &.CoMonad] ($_ 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 - (^open "&/") &.Applicative] + (^open "&/") &.Apply] (|> (&/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 - (^open "&/") &.Applicative + (^open "&/") &.Apply (^open "&/") &.Monad (^open "Maybe/") (&.Eq text.Eq)] ($_ 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 map i/inc (&.io 10))))) (test "" (i/= 10 (&.run (:: &.Monad wrap 10)))) - (test "" (i/= 30 (&.run (let [(^open "&/") &.Applicative + (test "" (i/= 30 (&.run (let [(^open "&/") &.Apply (^open "&/") &.Monad] (&/apply (&/wrap (i/+ 10)) (&/wrap 20)))))) (test "" (i/= 30 (&.run (do &.Monad -- cgit v1.2.3