From 343fda007c09deb70917a4afda19891cacf54504 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 Sep 2021 03:09:37 -0400 Subject: Undid the foolish re-design of "abstract:" and "actor:". --- .../library/lux/control/security/capability.lux | 74 +++++------ .../source/library/lux/control/security/policy.lux | 142 ++++++++++----------- 2 files changed, 108 insertions(+), 108 deletions(-) (limited to 'stdlib/source/library/lux/control/security') diff --git a/stdlib/source/library/lux/control/security/capability.lux b/stdlib/source/library/lux/control/security/capability.lux index 4bdab69c1..2a49f4b51 100644 --- a/stdlib/source/library/lux/control/security/capability.lux +++ b/stdlib/source/library/lux/control/security/capability.lux @@ -26,44 +26,44 @@ (abstract: .public (Capability brand input output) (-> input output) - [(def: capability - (All (_ brand input output) - (-> (-> input output) - (Capability brand input output))) - (|>> :abstraction)) + (def: capability + (All (_ brand input output) + (-> (-> input output) + (Capability brand input output))) + (|>> :abstraction)) - (def: .public (use capability input) - (All (_ brand input output) - (-> (Capability brand input output) - input - output)) - ((:representation capability) input)) + (def: .public (use capability input) + (All (_ brand input output) + (-> (Capability brand input output) + input + output)) + ((:representation capability) input)) - (syntax: .public (capability: [[export_policy declaration [forger input output]] - (|export|.parser - ($_ <>.and - |declaration|.parser - (.form ($_ <>.and .local_identifier .any .any))))]) - (macro.with_identifiers [g!_] - (do [! meta.monad] - [this_module meta.current_module_name - .let [[name vars] declaration] - g!brand (\ ! each (|>> %.code code.text) - (macro.identifier (format (%.name [this_module name])))) - .let [capability (` (..Capability (.primitive (~ g!brand)) (~ input) (~ output)))]] - (in (list (` (type: (~ export_policy) - (~ (|declaration|.format declaration)) - (~ capability))) - (` (def: (~ (code.local_identifier forger)) - (All ((~ g!_) (~+ (list\each code.local_identifier vars))) - (-> (-> (~ input) (~ output)) - (~ capability))) - (~! ..capability))) - ))))) + (syntax: .public (capability: [[export_policy declaration [forger input output]] + (|export|.parser + ($_ <>.and + |declaration|.parser + (.form ($_ <>.and .local_identifier .any .any))))]) + (macro.with_identifiers [g!_] + (do [! meta.monad] + [this_module meta.current_module_name + .let [[name vars] declaration] + g!brand (\ ! each (|>> %.code code.text) + (macro.identifier (format (%.name [this_module name])))) + .let [capability (` (..Capability (.primitive (~ g!brand)) (~ input) (~ output)))]] + (in (list (` (type: (~ export_policy) + (~ (|declaration|.format declaration)) + (~ capability))) + (` (def: (~ (code.local_identifier forger)) + (All ((~ g!_) (~+ (list\each code.local_identifier vars))) + (-> (-> (~ input) (~ output)) + (~ capability))) + (~! ..capability))) + ))))) - (def: .public (async capability) - (All (_ brand input output) - (-> (Capability brand input (IO output)) - (Capability brand input (Async output)))) - (..capability (|>> ((:representation capability)) async.future)))] + (def: .public (async capability) + (All (_ brand input output) + (-> (Capability brand input (IO output)) + (Capability brand input (Async output)))) + (..capability (|>> ((:representation capability)) async.future))) ) diff --git a/stdlib/source/library/lux/control/security/policy.lux b/stdlib/source/library/lux/control/security/policy.lux index f0a55bdd4..7b15e4210 100644 --- a/stdlib/source/library/lux/control/security/policy.lux +++ b/stdlib/source/library/lux/control/security/policy.lux @@ -11,83 +11,83 @@ (abstract: .public (Policy brand value label) value - [(type: .public (Can_Upgrade brand label value) - (-> value (Policy brand value label))) - - (type: .public (Can_Downgrade brand label value) - (-> (Policy brand value label) value)) - - (type: .public (Privilege brand label) - (Record - [#can_upgrade (Can_Upgrade brand label) - #can_downgrade (Can_Downgrade brand label)])) - - (type: .public (Delegation brand from to) - (All (_ value) - (-> (Policy brand value from) - (Policy brand value to)))) - - (def: .public (delegation downgrade upgrade) - (All (_ brand from to) - (-> (Can_Downgrade brand from) (Can_Upgrade brand to) - (Delegation brand from to))) - (|>> downgrade upgrade)) - - (type: .public (Context brand scope label) - (-> (Privilege brand label) - (scope label))) - - (def: privilege - Privilege - [#can_upgrade (|>> :abstraction) - #can_downgrade (|>> :representation)]) - - (def: .public (with_policy context) - (All (_ brand scope) - (Ex (_ label) - (-> (Context brand scope label) - (scope label)))) - (context ..privilege)) - - (def: (of_policy constructor) - (-> Type Type) - (type (All (_ brand label) - (constructor (All (_ value) (Policy brand value label)))))) - - (implementation: .public functor - (:~ (..of_policy Functor)) - - (def: (each f fa) - (|> fa :representation f :abstraction))) - - (implementation: .public apply - (:~ (..of_policy Apply)) - - (def: &functor ..functor) - - (def: (on fa ff) - (:abstraction ((:representation ff) (:representation fa))))) - - (implementation: .public monad - (:~ (..of_policy Monad)) - - (def: &functor ..functor) - (def: in (|>> :abstraction)) - (def: conjoint (|>> :representation)))] + (type: .public (Can_Upgrade brand label value) + (-> value (Policy brand value label))) + + (type: .public (Can_Downgrade brand label value) + (-> (Policy brand value label) value)) + + (type: .public (Privilege brand label) + (Record + [#can_upgrade (Can_Upgrade brand label) + #can_downgrade (Can_Downgrade brand label)])) + + (type: .public (Delegation brand from to) + (All (_ value) + (-> (Policy brand value from) + (Policy brand value to)))) + + (def: .public (delegation downgrade upgrade) + (All (_ brand from to) + (-> (Can_Downgrade brand from) (Can_Upgrade brand to) + (Delegation brand from to))) + (|>> downgrade upgrade)) + + (type: .public (Context brand scope label) + (-> (Privilege brand label) + (scope label))) + + (def: privilege + Privilege + [#can_upgrade (|>> :abstraction) + #can_downgrade (|>> :representation)]) + + (def: .public (with_policy context) + (All (_ brand scope) + (Ex (_ label) + (-> (Context brand scope label) + (scope label)))) + (context ..privilege)) + + (def: (of_policy constructor) + (-> Type Type) + (type (All (_ brand label) + (constructor (All (_ value) (Policy brand value label)))))) + + (implementation: .public functor + (:~ (..of_policy Functor)) + + (def: (each f fa) + (|> fa :representation f :abstraction))) + + (implementation: .public apply + (:~ (..of_policy Apply)) + + (def: &functor ..functor) + + (def: (on fa ff) + (:abstraction ((:representation ff) (:representation fa))))) + + (implementation: .public monad + (:~ (..of_policy Monad)) + + (def: &functor ..functor) + (def: in (|>> :abstraction)) + (def: conjoint (|>> :representation))) ) (template [ ] [(abstract: .public Any - [(type: .public - (Policy )) - - (type: .public - (Can_Upgrade )) - - (type: .public - (Can_Downgrade ))] + (type: .public + (Policy )) + + (type: .public + (Can_Upgrade )) + + (type: .public + (Can_Downgrade )) )] [Privacy Private Can_Conceal Can_Reveal] -- cgit v1.2.3