diff options
Diffstat (limited to 'stdlib/source/library/lux/tool/compiler/phase.lux')
-rw-r--r-- | stdlib/source/library/lux/tool/compiler/phase.lux | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/stdlib/source/library/lux/tool/compiler/phase.lux b/stdlib/source/library/lux/tool/compiler/phase.lux index 97eb3944c..c2aa03feb 100644 --- a/stdlib/source/library/lux/tool/compiler/phase.lux +++ b/stdlib/source/library/lux/tool/compiler/phase.lux @@ -23,10 +23,10 @@ (type: .public (Operation s o) (state.+State Try s o)) -(def: .public functor +(def .public functor (All (_ s) (Functor (Operation s))) (implementation - (def: (each f it) + (def (each f it) (function (_ state) (case (it state) {try.#Success [state' output]} @@ -35,16 +35,16 @@ {try.#Failure error} {try.#Failure error}))))) -(def: .public monad +(def .public monad (All (_ s) (Monad (Operation s))) (implementation - (def: functor ..functor) + (def functor ..functor) - (def: (in it) + (def (in it) (function (_ state) {try.#Success [state it]})) - (def: (conjoint it) + (def (conjoint it) (function (_ state) (case (it state) {try.#Success [state' it']} @@ -59,31 +59,31 @@ (type: .public Wrapper (All (_ s i o) (-> (Phase s i o) Any))) -(def: .public (result' state operation) +(def .public (result' state operation) (All (_ s o) (-> s (Operation s o) (Try [s o]))) (operation state)) -(def: .public (result state operation) +(def .public (result state operation) (All (_ s o) (-> s (Operation s o) (Try o))) (|> state operation (at try.monad each product.right))) -(def: .public state +(def .public state (All (_ s o) (Operation s s)) (function (_ state) {try.#Success [state state]})) -(def: .public (with state) +(def .public (with state) (All (_ s o) (-> s (Operation s Any))) (function (_ _) {try.#Success [state []]})) -(def: .public (sub [get set] operation) +(def .public (sub [get set] operation) (All (_ s s' o) (-> [(-> s s') (-> s' s s)] (Operation s' o) @@ -93,31 +93,31 @@ [[state' output] (operation (get state))] (in [(set state' state) output])))) -(def: .public failure +(def .public failure (-> Text Operation) (|>> {try.#Failure} (state.lifted try.monad))) -(def: .public (except exception parameters) +(def .public (except exception parameters) (All (_ e) (-> (Exception e) e Operation)) (..failure (exception.error exception parameters))) -(def: .public (lifted error) +(def .public (lifted error) (All (_ s a) (-> (Try a) (Operation s a))) (function (_ state) (try#each (|>> [state]) error))) -(def: .public assertion +(def .public assertion (template (assertion exception message test) [(if test (at ..monad in []) (..except exception message))])) -(def: .public identity +(def .public identity (All (_ s a) (Phase s a a)) (function (_ archive input state) {try.#Success [state input]})) -(def: .public (composite pre post) +(def .public (composite pre post) (All (_ s0 s1 i t o) (-> (Phase s0 i t) (Phase s1 t o) |