Skip to content

Commit bea87aa

Browse files
committed
docs: fix is_*
- Change 42 and 43 numbers for 1 and 2
1 parent 47bebe4 commit bea87aa

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

src/remote_data.gleam

+34-34
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ pub type RemoteData(a, error) {
1414
///
1515
/// ## Examples
1616
/// ```gleam
17-
/// map(over: Success(42), with: fn(x) { x * 2 })
18-
/// // -> Success(84)
17+
/// map(over: Success(1), with: int.to_string)
18+
/// // -> Success("1")
1919
/// ```
2020
///
2121
/// ```gleam
22-
/// map(over: Failure("error"), with: fn(x) { x * 2 })
22+
/// map(over: Failure("error"), with: int.to_string)
2323
/// // -> Failure("error")
2424
/// ```
2525
pub fn map(
@@ -38,8 +38,8 @@ pub fn map(
3838
///
3939
/// ## Examples
4040
/// ```gleam
41-
/// map_2(over: Success(42), over_2: Success(2), with: fn(a, b) { a + b })
42-
/// // -> Success(44)
41+
/// map_2(over: Success(1), over_2: Success(2), with: fn(a, b) { a + b })
42+
/// // -> Success(3)
4343
/// ```
4444
///
4545
/// ```gleam
@@ -104,8 +104,8 @@ pub fn map_error(
104104
///
105105
/// ## Examples
106106
/// ```gleam
107-
/// try(over: Success(42), with: fn(x) { Success(x * 2) })
108-
/// // -> Success(84)
107+
/// try(over: Success(1), with: fn(x) { Success(x * 2) })
108+
/// // -> Success(2)
109109
/// ```
110110
///
111111
/// ```gleam
@@ -114,7 +114,7 @@ pub fn map_error(
114114
/// ```
115115
///
116116
/// ```gleam
117-
/// try(over: Success(42), with: fn(x) { Failure("error") })
117+
/// try(over: Success(1), with: fn(x) { Failure("error") })
118118
/// // -> Failure("error")
119119
/// ```
120120
pub fn try(
@@ -132,12 +132,12 @@ pub fn try(
132132
/// Unwrap a RemoteData, providing a default value if the data is not Success
133133
/// ## Examples
134134
/// ```gleam
135-
/// unwrap(data: Success(42), or: 0)
136-
/// // -> 42
135+
/// unwrap(Success(1), or: 0)
136+
/// // -> 1
137137
/// ```
138138
///
139139
/// ```gleam
140-
/// unwrap(data: Failure("error"), or: 0)
140+
/// unwrap(Failure("error"), or: 0)
141141
/// // -> 0
142142
/// ```
143143
pub fn unwrap(data: RemoteData(a, error), or default: a) -> a {
@@ -150,12 +150,12 @@ pub fn unwrap(data: RemoteData(a, error), or default: a) -> a {
150150
/// Convert a RemoteData to an Option
151151
/// ## Examples
152152
/// ```gleam
153-
/// to_option(data: Success(42))
154-
/// // -> Some(42)
153+
/// to_option(Success(1))
154+
/// // -> Some(1)
155155
/// ```
156156
///
157157
/// ```gleam
158-
/// to_option(data: Failure("error"))
158+
/// to_option(Failure("error"))
159159
/// // -> None
160160
/// ```
161161
pub fn to_option(data: RemoteData(a, error)) -> Option(a) {
@@ -168,8 +168,8 @@ pub fn to_option(data: RemoteData(a, error)) -> Option(a) {
168168
/// Convert an Option to a RemoteData
169169
/// ## Examples
170170
/// ```gleam
171-
/// from_option(option: Some(42), or: "error")
172-
/// // -> Success(42)
171+
/// from_option(option: Some(1), or: "error")
172+
/// // -> Success(1)
173173
/// ```
174174
///
175175
/// ```gleam
@@ -187,17 +187,17 @@ pub fn from_option(option: Option(a), or error: error) -> RemoteData(a, error) {
187187
/// If the data is NotAsked or Loading, it will be converted to an Error with the provided error
188188
/// ## Examples
189189
/// ```gleam
190-
/// to_result(data: Success(42), or: "error")
191-
/// // -> Ok(42)
190+
/// to_result(Success(1), or: "error")
191+
/// // -> Ok(1)
192192
/// ```
193193
///
194194
/// ```gleam
195-
/// to_result(data: Failure("error"), or: "another error")
195+
/// to_result(Failure("error"), or: "another error")
196196
/// // -> Error("error")
197197
/// ```
198198
///
199199
/// ```gleam
200-
/// to_result(data: Loading, or: "another error")
200+
/// to_result(Loading, or: "another error")
201201
/// // -> Error("another error")
202202
/// ```
203203
pub fn to_result(
@@ -214,8 +214,8 @@ pub fn to_result(
214214
/// Convert a Result to a RemoteData
215215
/// ## Examples
216216
/// ```gleam
217-
/// from_result(result: Ok(42))
218-
/// // -> Success(42)
217+
/// from_result(result: Ok(1))
218+
/// // -> Success(1)
219219
/// ```
220220
///
221221
/// ```gleam
@@ -232,12 +232,12 @@ pub fn from_result(result: Result(a, error)) -> RemoteData(a, error) {
232232
/// Convert a list of RemoteData to a RemoteData of a list
233233
/// ## Examples
234234
/// ```gleam
235-
/// from_list([Success(42), Success(43)])
236-
/// // -> Success([42, 43])
235+
/// from_list([Success(1), Success(2)])
236+
/// // -> Success([1, 2])
237237
/// ```
238238
///
239239
/// ```gleam
240-
/// from_list([Success(42), Failure("error")])
240+
/// from_list([Success(1), Failure("error")])
241241
/// // -> Failure("error")
242242
/// ```
243243
pub fn from_list(
@@ -252,7 +252,7 @@ pub fn from_list(
252252
/// Check if a RemoteData is a Success
253253
/// ## Examples
254254
/// ```gleam
255-
/// is_not_asked(Success(42))
255+
/// is_not_asked(Success(1))
256256
/// // -> False
257257
/// ```
258258
///
@@ -270,13 +270,13 @@ pub fn is_not_asked(data: RemoteData(_, _)) -> Bool {
270270
/// Check if a RemoteData is a Success
271271
/// ## Examples
272272
/// ```gleam
273-
/// is_loading(Success(42))
274-
/// // -> True
273+
/// is_loading(Success(1))
274+
/// // -> False
275275
/// ```
276276
///
277277
/// ```gleam
278-
/// is_loading(Failure("error"))
279-
/// // -> False
278+
/// is_loading(Loading)
279+
/// // -> True
280280
/// ```
281281
pub fn is_loading(data: RemoteData(_, _)) -> Bool {
282282
case data {
@@ -288,13 +288,13 @@ pub fn is_loading(data: RemoteData(_, _)) -> Bool {
288288
/// Check if a RemoteData is a Success
289289
/// ## Examples
290290
/// ```gleam
291-
/// is_failure(Success(42))
292-
/// // -> True
291+
/// is_failure(Success(1))
292+
/// // -> False
293293
/// ```
294294
///
295295
/// ```gleam
296296
/// is_failure(Failure("error"))
297-
/// // -> False
297+
/// // -> True
298298
/// ```
299299
pub fn is_failure(data: RemoteData(_, _)) -> Bool {
300300
case data {
@@ -306,7 +306,7 @@ pub fn is_failure(data: RemoteData(_, _)) -> Bool {
306306
/// Check if a RemoteData is a Success
307307
/// ## Examples
308308
/// ```gleam
309-
/// is_success(Success(42))
309+
/// is_success(Success(1))
310310
/// // -> True
311311
/// ```
312312
///

0 commit comments

Comments
 (0)