aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/type/resource.lux
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--stdlib/source/library/lux/type/resource.lux40
1 files changed, 21 insertions, 19 deletions
diff --git a/stdlib/source/library/lux/type/resource.lux b/stdlib/source/library/lux/type/resource.lux
index 1ddc43d99..2a568e6fd 100644
--- a/stdlib/source/library/lux/type/resource.lux
+++ b/stdlib/source/library/lux/type/resource.lux
@@ -25,22 +25,22 @@
[type
abstract]]])
-(type: #export (Procedure monad input output value)
+(type: .public (Procedure monad input output value)
(-> input (monad [output value])))
-(type: #export (Linear monad value)
+(type: .public (Linear monad value)
(All [keys]
(Procedure monad keys keys value)))
-(type: #export (Affine monad permissions value)
+(type: .public (Affine monad permissions value)
(All [keys]
(Procedure monad keys [permissions keys] value)))
-(type: #export (Relevant monad permissions value)
+(type: .public (Relevant monad permissions value)
(All [keys]
(Procedure monad [permissions keys] keys value)))
-(implementation: #export (monad monad)
+(implementation: .public (monad monad)
(All [!] (-> (Monad !) (IxMonad (Procedure !))))
(def: (in value)
@@ -53,24 +53,26 @@
[[keysT value] (input keysI)]
((f value) keysT)))))
-(def: #export (run monad procedure)
+(def: .public (run monad procedure)
(All [! v] (-> (Monad !) (Linear ! v) (! v)))
(do monad
[[_ output] (procedure [])]
(in output)))
-(def: #export (lifted monad procedure)
+(def: .public (lifted monad procedure)
(All [! v] (-> (Monad !) (! v) (Linear ! v)))
(function (_ keys)
(do monad
[output procedure]
(in [keys output]))))
-(abstract: #export Ordered Any)
+(abstract: .public Ordered {} Any)
-(abstract: #export Commutative Any)
+(abstract: .public Commutative {} Any)
-(abstract: #export (Key mode key)
+(abstract: .public (Key mode key)
+ {}
+
Any
(template [<name> <mode>]
@@ -82,13 +84,13 @@
[commutative_key Commutative]
))
-(abstract: #export (Res key value)
- value
-
+(abstract: .public (Res key value)
{#.doc "A value locked by a key."}
+ value
+
(template [<name> <mode> <key>]
- [(def: #export (<name> monad value)
+ [(def: .public (<name> monad value)
(All [! v] (Ex [k] (-> (Monad !) v (Affine ! (Key <mode> k) (Res k v)))))
(function (_ keys)
(\ monad in [[(<key> []) keys] (:abstraction value)])))]
@@ -97,18 +99,18 @@
[commutative Commutative ..commutative_key]
)
- (def: #export (read monad resource)
+ (def: .public (read monad resource)
(All [! v k m]
(-> (Monad !) (Res k v) (Relevant ! (Key m k) v)))
(function (_ [key keys])
(\ monad in [keys (:representation resource)])))
)
-(exception: #export (index_cannot_be_repeated {index Nat})
+(exception: .public (index_cannot_be_repeated {index Nat})
(exception.report
["Index" (%.nat index)]))
-(exception: #export amount_cannot_be_zero)
+(exception: .public amount_cannot_be_zero)
(def: indices
(Parser (List Nat))
@@ -129,7 +131,7 @@
(function (_ context)
(\ monad in [context []])))
-(syntax: #export (exchange {swaps ..indices})
+(syntax: .public (exchange {swaps ..indices})
(macro.with_gensyms [g!_ g!context g!!]
(case swaps
#.End
@@ -168,7 +170,7 @@
(in raw)))
(template [<name> <from> <to>]
- [(syntax: #export (<name> {amount ..amount})
+ [(syntax: .public (<name> {amount ..amount})
(macro.with_gensyms [g!_ g!context g!!]
(do {! meta.monad}
[g!keys (|> (macro.gensym "keys")