diff options
Diffstat (limited to 'stdlib/source/lux/control/security/capability.lux')
-rw-r--r-- | stdlib/source/lux/control/security/capability.lux | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/stdlib/source/lux/control/security/capability.lux b/stdlib/source/lux/control/security/capability.lux deleted file mode 100644 index db3e38c26..000000000 --- a/stdlib/source/lux/control/security/capability.lux +++ /dev/null @@ -1,70 +0,0 @@ -(.module: - [lux #* - [abstract - [monad (#+ do)]] - [control - ["<>" parser - ["<c>" code]] - ["." io (#+ IO)] - [concurrency - ["." promise (#+ Promise)]]] - [data - [text - ["%" format (#+ format)]] - [collection - ["." list ("#\." functor)]]] - [type - abstract] - ["." meta] - ["." macro - ["." code] - [syntax (#+ syntax:) - ["|.|" export] - ["|.|" declaration] - ["|.|" annotations]]]]) - -(abstract: #export (Capability brand input output) - (-> input output) - - {#.doc (doc "Represents the capability to perform an operation." - "This operation is assumed to have security implications.")} - - (def: forge - (All [brand input output] - (-> (-> input output) - (Capability brand input output))) - (|>> :abstraction)) - - (def: #export (use capability input) - (All [brand input output] - (-> (Capability brand input output) - input - output)) - ((:representation capability) input)) - - (syntax: #export (capability: {export |export|.parser} - {declaration |declaration|.parser} - {annotations (<>.maybe |annotations|.parser)} - {[forge input output] (<c>.form ($_ <>.and <c>.local_identifier <c>.any <c>.any))}) - (do {! meta.monad} - [this_module meta.current_module_name - #let [[name vars] declaration] - g!brand (\ ! map (|>> %.code code.text) - (macro.gensym (format (%.name [this_module name])))) - #let [capability (` (..Capability (.primitive (~ g!brand)) (~ input) (~ output)))]] - (wrap (list (` (type: (~+ (|export|.format export)) - (~ (|declaration|.format declaration)) - (~ capability))) - (` (def: (~ (code.local_identifier forge)) - (All [(~+ (list\map code.local_identifier vars))] - (-> (-> (~ input) (~ output)) - (~ capability))) - (~! ..forge))) - )))) - - (def: #export (async capability) - (All [brand input output] - (-> (Capability brand input (IO output)) - (Capability brand input (Promise output)))) - (..forge (|>> ((:representation capability)) promise.future))) - ) |