diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/try.lux | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 3e62dda4b..a82b72d33 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -19,11 +19,12 @@ (def: (each f ma) (case ma - {#Failure msg} - {#Failure msg} - {#Success datum} - {#Success (f datum)}))) + {#Success (f datum)} + + ... {#Failure msg} + it + (:expected it)))) (implementation: .public apply (Apply Try) @@ -37,11 +38,13 @@ {#Success a} {#Success (f a)} - {#Failure msg} - {#Failure msg}) + ... {#Failure msg} + it + (:expected it)) - {#Failure msg} - {#Failure msg}))) + ... {#Failure msg} + it + (:expected it)))) (implementation: .public monad (Monad Try) @@ -53,11 +56,12 @@ (def: (conjoint mma) (case mma - {#Failure msg} - {#Failure msg} - {#Success ma} - ma))) + ma + + ... {#Failure msg} + it + (:expected it)))) (implementation: .public (with monad) ... TODO: Replace (All (_ a) (! (Try a))) with (functor.Then ! Try) @@ -75,11 +79,12 @@ (do monad [eMea MeMea] (case eMea - {#Failure try} - (in {#Failure try}) - {#Success Mea} - Mea)))) + Mea + + ... {#Failure error} + it + (in (:expected it)))))) (def: .public (lifted monad) (All (_ ! a) (-> (Monad !) (-> (! a) (! (Try a))))) @@ -117,7 +122,8 @@ {#Success value} {.#Some value} - {#Failure message} + ... {#Failure message} + _ {.#None})) (def: .public (of_maybe maybe) @@ -138,7 +144,8 @@ {..#Success (~' g!temp)} (~' g!temp) - {..#Failure (~ [location.dummy {.#Symbol ["" ""]}])} + ... {..#Failure (~' g!temp)} + (~' g!temp) (~ else))))]} _ |