aboutsummaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorEduardo Julian2018-12-24 19:50:00 -0400
committerEduardo Julian2018-12-24 19:50:00 -0400
commit8c0690e5a58dcf2588737a6d6a48d1e7f82a73f7 (patch)
treeccbe39c8bdc3e94012cd25c1d639b8b6c8e1f8ea /stdlib
parent0e32b3711890f6d8ab25e76ea7810ccd9445ef07 (diff)
Some refactoring.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/control/security/privacy.lux29
-rw-r--r--stdlib/source/lux/world/file.lux68
-rw-r--r--stdlib/source/lux/world/net.lux2
3 files changed, 52 insertions, 47 deletions
diff --git a/stdlib/source/lux/control/security/privacy.lux b/stdlib/source/lux/control/security/privacy.lux
index 100b76b17..e24d49acb 100644
--- a/stdlib/source/lux/control/security/privacy.lux
+++ b/stdlib/source/lux/control/security/privacy.lux
@@ -5,7 +5,9 @@
[apply (#+ Apply)]
[monad (#+ Monad)]]
[type
- abstract]])
+ abstract]]
+ [//
+ [capability (#+ Capability)]])
(abstract: #export (Private value label)
{#.doc (doc "A value that is regarded as 'private'."
@@ -19,21 +21,22 @@
## there to prevent confusing private values from different origins.
value
- (type: #export (Close label)
+ (type: #export (Can-Conceal label)
{#.doc (doc "Represents the capacity to 'privatize' a value.")}
- (All [value] (-> value (Private value label))))
+ (All [value]
+ (Capability value
+ (Private value label))))
- (type: #export (Open label)
+ (type: #export (Can-Reveal label)
{#.doc (doc "Represents the capacity to 'publicize' a value.")}
- (All [value] (-> (Private value label) value)))
+ (All [value]
+ (Capability (Private value label)
+ value)))
(signature: #export (Privilege label)
{#.doc (doc "Represents the privilege to both 'privatize' and 'publicize' a value.")}
- (: (Close label)
- conceal)
-
- (: (Open label)
- reveal))
+ [(Can-Conceal label)
+ (Can-Reveal label)])
(def: Privilege<_>
Privilege
@@ -44,10 +47,10 @@
{#.doc (doc "Represents the act of delegating privatization capacities.")}
(All [value] (-> (Private value from) (Private value to))))
- (def: #export (delegation open close)
+ (def: #export (delegation reveal conceal)
{#.doc (doc "Delegating privatization capacities.")}
- (All [from to] (-> (Open from) (Close to) (Delegation from to)))
- (|>> open close))
+ (All [from to] (-> (Can-Reveal from) (Can-Conceal to) (Delegation from to)))
+ (|>> reveal conceal))
(type: #export (Context scope label)
{#.doc (doc "A computational context with an associated privacy privilege.")}
diff --git a/stdlib/source/lux/world/file.lux b/stdlib/source/lux/world/file.lux
index df90ba842..f959e1af3 100644
--- a/stdlib/source/lux/world/file.lux
+++ b/stdlib/source/lux/world/file.lux
@@ -46,34 +46,34 @@
(type: #export (Can-Modify ! i)
(Capability [i] (! (Error Any))))
-(signature: #export (File !)
- (~~ (do-template [<name> <output>]
- [(: (Can-Query ! <output>)
- <name>)]
+(`` (signature: #export (File !)
+ (~~ (do-template [<name> <output>]
+ [(: (Can-Query ! <output>)
+ <name>)]
- [size Nat]
- [last-modified Instant]
- [can-execute? Bit]
- [content (Dirty Binary)]
- ))
+ [size Nat]
+ [last-modified Instant]
+ [can-execute? Bit]
+ [content (Dirty Binary)]
+ ))
- (: (Can-Open ! File)
- move)
+ (: (Can-Open ! File)
+ move)
- (do-template [<name> <input>]
- [(: (Can-Modify ! <input>)
- <name>)]
+ (~~ (do-template [<name> <input>]
+ [(: (Can-Modify ! <input>)
+ <name>)]
- [modify Instant]
- [over-write Binary]
- )
+ [modify Instant]
+ [over-write Binary]
+ ))
- (: (Can-Edit !)
- append)
+ (: (Can-Edit !)
+ append)
- (: (Can-Delete !)
- delete)
- )
+ (: (Can-Delete !)
+ delete)
+ ))
(signature: #export (Directory !)
(: (Can-Query ! (List (File !)))
@@ -85,20 +85,20 @@
(: (Can-Delete !)
discard))
-(signature: #export (System !)
- (~~ (do-template [<name> <capability>]
- [(: (Can-Open ! <capability>)
- <name>)]
+(`` (signature: #export (System !)
+ (~~ (do-template [<name> <capability>]
+ [(: (Can-Open ! <capability>)
+ <name>)]
- [file File]
- [create-file File]
- [directory Directory]
- [create-directory Directory]
- ))
+ [file File]
+ [create-file File]
+ [directory Directory]
+ [create-directory Directory]
+ ))
- (: Text
- separator)
- )
+ (: Text
+ separator)
+ ))
(def: (async-file file)
(-> (File IO) (File Promise))
diff --git a/stdlib/source/lux/world/net.lux b/stdlib/source/lux/world/net.lux
index a29df5f84..a56c9c62e 100644
--- a/stdlib/source/lux/world/net.lux
+++ b/stdlib/source/lux/world/net.lux
@@ -10,6 +10,8 @@
(type: #export Port Nat)
+(type: #export URL Text)
+
(type: #export Location
{#address Address
#port Port})