aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification
diff options
context:
space:
mode:
authorEduardo Julian2021-07-27 03:51:10 -0400
committerEduardo Julian2021-07-27 03:51:10 -0400
commit061fd8a209bbcaffc2bfb850ac6046752a567d50 (patch)
tree8cd83ad7d0bc06ded7976eb5420467e485733ae8 /stdlib/source/specification
parente64b6d0114c26a455e19a416b5f02a4d19dd711f (diff)
Re-named wrap => in && unwrap => out.
Diffstat (limited to '')
-rw-r--r--stdlib/source/specification/aedifex/repository.lux48
-rw-r--r--stdlib/source/specification/compositor.lux2
-rw-r--r--stdlib/source/specification/compositor/analysis/type.lux10
-rw-r--r--stdlib/source/specification/compositor/common.lux16
-rw-r--r--stdlib/source/specification/compositor/generation/case.lux12
-rw-r--r--stdlib/source/specification/compositor/generation/function.lux14
-rw-r--r--stdlib/source/specification/lux/abstract/comonad.lux10
-rw-r--r--stdlib/source/specification/lux/abstract/monad.lux8
-rw-r--r--stdlib/source/specification/lux/world/console.lux62
-rw-r--r--stdlib/source/specification/lux/world/file.lux106
-rw-r--r--stdlib/source/specification/lux/world/program.lux16
-rw-r--r--stdlib/source/specification/lux/world/shell.lux60
12 files changed, 183 insertions, 181 deletions
diff --git a/stdlib/source/specification/aedifex/repository.lux b/stdlib/source/specification/aedifex/repository.lux
index 8a2965d51..1b16d774d 100644
--- a/stdlib/source/specification/aedifex/repository.lux
+++ b/stdlib/source/specification/aedifex/repository.lux
@@ -27,31 +27,31 @@
(-> Artifact Artifact (/.Repository Async) Test)
(do random.monad
[expected (_binary.random 100)]
- (wrap ($_ _.and'
- (do async.monad
- [#let [good_uri (/remote.uri (get@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)]
- good_upload! (\ subject upload good_uri expected)
- good_download! (\ subject download good_uri)
+ (in ($_ _.and'
+ (do async.monad
+ [#let [good_uri (/remote.uri (get@ #//artifact.version valid_artifact) valid_artifact //artifact/extension.lux_library)]
+ good_upload! (\ subject upload good_uri expected)
+ good_download! (\ subject download good_uri)
- #let [bad_uri (/remote.uri (get@ #//artifact.version invalid_artifact) invalid_artifact //artifact/extension.lux_library)]
- bad_upload! (\ subject upload bad_uri expected)
- bad_download! (\ subject download bad_uri)]
- (_.cover' [/.Repository]
- (let [successfull_flow!
- (case [good_upload! good_download!]
- [(#try.Success _) (#try.Success actual)]
- (\ binary.equivalence = expected actual)
+ #let [bad_uri (/remote.uri (get@ #//artifact.version invalid_artifact) invalid_artifact //artifact/extension.lux_library)]
+ bad_upload! (\ subject upload bad_uri expected)
+ bad_download! (\ subject download bad_uri)]
+ (_.cover' [/.Repository]
+ (let [successfull_flow!
+ (case [good_upload! good_download!]
+ [(#try.Success _) (#try.Success actual)]
+ (\ binary.equivalence = expected actual)
- _
- false)
+ _
+ false)
- failed_flow!
- (case [bad_upload! bad_download!]
- [(#try.Failure _) (#try.Failure _)]
- true
+ failed_flow!
+ (case [bad_upload! bad_download!]
+ [(#try.Failure _) (#try.Failure _)]
+ true
- _
- false)]
- (and successfull_flow!
- failed_flow!))))
- ))))
+ _
+ false)]
+ (and successfull_flow!
+ failed_flow!))))
+ ))))
diff --git a/stdlib/source/specification/compositor.lux b/stdlib/source/specification/compositor.lux
index 8ccf1e02f..162dcbec8 100644
--- a/stdlib/source/specification/compositor.lux
+++ b/stdlib/source/specification/compositor.lux
@@ -49,7 +49,7 @@
(-> expression directive)
Test))
(do r.monad
- [_ (wrap [])
+ [_ (in [])
#let [?state,runner,definer (<| io.run
(do io.monad
[platform platform])
diff --git a/stdlib/source/specification/compositor/analysis/type.lux b/stdlib/source/specification/compositor/analysis/type.lux
index 7cbd5884b..4db867513 100644
--- a/stdlib/source/specification/compositor/analysis/type.lux
+++ b/stdlib/source/specification/compositor/analysis/type.lux
@@ -23,8 +23,8 @@
(def: (check-success+ expander state extension params output-type)
(-> Expander State+ Text (List Code) Type Bit)
(|> (analysis/scope.with-scope ""
- (analysis/type.with-type output-type
- (analysis.phase expander (` ((~ (code.text extension)) (~+ params))))))
+ (analysis/type.with-type output-type
+ (analysis.phase expander (` ((~ (code.text extension)) (~+ params))))))
(phase.run state)
(case> (#try.Success _)
true
@@ -38,9 +38,9 @@
(~~ (template [<random> <type> <code>]
[(do r.monad
[value <random>]
- (wrap [(` <type>)
- <type>
- (<code> value)]))]
+ (in [(` <type>)
+ <type>
+ (<code> value)]))]
[r.bit (0 #0 "#Bit" (0 #0)) code.bit]
[r.nat (0 #0 "#I64" (0 #1 (0 #0 "#Nat" (0 #0)) (0 #0))) code.nat]
diff --git a/stdlib/source/specification/compositor/common.lux b/stdlib/source/specification/compositor/common.lux
index ed3b53f30..33268ecde 100644
--- a/stdlib/source/specification/compositor/common.lux
+++ b/stdlib/source/specification/compositor/common.lux
@@ -71,11 +71,11 @@
Definer]))))
(do io.monad
[?state (platform.initialize target expander analysis-bundle platform generation-bundle directive-bundle program extender)]
- (wrap (do try.monad
- [[directive-bundle directive-state] ?state
- #let [generation-state (get@ [#directive.generation
- #directive.state]
- directive-state)]]
- (wrap [[directive-bundle directive-state]
- (..runner platform generation-state)
- (..definer platform generation-state)])))))
+ (in (do try.monad
+ [[directive-bundle directive-state] ?state
+ #let [generation-state (get@ [#directive.generation
+ #directive.state]
+ directive-state)]]
+ (in [[directive-bundle directive-state]
+ (..runner platform generation-state)
+ (..definer platform generation-state)])))))
diff --git a/stdlib/source/specification/compositor/generation/case.lux b/stdlib/source/specification/compositor/generation/case.lux
index 81e6f5988..d18d6b461 100644
--- a/stdlib/source/specification/compositor/generation/case.lux
+++ b/stdlib/source/specification/compositor/generation/case.lux
@@ -52,13 +52,13 @@
(`` ($_ r.either
(do r.monad
[value r.i64]
- (wrap [(synthesis.i64 value)
- synthesis.path/pop]))
+ (in [(synthesis.i64 value)
+ synthesis.path/pop]))
(~~ (template [<gen> <synth> <path>]
[(do r.monad
[value <gen>]
- (wrap [(<synth> value)
- (<path> value)]))]
+ (in [(<synth> value)
+ (<path> value)]))]
[r.bit synthesis.bit synthesis.path/bit]
[r.i64 synthesis.i64 synthesis.path/i64]
@@ -78,7 +78,7 @@
(synthesis.member/right idx)
(synthesis.member/left idx))
subP)]]
- (wrap [caseS caseP]))
+ (in [caseS caseP]))
(do {! r.monad}
[size ..size
idx (|> r.nat (\ ! map (n.% size)))
@@ -93,7 +93,7 @@
(synthesis.side/right idx)
(synthesis.side/left idx))
subP)]]
- (wrap [caseS caseP]))
+ (in [caseS caseP]))
))))
(def: (let-spec run)
diff --git a/stdlib/source/specification/compositor/generation/function.lux b/stdlib/source/specification/compositor/generation/function.lux
index 6d0f8d541..61f6d6656 100644
--- a/stdlib/source/specification/compositor/generation/function.lux
+++ b/stdlib/source/specification/compositor/generation/function.lux
@@ -24,7 +24,9 @@
[//
[common (#+ Runner)]]])
-(def: max-arity Arity 10)
+(def: max-arity
+ Arity
+ 10)
(def: arity
(Random Arity)
@@ -39,11 +41,11 @@
(do r.monad
[arity ..arity
local (..local arity)]
- (wrap [arity local
- (synthesis.function/abstraction
- {#synthesis.environment (list)
- #synthesis.arity arity
- #synthesis.body (synthesis.variable/local local)})])))
+ (in [arity local
+ (synthesis.function/abstraction
+ {#synthesis.environment (list)
+ #synthesis.arity arity
+ #synthesis.body (synthesis.variable/local local)})])))
(def: #export (spec run)
(-> Runner Test)
diff --git a/stdlib/source/specification/lux/abstract/comonad.lux b/stdlib/source/specification/lux/abstract/comonad.lux
index d4532a70b..8b45adb88 100644
--- a/stdlib/source/specification/lux/abstract/comonad.lux
+++ b/stdlib/source/specification/lux/abstract/comonad.lux
@@ -18,12 +18,12 @@
(do {! random.monad}
[sample random.nat
morphism (\ ! map (function (_ diff)
- (|>> _//unwrap (n.+ diff)))
+ (|>> _//out (n.+ diff)))
random.nat)
#let [start (injection sample)]]
(_.test "Left identity."
(n.= (morphism start)
- (|> start _//split (_//map morphism) _//unwrap)))))
+ (|> start _//split (_//map morphism) _//out)))))
(def: (right_identity injection comparison (^open "_//."))
(All [f] (-> (Injection f) (Comparison f) (CoMonad f) Test))
@@ -33,17 +33,17 @@
== (comparison n.=)]]
(_.test "Right identity."
(== start
- (|> start _//split (_//map _//unwrap))))))
+ (|> start _//split (_//map _//out))))))
(def: (associativity injection comparison (^open "_//."))
(All [f] (-> (Injection f) (Comparison f) (CoMonad f) Test))
(do {! random.monad}
[sample random.nat
increase (\ ! map (function (_ diff)
- (|>> _//unwrap (n.+ diff)))
+ (|>> _//out (n.+ diff)))
random.nat)
decrease (\ ! map (function (_ diff)
- (|>> _//unwrap(n.- diff)))
+ (|>> _//out(n.- diff)))
random.nat)
#let [start (injection sample)
== (comparison n.=)]]
diff --git a/stdlib/source/specification/lux/abstract/monad.lux b/stdlib/source/specification/lux/abstract/monad.lux
index bc1b643f2..1a602b292 100644
--- a/stdlib/source/specification/lux/abstract/monad.lux
+++ b/stdlib/source/specification/lux/abstract/monad.lux
@@ -16,7 +16,7 @@
(do {! random.monad}
[sample random.nat
morphism (\ ! map (function (_ diff)
- (|>> (n.+ diff) _//wrap))
+ (|>> (n.+ diff) _//in))
random.nat)]
(_.test "Left identity."
((comparison n.=)
@@ -29,7 +29,7 @@
[sample random.nat]
(_.test "Right identity."
((comparison n.=)
- (|> (injection sample) (_//map _//wrap) _//join)
+ (|> (injection sample) (_//map _//in) _//join)
(injection sample)))))
(def: (associativity injection comparison (^open "_//."))
@@ -37,10 +37,10 @@
(do {! random.monad}
[sample random.nat
increase (\ ! map (function (_ diff)
- (|>> (n.+ diff) _//wrap))
+ (|>> (n.+ diff) _//in))
random.nat)
decrease (\ ! map (function (_ diff)
- (|>> (n.- diff) _//wrap))
+ (|>> (n.- diff) _//in))
random.nat)]
(_.test "Associativity."
((comparison n.=)
diff --git a/stdlib/source/specification/lux/world/console.lux b/stdlib/source/specification/lux/world/console.lux
index cd2f88485..5632e5cd8 100644
--- a/stdlib/source/specification/lux/world/console.lux
+++ b/stdlib/source/specification/lux/world/console.lux
@@ -21,38 +21,38 @@
(-> (IO (/.Console Async)) Test)
(do random.monad
[message (random.ascii/alpha 10)]
- (wrap (do async.monad
- [console (async.future console)
- ?write (\ console write (format message text.new_line))
- ?read (\ console read [])
- ?read_line (\ console read_line [])
- ?close/good (\ console close [])
- ?close/bad (\ console close [])
+ (in (do async.monad
+ [console (async.future console)
+ ?write (\ console write (format message text.new_line))
+ ?read (\ console read [])
+ ?read_line (\ console read_line [])
+ ?close/good (\ console close [])
+ ?close/bad (\ console close [])
- #let [can_write!
- (case ?write
- (#try.Success _)
- true
-
- _
- false)
+ #let [can_write!
+ (case ?write
+ (#try.Success _)
+ true
+
+ _
+ false)
- can_read!
- (case [?read ?read_line]
- [(#try.Success _) (#try.Success _)]
- true
+ can_read!
+ (case [?read ?read_line]
+ [(#try.Success _) (#try.Success _)]
+ true
- _
- false)
+ _
+ false)
- can_close!
- (case [?close/good ?close/bad]
- [(#try.Success _) (#try.Failure _)]
- true
-
- _
- false)]]
- (_.cover' [/.Console]
- (and can_write!
- can_read!
- can_close!))))))
+ can_close!
+ (case [?close/good ?close/bad]
+ [(#try.Success _) (#try.Failure _)]
+ true
+
+ _
+ false)]]
+ (_.cover' [/.Console]
+ (and can_write!
+ can_read!
+ can_close!))))))
diff --git a/stdlib/source/specification/lux/world/file.lux b/stdlib/source/specification/lux/world/file.lux
index fd1585c34..910dfde68 100644
--- a/stdlib/source/specification/lux/world/file.lux
+++ b/stdlib/source/specification/lux/world/file.lux
@@ -37,7 +37,7 @@
(do {! random.monad}
[parent (random.ascii/numeric 2)
child (random.ascii/numeric 2)])
- wrap
+ in
(do async.monad
[fs (async.future fs)]
($_ _.and'
@@ -80,11 +80,11 @@
[directory_pre! (\ fs directory? parent)
made? (\ fs make_directory parent)
directory_post! (\ fs directory? parent)]
- (wrap (and (not directory_pre!)
- (case made?
- (#try.Success _) true
- (#try.Failure _) false)
- directory_post!))))
+ (in (and (not directory_pre!)
+ (case made?
+ (#try.Success _) true
+ (#try.Failure _) false)
+ directory_post!))))
(def: (file?&write fs content path)
(-> (/.System Async) Binary /.Path (Async Bit))
@@ -92,11 +92,11 @@
[file_pre! (\ fs file? path)
made? (\ fs write content path)
file_post! (\ fs file? path)]
- (wrap (and (not file_pre!)
- (case made?
- (#try.Success _) true
- (#try.Failure _) false)
- file_post!))))
+ (in (and (not file_pre!)
+ (case made?
+ (#try.Success _) true
+ (#try.Failure _) false)
+ file_post!))))
(def: (file_size&read&append fs expected_file_size content appendix path)
(-> (/.System Async) Nat Binary Binary /.Path (Async Bit))
@@ -106,35 +106,35 @@
appended? (\ fs append appendix path)
post_file_size (\ fs file_size path)
post_content (\ fs read path)]
- (wrap (<| (try.default false)
- (do {! try.monad}
- [pre_file_size!
- (\ ! map (n.= expected_file_size) pre_file_size)
-
- pre_content!
- (\ ! map (binary\= content) pre_content)
-
- _ appended?
+ (in (<| (try.default false)
+ (do {! try.monad}
+ [pre_file_size!
+ (\ ! map (n.= expected_file_size) pre_file_size)
+
+ pre_content!
+ (\ ! map (binary\= content) pre_content)
+
+ _ appended?
- post_file_size!
- (\ ! map (n.= (n.* 2 expected_file_size)) post_file_size)
-
- post_content!
- (\ ! map (binary\= (binary\compose content appendix)) post_content)]
- (wrap (and pre_file_size!
- pre_content!
- post_file_size!
- post_content!)))))))
+ post_file_size!
+ (\ ! map (n.= (n.* 2 expected_file_size)) post_file_size)
+
+ post_content!
+ (\ ! map (binary\= (binary\compose content appendix)) post_content)]
+ (in (and pre_file_size!
+ pre_content!
+ post_file_size!
+ post_content!)))))))
(def: (modified?&last_modified fs expected_time path)
(-> (/.System Async) Instant /.Path (Async Bit))
(do async.monad
[modified? (\ fs modify expected_time path)
last_modified (\ fs last_modified path)]
- (wrap (<| (try.default false)
- (do {! try.monad}
- [_ modified?]
- (\ ! map (instant\= expected_time) last_modified))))))
+ (in (<| (try.default false)
+ (do {! try.monad}
+ [_ modified?]
+ (\ ! map (instant\= expected_time) last_modified))))))
(def: (directory_files&sub_directories fs parent sub_dir child)
(-> (/.System Async) /.Path /.Path /.Path (Async Bit))
@@ -145,15 +145,15 @@
directory_files (\ fs directory_files parent)
sub_directories (\ fs sub_directories parent)
#let [(^open "list\.") (list.equivalence text.equivalence)]]
- (wrap (<| (try.default false)
- (do try.monad
- [_ made_sub?]
- (wrap (and (|> directory_files
- (try\map (list\= (list child)))
- (try.default false))
- (|> sub_directories
- (try\map (list\= (list sub_dir)))
- (try.default false))))))))))
+ (in (<| (try.default false)
+ (do try.monad
+ [_ made_sub?]
+ (in (and (|> directory_files
+ (try\map (list\= (list child)))
+ (try.default false))
+ (|> sub_directories
+ (try\map (list\= (list sub_dir)))
+ (try.default false))))))))))
(def: (move&delete fs parent child alternate_child)
(-> (/.System Async) /.Path Text Text (Async Bit))
@@ -166,12 +166,12 @@
(\ ! map not))
found? (\ fs file? destination)
deleted? (\ fs delete destination)]
- (wrap (<| (try.default false)
- (do try.monad
- [_ moved?
- _ deleted?]
- (wrap (and lost?
- found?))))))))
+ (in (<| (try.default false)
+ (do try.monad
+ [_ moved?
+ _ deleted?]
+ (in (and lost?
+ found?))))))))
(def: (for_system fs)
(-> (IO (/.System Async)) Test)
@@ -180,7 +180,7 @@
child (random.ascii/numeric 2)
sub_dir (random.only (|>> (text\= child) not)
(random.ascii/numeric 2))
- alternate_child (random.only (predicate.intersect
+ alternate_child (random.only (predicate.and
(|>> (text\= child) not)
(|>> (text\= sub_dir) not))
(random.ascii/numeric 2))
@@ -188,7 +188,7 @@
content ($binary.random expected_file_size)
appendix ($binary.random expected_file_size)
expected_time random.instant])
- wrap
+ in
(do {! async.monad}
[fs (async.future fs)
#let [path (/.nest fs parent child)]
@@ -230,7 +230,7 @@
[dir/0 (random.ascii/numeric 2)
dir/1 (random.ascii/numeric 2)
dir/2 (random.ascii/numeric 2)])
- wrap
+ in
(do {! async.monad}
[fs (async.future fs)
#let [dir/1 (/.nest fs dir/0 dir/1)
@@ -275,7 +275,7 @@
(-> (IO (/.System Async)) Test)
(<| (do {! random.monad}
[file/0 (random.ascii/numeric 3)])
- wrap
+ in
(do {! async.monad}
[fs (async.future fs)
make_file!/0 (/.make_file ! fs (utf8\encode file/0) file/0)
@@ -307,7 +307,7 @@
[file (random.ascii/numeric 2)
dir (random.only (|>> (text\= file) not)
(random.ascii/numeric 2))])
- wrap
+ in
(do {! async.monad}
[fs (async.future fs)
diff --git a/stdlib/source/specification/lux/world/program.lux b/stdlib/source/specification/lux/world/program.lux
index 411f29fe9..091f41c2c 100644
--- a/stdlib/source/specification/lux/world/program.lux
+++ b/stdlib/source/specification/lux/world/program.lux
@@ -22,11 +22,11 @@
(-> (/.Program Async) Test)
(do random.monad
[exit random.int]
- (wrap (do {! async.monad}
- [environment (/.environment ! subject)]
- (_.cover' [/.Program]
- (and (not (dictionary.empty? environment))
- (list.every? (|>> text.empty? not)
- (dictionary.keys environment))
- (not (text.empty? (\ subject home)))
- (not (text.empty? (\ subject directory)))))))))
+ (in (do {! async.monad}
+ [environment (/.environment ! subject)]
+ (_.cover' [/.Program]
+ (and (not (dictionary.empty? environment))
+ (list.every? (|>> text.empty? not)
+ (dictionary.keys environment))
+ (not (text.empty? (\ subject home)))
+ (not (text.empty? (\ subject directory)))))))))
diff --git a/stdlib/source/specification/lux/world/shell.lux b/stdlib/source/specification/lux/world/shell.lux
index 55197a307..f7d8f28e7 100644
--- a/stdlib/source/specification/lux/world/shell.lux
+++ b/stdlib/source/specification/lux/world/shell.lux
@@ -52,18 +52,18 @@
(do async.monad
[?destroy (\ process destroy [])
?await (\ process await [])]
- (wrap (and (case ?destroy
- (#try.Success _)
- true
-
- (#try.Failure error)
- false)
- (case ?await
- (#try.Success _)
- false
-
- (#try.Failure error)
- true)))))
+ (in (and (case ?destroy
+ (#try.Success _)
+ true
+
+ (#try.Failure error)
+ false)
+ (case ?await
+ (#try.Success _)
+ false
+
+ (#try.Failure error)
+ true)))))
(with_expansions [<shell_coverage> (as_is [/.Command /.Argument])]
(def: #export (spec shell)
@@ -72,21 +72,21 @@
(do {! random.monad}
[message (random.ascii/alpha 10)
seconds (\ ! map (|>> (n.% 5) (n.+ 5)) random.nat)]
- (wrap (do {! async.monad}
- [?echo (\ shell execute (..echo! message))
- ?sleep (\ shell execute (..sleep! seconds))]
- (case [?echo ?sleep]
- [(#try.Success echo) (#try.Success sleep)]
- (do !
- [can_read! (..can_read! message echo)
- can_destroy! (..can_destroy! sleep)]
- ($_ _.and'
- (_.cover' <shell_coverage>
- (and can_read!
- can_destroy!))
- (..can_wait! echo)
- ))
-
- _
- (_.cover' <shell_coverage>
- false))))))))
+ (in (do {! async.monad}
+ [?echo (\ shell execute (..echo! message))
+ ?sleep (\ shell execute (..sleep! seconds))]
+ (case [?echo ?sleep]
+ [(#try.Success echo) (#try.Success sleep)]
+ (do !
+ [can_read! (..can_read! message echo)
+ can_destroy! (..can_destroy! sleep)]
+ ($_ _.and'
+ (_.cover' <shell_coverage>
+ (and can_read!
+ can_destroy!))
+ (..can_wait! echo)
+ ))
+
+ _
+ (_.cover' <shell_coverage>
+ false))))))))