diff options
Diffstat (limited to '')
3 files changed, 24 insertions, 15 deletions
diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 24e627960..48323d842 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -26,14 +26,14 @@ (primitive .public (Capability brand input output) (-> input output) - (def .public (use capability input) + (def .public (use it input) (All (_ brand input output) (-> (Capability brand input output) input output)) - ((representation capability) input)) + ((representation it) input)) - (def .public capability: + (def .public capability (syntax (_ [[export_policy declaration [forger input output]] (|export|.parser (all <>.and @@ -45,20 +45,20 @@ .let [[name vars] declaration] g!brand (at ! each (|>> %.code code.text) (macro.symbol (format (%.symbol [this_module name])))) - .let [capability (` (..Capability (.Primitive (, g!brand)) (, input) (, output)))]] + .let [type (` (..Capability (.Primitive (, g!brand)) (, input) (, output)))]] (in (list (` (type (, export_policy) (, (|declaration|.format declaration)) - (, capability))) + (, type))) (` (def (, (code.local forger)) (All ((, g!_) (,* (list#each code.local vars))) (-> (-> (, input) (, output)) - (, capability))) + (, type))) (|>> as_expected))) )))))) - (def .public (async capability) + (def .public (async it) (All (_ brand input output) (-> (Capability brand input (IO output)) (Capability brand input (Async output)))) - (abstraction (|>> ((representation capability)) async.future))) + (abstraction (|>> ((representation it)) async.future))) ) diff --git a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux index 2db7b161f..ec4a32d05 100644 --- a/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux +++ b/stdlib/source/library/lux/meta/compiler/language/lux/phase/analysis/complex.lux @@ -64,10 +64,18 @@ ["Expression" (%.code code)])))] [invalid_variant_type] - [cannot_analyse_variant] + [cannot_analyse_sum] [cannot_infer_sum] ) +(exception .public (cannot_analyse_variant [type Type + tag Symbol + code Code]) + (exception.report + (list ["Type" (%.type type)] + ["Tag" (%.symbol tag)] + ["Expression" (%.code code)]))) + (exception .public (cannot_repeat_slot [key Symbol record (List [Symbol Code])]) (exception.report @@ -104,7 +112,7 @@ (do [! ///.monad] [expectedT (///extension.lifted meta.expected_type) expectedT' (/type.check (check.clean (list) expectedT))] - (/.with_exception ..cannot_analyse_variant [expectedT' lefts right? valueC] + (/.with_exception ..cannot_analyse_sum [expectedT' lefts right? valueC] (case expectedT {.#Sum _} (|> (analyse archive valueC) @@ -184,7 +192,8 @@ (in (/.variant [lefts right? (|> valueA+ list.head maybe.trusted)]))) _ - (..sum analyse lefts right? archive valueC)))) + (/.with_exception ..cannot_analyse_variant [expectedT tag valueC] + (..sum analyse lefts right? archive valueC))))) (def (typed_product analyse expectedT archive members) (-> Phase Type Archive (List Code) (Operation Analysis)) diff --git a/stdlib/source/library/lux/world/db/jdbc.lux b/stdlib/source/library/lux/world/db/jdbc.lux index 955335715..4c215de63 100644 --- a/stdlib/source/library/lux/world/db/jdbc.lux +++ b/stdlib/source/library/lux/world/db/jdbc.lux @@ -12,7 +12,7 @@ [concurrency ["[0]" async (.only Async) (.use "[1]#[0]" monad)]] [security - ["!" capability (.only capability:)]]] + ["!" capability (.only capability)]]] [data ["[0]" product] [text @@ -66,17 +66,17 @@ #value input])) (with_template [<name> <forge> <output>] - [(capability: .public (<name> ! i) + [(capability .public (<name> ! i) (<forge> (Statement i) (! (Try <output>))))] [Can_Execute can_execute Nat] [Can_Insert can_insert (List ID)] ) -(capability: .public (Can_Query ! i o) +(capability .public (Can_Query ! i o) (can_query [(Statement i) (Output o)] (! (Try (List o))))) -(capability: .public (Can_Close !) +(capability .public (Can_Close !) (can_close Any (! (Try Any)))) (type .public (DB !) |