diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/library/lux/control/maybe.lux (renamed from stdlib/source/library/lux/data/maybe.lux) | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/stdlib/source/library/lux/data/maybe.lux b/stdlib/source/library/lux/control/maybe.lux index a019a4c79..2d9b56039 100644 --- a/stdlib/source/library/lux/data/maybe.lux +++ b/stdlib/source/library/lux/control/maybe.lux @@ -111,21 +111,21 @@ Mma)))) (def: .public (lift monad) - {#.doc (doc "Wraps a monadic value with Maybe machinery.")} + {#.doc (example "Wraps a monadic value with Maybe machinery.")} (All [M a] (-> (Monad M) (-> (M a) (M (Maybe a))))) (\ monad map (\ ..monad in))) (macro: .public (else tokens state) - {#.doc (doc "Allows you to provide a default value that will be used" - "if a (Maybe x) value turns out to be #.None." - "Note: the expression for the default value will not be computed if the base computation succeeds." - (else +20 (#.Some +10)) - "=>" - +10 - -------------------------- - (else +20 #.None) - "=>" - +20)} + {#.doc (example "Allows you to provide a default value that will be used" + "if a (Maybe x) value turns out to be #.None." + "Note: the expression for the default value will not be computed if the base computation succeeds." + (else +20 (#.Some +10)) + "=>" + +10 + -------------------------- + (else +20 #.None) + "=>" + +20)} (case tokens (^ (.list else maybe)) (let [g!temp (: Code [location.dummy (#.Identifier ["" ""])])] @@ -140,9 +140,9 @@ (#.Left "Wrong syntax for else"))) (def: .public assume - {#.doc (doc "Assumes that a Maybe value is a #.Some and yields its value." - "Raises/throws a runtime error otherwise." - "WARNING: Use with caution.")} + {#.doc (example "Assumes that a Maybe value is a #.Some and yields its value." + "Raises/throws a runtime error otherwise." + "WARNING: Use with caution.")} (All [a] (-> (Maybe a) a)) (|>> (..else (undefined)))) @@ -156,11 +156,11 @@ (#.Item value #.End))) (macro: .public (when tokens state) - {#.doc (doc "Can be used as a guard in (co)monadic be/do expressions." - (do monad - [value (do_something 1 2 3) - ..when (passes_test? value)] - (do_something_else 4 5 6)))} + {#.doc (example "Can be used as a guard in (co)monadic be/do expressions." + (do monad + [value (do_something 1 2 3) + ..when (passes_test? value)] + (do_something_else 4 5 6)))} (case tokens (^ (.list test then)) (#.Right [state (.list (` (.if (~ test) |