Skip to content

Commit dec8b6e

Browse files
authored
[result] Fix documentation for getWhenFail and getWhenPass methods. (#1680)
The examples in the documentation showed passing the same arguments and getting different results. The examples are incorrect because they forgot to change the arguments to demonstrate the other case. This fixes the examples and also replaces the type of the other case to more clearly indicate that it is totally unused.
1 parent 55e3cd5 commit dec8b6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

share/wake/lib/core/result.wake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ export def getFail: Result a b => Option b = match _
7373
# getWhenFail: retrieve the Pass value, using a default value for Fail
7474
#
7575
# getWhenFail 42 (Pass 123) = 123
76-
# getWhenFail 42 (Pass 123) = 42
76+
# getWhenFail 42 (Fail "fail") = 42
7777
export def getWhenFail (default: pass): Result pass fail => pass = match _
7878
Pass a -> a
7979
Fail _ -> default
8080

8181
# getWhenPass: retrieve the Fail value, using a default value for Pass
8282
#
83-
# getWhenPass 42 (Pass 123) = 42
84-
# getWhenPass 42 (Pass 123) = 123
83+
# getWhenPass 42 (Pass "pass") = 42
84+
# getWhenPass 42 (Fail 123) = 123
8585
export def getWhenPass (default: fail): Result pass fail => fail = match _
8686
Pass _ -> default
8787
Fail f -> f

0 commit comments

Comments
 (0)