aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/program')
-rw-r--r--stdlib/source/program/compositor.lux30
-rw-r--r--stdlib/source/program/licentia.lux14
-rw-r--r--stdlib/source/program/scriptum.lux10
3 files changed, 27 insertions, 27 deletions
diff --git a/stdlib/source/program/compositor.lux b/stdlib/source/program/compositor.lux
index ef11ab060..2a6f9bfd4 100644
--- a/stdlib/source/program/compositor.lux
+++ b/stdlib/source/program/compositor.lux
@@ -5,13 +5,13 @@
[monad (#+ do)]]
[control
["." io (#+ IO io)]
+ ["." try (#+ Try)]
[parser
[cli (#+ program:)]]
[security
["!" capability]]]
[data
["." product]
- ["." error (#+ Error)]
["." text
["%" format (#+ format)]]
[collection
@@ -44,24 +44,24 @@
(def: (or-crash! failure-description action)
(All [a]
- (-> Text (IO (Error a)) (IO a)))
+ (-> Text (IO (Try a)) (IO a)))
(do io.monad
[?output action]
(case ?output
- (#error.Failure error)
+ (#try.Failure error)
(exec (log! (format text.new-line
failure-description text.new-line
error text.new-line))
(io.exit +1))
- (#error.Success output)
+ (#try.Success output)
(wrap output))))
(def: (save-artifacts! system state)
(All [anchor expression statement]
(-> (file.System IO)
(statement.State+ anchor expression statement)
- (IO (Error Any))))
+ (IO (Try Any))))
(let [?outcome (phase.run' state
(:share [anchor expression statement]
{(statement.State+ anchor expression statement)
@@ -70,14 +70,14 @@
(generation.Output statement))
(statement.lift-generation generation.output)}))]
(case ?outcome
- (#error.Success [state output])
- (do (error.with io.monad)
- [file (: (IO (Error (File IO)))
+ (#try.Success [state output])
+ (do (try.with io.monad)
+ [file (: (IO (Try (File IO)))
(file.get-file io.monad system "program.js"))]
(!.use (:: file over-write) (script.package output)))
- (#error.Failure error)
- (:: io.monad wrap (#error.Failure error)))))
+ (#try.Failure error)
+ (:: io.monad wrap (#try.Failure error)))))
(def: #export (compiler target partial-host-extension expander host-analysis platform generation-bundle host-statement-bundle program service)
(All [anchor expression statement]
@@ -93,20 +93,20 @@
(IO Any)))
(do io.monad
[platform platform
- console (:: @ map error.assume console.system)]
+ console (:: @ map try.assume console.system)]
(case service
(#cli.Compilation configuration)
(<| (or-crash! "Compilation failed:")
- (do (error.with io.monad)
+ (do (try.with io.monad)
[state (:share [anchor expression statement]
{(Platform IO anchor expression statement)
platform}
- {(IO (Error (statement.State+ anchor expression statement)))
+ {(IO (Try (statement.State+ anchor expression statement)))
(platform.initialize target expander host-analysis platform generation-bundle host-statement-bundle program)})
[archive state] (:share [anchor expression statement]
{(Platform IO anchor expression statement)
platform}
- {(IO (Error [Archive (statement.State+ anchor expression statement)]))
+ {(IO (Try [Archive (statement.State+ anchor expression statement)]))
(platform.compile partial-host-extension expander platform configuration archive.empty state)})
_ (save-artifacts! (get@ #platform.&file-system platform) state)
## _ (cache/io.clean target ...)
@@ -117,5 +117,5 @@
## TODO: Fix the interpreter...
(undefined)
## (<| (or-crash! "Interpretation failed:")
- ## (interpreter.run (error.with io.monad) console platform configuration generation-bundle))
+ ## (interpreter.run (try.with io.monad) console platform configuration generation-bundle))
)))
diff --git a/stdlib/source/program/licentia.lux b/stdlib/source/program/licentia.lux
index 7f19a829c..5021eb5bb 100644
--- a/stdlib/source/program/licentia.lux
+++ b/stdlib/source/program/licentia.lux
@@ -17,12 +17,12 @@
[monad (#+ do)]]
[control
[remember (#+ to-do)]
+ ["." try (#+ Try)]
["." parser]
[security
["!" capability]]]
[data
["." maybe]
- ["." error (#+ Error)]
["." text
["%" format (#+ format)]
["." encoding]]
@@ -55,11 +55,11 @@
{output (parser.default ..default-output-file
(cli.named "--output" cli.any))}]
(do io.monad
- [?done (: (IO (Error Any))
- (do (error.with io.monad)
+ [?done (: (IO (Try Any))
+ (do (try.with io.monad)
[file (!.use (:: file.system file) input)
blob (!.use (:: file content) [])
- document (io;wrap (do error.monad
+ document (io;wrap (do try.monad
[raw-json (encoding.from-utf8 blob)
json (|> raw-json
(:coerce java/lang/String)
@@ -67,12 +67,12 @@
(:: json.codec decode))
license (json.run json /input.license)]
(wrap (/output.license license))))
- output-file (: (IO (Error (File IO)))
+ output-file (: (IO (Try (File IO)))
(file.get-file io.monad file.system output))]
(!.use (:: output-file over-write) (encoding.to-utf8 document))))]
(case ?done
- (#error.Success _)
+ (#try.Success _)
(wrap (log! (success-message output)))
- (#error.Failure message)
+ (#try.Failure message)
(wrap (log! message)))))
diff --git a/stdlib/source/program/scriptum.lux b/stdlib/source/program/scriptum.lux
index 569371900..3775fd006 100644
--- a/stdlib/source/program/scriptum.lux
+++ b/stdlib/source/program/scriptum.lux
@@ -4,6 +4,7 @@
["." monad (#+ do)]]
[control
[pipe (#+ when>)]
+ ["." try (#+ Try)]
["ex" exception (#+ exception:)]
[security
["!" capability]]]
@@ -11,7 +12,6 @@
[data
["." maybe]
["." product]
- ["." error (#+ Error)]
[format
["md" markdown (#+ Markdown Span Block)]]
["." text ("#;." equivalence)
@@ -484,15 +484,15 @@
(-> [Text (Markdown Block)] (IO Any))
(let [path (format (text.replace-all "/" "_" module-name) ".md")]
(do io.monad
- [outcome (do (error.with io.monad)
- [target (: (IO (Error (File IO)))
+ [outcome (do (try.with io.monad)
+ [target (: (IO (Try (File IO)))
(file.get-file io.monad file.system path))]
(!.use (:: target over-write) (encoding.to-utf8 (md.markdown documentation))))]
(case outcome
- (#error.Failure error)
+ (#try.Failure error)
(wrap (log! (ex.construct io-error error)))
- (#error.Success _)
+ (#try.Success _)
(wrap [])))))
(macro: (gen-documentation! _)