aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/spec/compositor/generation
diff options
context:
space:
mode:
authorEduardo Julian2019-07-02 23:36:02 -0400
committerEduardo Julian2019-07-02 23:36:02 -0400
commit91c0619657bcf2ac520e7dd2912188f66bbe2157 (patch)
treef26675f263eb5f0285c1674b0777a7369248fe07 /stdlib/source/spec/compositor/generation
parent4f191540f831a7bba0e262b1a6b598f99fb9b35c (diff)
Re-name "lux/data/error" to "lux/control/try".
Diffstat (limited to 'stdlib/source/spec/compositor/generation')
-rw-r--r--stdlib/source/spec/compositor/generation/case.lux24
-rw-r--r--stdlib/source/spec/compositor/generation/common.lux58
-rw-r--r--stdlib/source/spec/compositor/generation/function.lux1
-rw-r--r--stdlib/source/spec/compositor/generation/primitive.lux8
-rw-r--r--stdlib/source/spec/compositor/generation/reference.lux13
-rw-r--r--stdlib/source/spec/compositor/generation/structure.lux12
6 files changed, 57 insertions, 59 deletions
diff --git a/stdlib/source/spec/compositor/generation/case.lux b/stdlib/source/spec/compositor/generation/case.lux
index 5b1187210..43069bcb4 100644
--- a/stdlib/source/spec/compositor/generation/case.lux
+++ b/stdlib/source/spec/compositor/generation/case.lux
@@ -4,9 +4,9 @@
[abstract
[monad (#+ do)]]
[control
- [pipe (#+ case>)]]
+ [pipe (#+ case>)]
+ ["." try (#+ Try)]]
[data
- ["." error (#+ Error)]
["." text ("#@." equivalence)
["%" format (#+ format)]]
[collection
@@ -36,11 +36,11 @@
(n/= (dec size) idx))
(def: #export (verify expected)
- (-> Frac (Error Any) Bit)
- (|>> (case> (#error.Success actual)
+ (-> Frac (Try Any) Bit)
+ (|>> (case> (#try.Success actual)
(f/= expected (:coerce Frac actual))
- (#error.Failure error)
+ (#try.Failure _)
false)))
(def: case
@@ -228,7 +228,7 @@
(def: special-pattern-path
Path
($_ synthesis.path/alt
- (<| error.assume
+ (<| try.assume
(phase.run [extension/synthesis.bundle
synthesis.init])
(case.path phase/synthesis.phase
@@ -250,28 +250,28 @@
(_.test "CODE"
(|> special-input
(run "special-input")
- (case> (#error.Success output)
+ (case> (#try.Success output)
true
- (#error.Failure error)
+ (#try.Failure _)
false)))
(_.test "PATTERN-MATCHING 0"
(|> (synthesis.branch/case [special-input
special-path])
(run "special-path")
- (case> (#error.Success output)
+ (case> (#try.Success output)
true
- (#error.Failure error)
+ (#try.Failure _)
false)))
(_.test "PATTERN-MATCHING 1"
(|> (synthesis.branch/case [special-input
special-pattern-path])
(run "special-pattern-path")
- (case> (#error.Success output)
+ (case> (#try.Success output)
true
- (#error.Failure error)
+ (#try.Failure _)
false)))
))
diff --git a/stdlib/source/spec/compositor/generation/common.lux b/stdlib/source/spec/compositor/generation/common.lux
index a4037c9d4..f10f2a2ef 100644
--- a/stdlib/source/spec/compositor/generation/common.lux
+++ b/stdlib/source/spec/compositor/generation/common.lux
@@ -4,9 +4,9 @@
[abstract
[monad (#+ do)]]
[control
- [pipe (#+ case>)]]
+ [pipe (#+ case>)]
+ ["." try (#+ Try)]]
[data
- ["." error (#+ Error)]
["." bit ("#@." equivalence)]
[number
["." i64]]
@@ -39,10 +39,10 @@
(|> (#synthesis.Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject)))
(run (..sanitize <extension>))
- (case> (#error.Success valueT)
+ (case> (#try.Success valueT)
(n/= (<reference> param subject) (:coerce Nat valueT))
- (#error.Failure error)
+ (#try.Failure _)
false)
(let [param <param-expr>])))]
@@ -59,12 +59,12 @@
(list (synthesis.i64 subject)
(synthesis.i64 param)))
(run (..sanitize "lux i64 arithmetic-right-shift"))
- (case> (#error.Success valueT)
+ (case> (#try.Success valueT)
("lux i64 ="
(i64.arithmetic-right-shift param subject)
(:coerce I64 valueT))
- (#error.Failure error)
+ (#try.Failure _)
false)
(let [param (n/% 64 param)])))
))))
@@ -79,10 +79,10 @@
[(_.test <extension>
(|> (#synthesis.Extension <extension> (list (synthesis.i64 subject)))
(run (..sanitize <extension>))
- (case> (#error.Success valueT)
+ (case> (#try.Success valueT)
(<comp> (<prepare> subject) (:coerce <type> valueT))
- (#error.Failure error)
+ (#try.Failure _)
false)
(let [subject <subject-expr>])))]
@@ -97,10 +97,10 @@
(|> (#synthesis.Extension <extension> (list (synthesis.i64 param)
(synthesis.i64 subject)))
(run (..sanitize <extension>))
- (case> (#error.Success valueT)
+ (case> (#try.Success valueT)
(<comp> (<reference> param subject) (:coerce <outputT> valueT))
- (#error.Failure error)
+ (#try.Failure _)
false)))]
["lux i64 +" i/+ Int i/=]
@@ -141,7 +141,7 @@
(|> (#synthesis.Extension <extension> (list (synthesis.f64 param)
(synthesis.f64 subject)))
(run (..sanitize <extension>))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(bit@= (<text> param subject)
(:coerce Bit valueV))
@@ -190,14 +190,14 @@
(_.test "Can compare texts for equality."
(and (|> (#synthesis.Extension "lux text =" (list sample-lowerS sample-lowerS))
(run (..sanitize "lux text ="))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(:coerce Bit valueV)
_
false))
(|> (#synthesis.Extension "lux text =" (list sample-upperS sample-lowerS))
(run (..sanitize "lux text ="))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(not (:coerce Bit valueV))
_
@@ -205,15 +205,15 @@
(_.test "Can compare texts for order."
(|> (#synthesis.Extension "lux text <" (list sample-lowerS sample-upperS))
(run (..sanitize "lux text <"))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(:coerce Bit valueV)
- (#error.Failure error)
+ (#try.Failure _)
false)))
(_.test "Can get length of text."
(|> (#synthesis.Extension "lux text size" (list sample-lowerS))
(run (..sanitize "lux text size"))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(n/= sample-size (:coerce Nat valueV))
_
@@ -221,7 +221,7 @@
(_.test "Can concatenate text."
(|> (#synthesis.Extension "lux text size" (list concatenatedS))
(run (..sanitize "lux text size"))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(n/= (n/* 2 sample-size) (:coerce Nat valueV))
_
@@ -231,7 +231,7 @@
(list concatenatedS sample-lowerS
(synthesis.i64 +0)))
(run (..sanitize "lux text index"))
- (case> (^multi (#error.Success valueV)
+ (case> (^multi (#try.Success valueV)
[(:coerce (Maybe Nat) valueV) (#.Some valueV)])
(n/= 0 valueV)
@@ -241,7 +241,7 @@
(list concatenatedS sample-upperS
(synthesis.i64 +0)))
(run (..sanitize "lux text index"))
- (case> (^multi (#error.Success valueV)
+ (case> (^multi (#try.Success valueV)
[(:coerce (Maybe Nat) valueV) (#.Some valueV)])
(n/= sample-size valueV)
@@ -254,7 +254,7 @@
(synthesis.i64 from)
(synthesis.i64 to)))
(run (..sanitize "lux text clip"))
- (case> (^multi (#error.Success valueV)
+ (case> (^multi (#try.Success valueV)
[(:coerce (Maybe Text) valueV) (#.Some valueV)])
(text@= expected valueV)
@@ -268,7 +268,7 @@
(list sample-lowerS
(synthesis.i64 char-idx)))
(run (..sanitize "lux text char"))
- (case> (^multi (#error.Success valueV)
+ (case> (^multi (#try.Success valueV)
[(:coerce (Maybe Int) valueV) (#.Some valueV)])
(text.contains? ("lux i64 char" valueV)
sample-lower)
@@ -286,10 +286,10 @@
(|> (#synthesis.Extension "lux io log"
(list (synthesis.text (format "LOG: " message))))
(run (..sanitize "lux io log"))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
true
- (#error.Failure error)
+ (#try.Failure _)
false)))
(_.test "Can throw runtime errors."
(and (|> (#synthesis.Extension "lux try"
@@ -299,8 +299,8 @@
#synthesis.body (#synthesis.Extension "lux io error"
(list (synthesis.text message)))})))
(run (..sanitize "lux try"))
- (case> (^multi (#error.Success valueV)
- [(:coerce (Error Text) valueV) (#error.Failure error)])
+ (case> (^multi (#try.Success valueV)
+ [(:coerce (Try Text) valueV) (#try.Failure error)])
(text.contains? message error)
_
@@ -311,8 +311,8 @@
#synthesis.arity 1
#synthesis.body (synthesis.text message)})))
(run (..sanitize "lux try"))
- (case> (^multi (#error.Success valueV)
- [(:coerce (Error Text) valueV) (#error.Success valueV)])
+ (case> (^multi (#try.Success valueV)
+ [(:coerce (Try Text) valueV) (#try.Success valueV)])
(text@= message valueV)
_
@@ -321,11 +321,11 @@
(|> (synthesis.tuple (list (#synthesis.Extension "lux io current-time" (list))
(#synthesis.Extension "lux io current-time" (list))))
(run (..sanitize "lux io current-time"))
- (case> (#error.Success valueV)
+ (case> (#try.Success valueV)
(let [[pre post] (:coerce [Nat Nat] valueV)]
(n/>= pre post))
- (#error.Failure error)
+ (#try.Failure _)
false)))
)))
diff --git a/stdlib/source/spec/compositor/generation/function.lux b/stdlib/source/spec/compositor/generation/function.lux
index 0f12906a0..0b8810620 100644
--- a/stdlib/source/spec/compositor/generation/function.lux
+++ b/stdlib/source/spec/compositor/generation/function.lux
@@ -7,7 +7,6 @@
[pipe (#+ case>)]]
[data
["." maybe]
- ["." error (#+ Error)]
[collection
["." list ("#@." functor)]]]
[math
diff --git a/stdlib/source/spec/compositor/generation/primitive.lux b/stdlib/source/spec/compositor/generation/primitive.lux
index 48ff99933..e3068a50a 100644
--- a/stdlib/source/spec/compositor/generation/primitive.lux
+++ b/stdlib/source/spec/compositor/generation/primitive.lux
@@ -4,9 +4,9 @@
[abstract
[monad (#+ do)]]
[control
- [pipe (#+ case>)]]
+ [pipe (#+ case>)]
+ ["." try]]
[data
- ["." error]
["." bit ("#@." equivalence)]
[number
["." frac]]
@@ -34,10 +34,10 @@
[expected <gen>]
(_.test (%.name (name-of <synthesis>))
(|> (run <evaluation-name> (<synthesis> expected))
- (case> (#error.Success actual)
+ (case> (#try.Success actual)
(<test> expected (:assume actual))
- (#error.Failure error)
+ (#try.Failure _)
false))))]
["bit" synthesis.bit r.bit bit@=]
diff --git a/stdlib/source/spec/compositor/generation/reference.lux b/stdlib/source/spec/compositor/generation/reference.lux
index 066b604dc..eb5e3bf92 100644
--- a/stdlib/source/spec/compositor/generation/reference.lux
+++ b/stdlib/source/spec/compositor/generation/reference.lux
@@ -4,9 +4,8 @@
[abstract
[monad (#+ do)]]
[control
- [pipe (#+ case>)]]
- [data
- ["." error]]
+ [pipe (#+ case>)]
+ ["." try]]
[tool
[compiler
["." reference]
@@ -28,10 +27,10 @@
expected r.safe-frac]
(_.test "Definitions."
(|> (define name (synthesis.f64 expected))
- (case> (#error.Success actual)
+ (case> (#try.Success actual)
(f/= expected (:coerce Frac actual))
- (#error.Failure error)
+ (#try.Failure _)
false)))))
(def: (variable run)
@@ -44,10 +43,10 @@
register
(synthesis.variable/local register)])
(run "variable")
- (case> (#error.Success actual)
+ (case> (#try.Success actual)
(f/= expected (:coerce Frac actual))
- (#error.Failure error)
+ (#try.Failure _)
false)))))
(def: #export (spec runner definer)
diff --git a/stdlib/source/spec/compositor/generation/structure.lux b/stdlib/source/spec/compositor/generation/structure.lux
index d22775a43..619f3921f 100644
--- a/stdlib/source/spec/compositor/generation/structure.lux
+++ b/stdlib/source/spec/compositor/generation/structure.lux
@@ -4,9 +4,9 @@
[abstract
[monad (#+ do)]]
[control
- [pipe (#+ case>)]]
+ [pipe (#+ case>)]
+ ["." try]]
[data
- ["." error]
["." maybe]
["." text ("#@." equivalence)
["%" format (#+ format)]]
@@ -39,7 +39,7 @@
#analysis.right? last?-in
#analysis.value (synthesis.i64 value-in)})
(run "variant")
- (case> (#error.Success valueT)
+ (case> (#try.Success valueT)
(let [valueT (:coerce (Array Any) valueT)]
(and (n/= 3 (array.size valueT))
(let [tag-out (:coerce java/lang/Integer (maybe.assume (array.read 0 valueT)))
@@ -57,7 +57,7 @@
same-flag?
same-value?))))
- (#error.Failure error)
+ (#try.Failure _)
false)))))
(def: (tuple run)
@@ -68,14 +68,14 @@
(_.test (%.name (name-of synthesis.tuple))
(|> (synthesis.tuple (list@map (|>> synthesis.i64) tuple-in))
(run "tuple")
- (case> (#error.Success tuple-out)
+ (case> (#try.Success tuple-out)
(let [tuple-out (:coerce (Array Any) tuple-out)]
(and (n/= size (array.size tuple-out))
(list.every? (function (_ [left right])
(i/= left (:coerce Int right)))
(list.zip2 tuple-in (array.to-list tuple-out)))))
- (#error.Failure error)
+ (#try.Failure _)
false)))))
(def: #export (spec runner)