diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux/type/resource.lux | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/stdlib/source/lux/type/resource.lux b/stdlib/source/lux/type/resource.lux index b91f9d990..26407ba39 100644 --- a/stdlib/source/lux/type/resource.lux +++ b/stdlib/source/lux/type/resource.lux @@ -74,9 +74,9 @@ [output procedure] (wrap [keys output]))))] - [pure Identity identity.monad run-pure lift-pure] - [sync IO io.monad run-sync lift-sync] - [async Promise promise.monad run-async lift-async] + [pure Identity identity.monad run_pure lift_pure] + [sync IO io.monad run_sync lift_sync] + [async Promise promise.monad run_async lift_async] ) (abstract: #export Ordered []) @@ -91,8 +91,8 @@ (Ex [k] (-> [] (Key <mode> k))) (|>> :abstraction))] - [ordered-key Ordered] - [commutative-key Commutative] + [ordered_key Ordered] + [commutative_key Commutative] )) (type: #export OK (Key Ordered)) @@ -109,12 +109,12 @@ (function (_ keys) (\ <monad> wrap [[(<key> []) keys] (:abstraction value)])))] - [ordered-pure Identity identity.monad Ordered ordered-key] - [ordered-sync IO io.monad Ordered ordered-key] - [ordered-async Promise promise.monad Ordered ordered-key] - [commutative-sync IO io.monad Commutative commutative-key] - [commutative-pure Identity identity.monad Commutative commutative-key] - [commutative-async Promise promise.monad Commutative commutative-key] + [ordered_pure Identity identity.monad Ordered ordered_key] + [ordered_sync IO io.monad Ordered ordered_key] + [ordered_async Promise promise.monad Ordered ordered_key] + [commutative_sync IO io.monad Commutative commutative_key] + [commutative_pure Identity identity.monad Commutative commutative_key] + [commutative_async Promise promise.monad Commutative commutative_key] ) (template [<name> <m> <monad>] @@ -124,16 +124,16 @@ (function (_ [key keys]) (\ <monad> wrap [keys (:representation resource)])))] - [read-pure Identity identity.monad] - [read-sync IO io.monad] - [read-async Promise promise.monad] + [read_pure Identity identity.monad] + [read_sync IO io.monad] + [read_async Promise promise.monad] )) -(exception: #export (index-cannot-be-repeated {index Nat}) +(exception: #export (index_cannot_be_repeated {index Nat}) (exception.report ["Index" (%.nat index)])) -(exception: #export amount-cannot-be-zero) +(exception: #export amount_cannot_be_zero) (def: indices (Parser (List Nat)) @@ -144,26 +144,26 @@ (wrap (list)) (do ! [head s.nat - _ (p.assert (exception.construct index-cannot-be-repeated head) + _ (p.assert (exception.construct index_cannot_be_repeated head) (not (set.member? seen head))) tail (recur (set.add head seen))] (wrap (list& head tail)))))))) -(def: (no-op Monad<m>) +(def: (no_op Monad<m>) (All [m] (-> (Monad m) (Linear m Any))) (function (_ context) (\ Monad<m> wrap [context []]))) (template [<name> <m> <monad>] [(syntax: #export (<name> {swaps ..indices}) - (meta.with-gensyms [g!_ g!context] + (meta.with_gensyms [g!_ g!context] (case swaps #.Nil - (wrap (list (` ((~! no-op) <monad>)))) + (wrap (list (` ((~! no_op) <monad>)))) (#.Cons head tail) (do {! meta.monad} - [#let [max-idx (list\fold n.max head tail)] - g!inputs (<| (monad.seq !) (list.repeat (inc max-idx)) (meta.gensym "input")) + [#let [max_idx (list\fold n.max head tail)] + g!inputs (<| (monad.seq !) (list.repeat (inc max_idx)) (meta.gensym "input")) #let [g!outputs (|> (monad.fold maybe.monad (function (_ from to) (do maybe.monad @@ -172,7 +172,7 @@ (: (Row Code) row.empty) swaps) maybe.assume - row.to-list) + row.to_list) g!inputsT+ (list\map (|>> (~) ..CK (`)) g!inputs) g!outputsT+ (list\map (|>> (~) ..CK (`)) g!outputs)]] (wrap (list (` (: (All [(~+ g!inputs) (~ g!context)] @@ -183,22 +183,22 @@ (function ((~ g!_) [(~+ g!inputs) (~ g!context)]) (\ (~! <monad>) (~' wrap) [[(~+ g!outputs) (~ g!context)] []]))))))))))] - [exchange-pure Identity identity.monad] - [exchange-sync IO io.monad] - [exchange-async Promise promise.monad] + [exchange_pure Identity identity.monad] + [exchange_sync IO io.monad] + [exchange_async Promise promise.monad] ) (def: amount (Parser Nat) (do p.monad [raw s.nat - _ (p.assert (exception.construct amount-cannot-be-zero []) + _ (p.assert (exception.construct ..amount_cannot_be_zero []) (n.> 0 raw))] (wrap raw))) (template [<name> <m> <monad> <from> <to>] [(syntax: #export (<name> {amount ..amount}) - (meta.with-gensyms [g!_ g!context] + (meta.with_gensyms [g!_ g!context] (do {! meta.monad} [g!keys (<| (monad.seq !) (list.repeat amount) (meta.gensym "keys"))] (wrap (list (` (: (All [(~+ g!keys) (~ g!context)] @@ -209,10 +209,10 @@ (function ((~ g!_) [<from> (~ g!context)]) (\ (~! <monad>) (~' wrap) [[<to> (~ g!context)] []])))))))))] - [group-pure Identity identity.monad (~+ g!keys) [(~+ g!keys)]] - [group-sync IO io.monad (~+ g!keys) [(~+ g!keys)]] - [group-async Promise promise.monad (~+ g!keys) [(~+ g!keys)]] - [un-group-pure Identity identity.monad [(~+ g!keys)] (~+ g!keys)] - [un-group-sync IO io.monad [(~+ g!keys)] (~+ g!keys)] - [un-group-async Promise promise.monad [(~+ g!keys)] (~+ g!keys)] + [group_pure Identity identity.monad (~+ g!keys) [(~+ g!keys)]] + [group_sync IO io.monad (~+ g!keys) [(~+ g!keys)]] + [group_async Promise promise.monad (~+ g!keys) [(~+ g!keys)]] + [un_group_pure Identity identity.monad [(~+ g!keys)] (~+ g!keys)] + [un_group_sync IO io.monad [(~+ g!keys)] (~+ g!keys)] + [un_group_async Promise promise.monad [(~+ g!keys)] (~+ g!keys)] ) |