aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/type/resource.lux38
1 files changed, 23 insertions, 15 deletions
diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux
index 7de8fddf5..526dbecc9 100644
--- a/stdlib/source/lux/type/resource.lux
+++ b/stdlib/source/lux/type/resource.lux
@@ -4,7 +4,8 @@
["ex" exception #+ exception:]
[monad #+ Monad do]
(monad [indexed #+ IxMonad]))
- (data [maybe]
+ (data [identity #+ Identity]
+ [maybe]
[product]
[number]
text/format
@@ -64,8 +65,9 @@
[output procedure]
(wrap [keys output]))))]
- [IxMonad<Sync> IO io.Monad<IO> run lift]
- [IxMonad<Async> Promise promise.Monad<Promise> run! lift!]
+ [IxMonad<Pure> Identity identity.Monad<Identity> run-pure lift-pure]
+ [IxMonad<Sync> IO io.Monad<IO> run-sync lift-sync]
+ [IxMonad<Async> Promise promise.Monad<Promise> run-async lift-async]
)
(abstract: #export Ordered {} [])
@@ -97,10 +99,12 @@
(function (_ keys)
(:: <monad> wrap [[(<key> []) keys] (@abstraction value)])))]
- [ordered IO io.Monad<IO> Ordered ordered-key]
- [ordered! Promise promise.Monad<Promise> Ordered ordered-key]
- [commutative IO io.Monad<IO> Commutative commutative-key]
- [commutative! Promise promise.Monad<Promise> Commutative commutative-key])
+ [ordered-pure Identity identity.Monad<Identity> Ordered ordered-key]
+ [ordered-sync IO io.Monad<IO> Ordered ordered-key]
+ [ordered-async Promise promise.Monad<Promise> Ordered ordered-key]
+ [commutative-sync IO io.Monad<IO> Commutative commutative-key]
+ [commutative-pure Identity identity.Monad<Identity> Commutative commutative-key]
+ [commutative-async Promise promise.Monad<Promise> Commutative commutative-key])
(do-template [<name> <m> <monad>]
[(def: #export (<name> resource)
@@ -109,8 +113,9 @@
(function (_ [key keys])
(:: <monad> wrap [keys (@representation resource)])))]
- [read IO io.Monad<IO>]
- [read! Promise promise.Monad<Promise>]))
+ [read-pure Identity identity.Monad<Identity>]
+ [read-sync IO io.Monad<IO>]
+ [read-async Promise promise.Monad<Promise>]))
(exception: #export (Index-Cannot-Be-Repeated {index Nat})
(%n index))
@@ -165,8 +170,9 @@
(function ((~ g!_) [(~+ g!inputs) (~ g!context)])
(:: (~! <monad>) (~' wrap) [[(~+ g!outputs) (~ g!context)] []]))))))))))]
- [exchange IO io.Monad<IO>]
- [exchange! Promise promise.Monad<Promise>])
+ [exchange-pure Identity identity.Monad<Identity>]
+ [exchange-sync IO io.Monad<IO>]
+ [exchange-async Promise promise.Monad<Promise>])
(def: amount
(Syntax Nat)
@@ -189,8 +195,10 @@
(function ((~ g!_) [<from> (~ g!context)])
(:: (~! <monad>) (~' wrap) [[<to> (~ g!context)] []])))))))))]
- [group IO io.Monad<IO> (~+ g!keys) [(~+ g!keys)]]
- [group! Promise promise.Monad<Promise> (~+ g!keys) [(~+ g!keys)]]
- [un-group IO io.Monad<IO> [(~+ g!keys)] (~+ g!keys)]
- [un-group! Promise promise.Monad<Promise> [(~+ g!keys)] (~+ g!keys)]
+ [group-pure Identity identity.Monad<Identity> (~+ g!keys) [(~+ g!keys)]]
+ [group-sync IO io.Monad<IO> (~+ g!keys) [(~+ g!keys)]]
+ [group-async Promise promise.Monad<Promise> (~+ g!keys) [(~+ g!keys)]]
+ [un-group-pure Identity identity.Monad<Identity> [(~+ g!keys)] (~+ g!keys)]
+ [un-group-sync IO io.Monad<IO> [(~+ g!keys)] (~+ g!keys)]
+ [un-group-async Promise promise.Monad<Promise> [(~+ g!keys)] (~+ g!keys)]
)