Skip to content

Commit e3e5abe

Browse files
committed
shorter docs, add Examples header
1 parent 916a5e4 commit e3e5abe

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Core__Result.resi

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,14 @@ Result.forEach(Error("x"), Console.log) // Does nothing, returns ()
211211
let forEach: (t<'a, 'b>, 'a => unit) => unit
212212

213213
/**
214-
`mapError(res, f)` - If the source is `Ok`, return it. Otherwise apply
215-
the function `f` to the `Error` value.
214+
`mapError(r, f)` generates a new `result` by applying the function `f` to the `Error` value. If the source is `Ok`, return it as-is.
216215
217216
## Examples
218-
```rescript
219217
220-
let formatError = n => `Error code: ${n->Int.toString}`
221-
mapError(Error(14), formatError) // evaluates to Error("Error code: 14")
222-
mapError(Ok("abc"), formatError) // evaluates to Ok("abc")
218+
```rescript
219+
let format = n => `Error code: ${n->Int.toString}`
220+
mapError(Error(14), format) // Error("Error code: 14")
221+
mapError(Ok("abc"), format) // Ok("abc")
223222
```
224223
*/
225224
let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>

0 commit comments

Comments
 (0)