diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/try.lux | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/stdlib/source/library/lux/control/try.lux b/stdlib/source/library/lux/control/try.lux index 0226bab08..fa02b452a 100644 --- a/stdlib/source/library/lux/control/try.lux +++ b/stdlib/source/library/lux/control/try.lux @@ -9,12 +9,12 @@ [meta ["." location]]]]) -(type: #export (Try a) +(type: .public (Try a) {#.doc (doc "A computation that can fail with an error message.")} (#Failure Text) (#Success a)) -(implementation: #export functor +(implementation: .public functor (Functor Try) (def: (map f ma) @@ -25,7 +25,7 @@ (#Success datum) (#Success (f datum))))) -(implementation: #export apply +(implementation: .public apply (Apply Try) (def: &functor ..functor) @@ -43,7 +43,7 @@ (#Failure msg) (#Failure msg)))) -(implementation: #export monad +(implementation: .public monad (Monad Try) (def: &functor ..functor) @@ -59,7 +59,7 @@ (#Success ma) ma))) -(implementation: #export (with monad) +(implementation: .public (with monad) {#.doc (doc "Enhances a monad with error-handling functionality.")} ## TODO: Replace (All [a] (! (Try a))) with (functor.Then ! Try) (All [!] (-> (Monad !) (Monad (All [a] (! (Try a)))))) @@ -81,12 +81,12 @@ (#Success Mea) Mea)))) -(def: #export (lifted monad) +(def: .public (lifted monad) {#.doc (doc "Wraps a monadic value with error-handling machinery.")} (All [! a] (-> (Monad !) (-> (! a) (! (Try a))))) (\ monad map (\ ..monad in))) -(implementation: #export (equivalence (^open "_\.")) +(implementation: .public (equivalence (^open "_\.")) (All [a] (-> (Equivalence a) (Equivalence (Try a)))) (def: (= reference sample) @@ -101,7 +101,7 @@ false ))) -(def: #export (assumed try) +(def: .public (assumed try) {#.doc (doc "Assumes a Try value succeeded, and yields its value." "If it didn't, raises the error as a runtime error." "WARNING: Use with caution.")} @@ -113,7 +113,7 @@ (#Failure message) (error! message))) -(def: #export (maybe try) +(def: .public (maybe try) (All [a] (-> (Try a) (Maybe a))) (case try (#Success value) @@ -122,7 +122,7 @@ (#Failure message) #.None)) -(def: #export (of_maybe maybe) +(def: .public (of_maybe maybe) (All [a] (-> (Maybe a) (Try a))) (case maybe (#.Some value) @@ -132,7 +132,7 @@ (#Failure (`` (("lux in-module" (~~ (static .prelude_module)) .name\encode) (name_of ..of_maybe)))))) -(macro: #export (else tokens compiler) +(macro: .public (else tokens compiler) {#.doc (doc "Allows you to provide a default value that will be used" "if a (Try x) value turns out to be #Failure." "Note: the expression for the default value will not be computed if the base computation succeeds." |