aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/control/effect.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/control/effect.lux')
-rw-r--r--stdlib/source/lux/control/effect.lux31
1 files changed, 16 insertions, 15 deletions
diff --git a/stdlib/source/lux/control/effect.lux b/stdlib/source/lux/control/effect.lux
index 939bd28f5..457519442 100644
--- a/stdlib/source/lux/control/effect.lux
+++ b/stdlib/source/lux/control/effect.lux
@@ -2,7 +2,8 @@
lux
(lux (control ["F" functor]
applicative
- ["M" monad #*])
+ ["M" monad #*]
+ ["p" parser])
[io #- run]
(data (coll [list "List/" Monad<List> Monoid<List>])
[number "Nat/" Codec<Text,Nat>]
@@ -55,19 +56,19 @@
))))
## [Syntax]
-(syntax: #export (|E [effects (s;many s;any)])
+(syntax: #export (|E [effects (p;many s;any)])
{#;doc (doc "A way to combine smaller effect into a larger effect."
(type: EffABC (|E EffA EffB EffC)))}
(wrap (list (` ($_ ;;|@ (~@ effects))))))
-(syntax: #export (|F [functors (s;many s;any)])
+(syntax: #export (|F [functors (p;many s;any)])
{#;doc (doc "A way to combine smaller effect functors into a larger functor."
(def: Functor<EffABC>
(Functor EffABC)
(|F Functor<EffA> Functor<EffB> Functor<EffC>)))}
(wrap (list (` ($_ ;;combine-functors (~@ functors))))))
-(syntax: #export (|H monad [handlers (s;many s;any)])
+(syntax: #export (|H monad [handlers (p;many s;any)])
{#;doc (doc "A way to combine smaller effect handlers into a larger handler."
(def: Handler<EffABC,IO>
(Handler EffABC io;IO)
@@ -85,18 +86,18 @@
(def: op^
(Syntax Op)
- (s;form (s;either ($_ s;seq
+ (s;form (p;either ($_ p;seq
s;local-symbol
- (s;tuple (s;some s;any))
+ (s;tuple (p;some s;any))
s;any)
- ($_ s;seq
+ ($_ p;seq
s;local-symbol
- (:: s;Monad<Syntax> wrap (list))
+ (:: p;Monad<Parser> wrap (list))
s;any))))
(syntax: #export (effect: [exp-lvl csr;export]
[name s;local-symbol]
- [ops (s;many op^)])
+ [ops (p;many op^)])
{#;doc (doc "Define effects by specifying which operations and constants a handler must provide."
(effect: #export EffA
(opA [Nat Text] Bool)
@@ -153,16 +154,16 @@
(def: translation^
(Syntax Translation)
- (s;form (do s;Monad<Syntax>
+ (s;form (do p;Monad<Parser>
[_ (s;this (' =>))]
- (s;seq s;symbol
- (s;tuple (s;seq s;any
+ (p;seq s;symbol
+ (s;tuple (p;seq s;any
s;any))))))
(syntax: #export (handler: [exp-lvl csr;export]
[name s;local-symbol]
[[effect target-type target-monad] translation^]
- [defs (s;many (csr;definition *compiler*))])
+ [defs (p;many (csr;definition *compiler*))])
{#;doc (doc "Define effect handlers by implementing the operations and values of an effect."
(handler: _
(=> EffA [IO Monad<IO>])
@@ -245,7 +246,7 @@
(def: g!functor Code (code;symbol ["" "\t@E\t"]))
-(syntax: #export (doE functor [bindings (s;tuple (s;some s;any))] body)
+(syntax: #export (doE functor [bindings (s;tuple (p;some s;any))] body)
{#;doc (doc "An alternative to the 'do' macro for monads."
(with-handler Handler<EffABC,IO>
(doE Functor<EffABC>
@@ -305,7 +306,7 @@
(` (+1 (~ base)))
))
-(syntax: #export (lift [value (s;alt s;symbol
+(syntax: #export (lift [value (p;alt s;symbol
s;any)])
{#;doc (doc "A way to (automatically) lift effectful fields and operations from simple effects into the larger space of composite effects."
(with-handler Handler<EffABC,IO>