blob: c77538d99e35e509dac534c91ed5287d48e3c151 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
(.module:
[library
[lux (#- local)
["$" documentation (#+ documentation:)]
[data
[text (#+ \n)
["%" format (#+ format)]]]
[macro
["." template]]]]
[\\library
["." /]])
(documentation: (/.Try it)
"A computation that can fail with an error message.")
(documentation: /.with
"Enhances a monad with error-handling functionality."
[(with monad)])
(documentation: /.lifted
"Wraps a monadic value with error-handling machinery."
[(lifted monad)])
(documentation: /.trusted
(format "Assumes a Try value succeeded, and yields its value."
\n "If it didn't, raises the error as a runtime error."
\n "WARNING: Use with caution.")
[(trusted try)])
(documentation: /.maybe
""
[(maybe try)])
(documentation: /.of_maybe
""
[(of_maybe maybe)])
(documentation: /.else
(format "Allows you to provide a default value that will be used"
\n "if a (Try x) value turns out to be #Failure."
\n "Note: the expression for the default value will not be computed if the base computation succeeds.")
[(= "bar"
(else "foo" (#..Success "bar")))]
[(= "foo"
(else "foo" (#..Failure "KABOOM!")))])
(.def: .public documentation
(.List $.Module)
($.module /._
""
[..Try
..with
..lifted
..trusted
..maybe
..of_maybe
..else
($.default /.functor)
($.default /.apply)
($.default /.monad)
($.default /.equivalence)]
[]))
|