Skip to content

Commit a23743f

Browse files
committed
shorter docs, add Examples header
1 parent 78bbbd4 commit a23743f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Core__Result.resi

+5-6
Original file line numberDiff line numberDiff line change
@@ -199,15 +199,14 @@ let eq: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => bool) => bool
199199
let cmp: (t<'a, 'c>, t<'b, 'd>, ('a, 'b) => int) => int
200200

201201
/**
202-
`mapError(res, f)` - If the source is `Ok`, return it. Otherwise apply
203-
the provided mapping function to the `Error` value.
202+
`mapError(r, f)` generates a new `result` by applying a function to the contained `Error` value, leaving an `Ok` untouched.
204203

205204
## Examples
206-
```rescript
207205

208-
let formatError = n => `Error code: ${n->Int.toString}`
209-
mapError(Error(14), formatError) // evaluates to Error("Error code: 14")
210-
mapError(Ok("abc"), formatError) // evaluates to Ok("abc")
206+
```rescript
207+
let format = n => `Error code: ${n->Int.toString}`
208+
mapError(Error(14), format) // Error("Error code: 14")
209+
mapError(Ok("abc"), format) // Ok("abc")
211210
```
212211
*/
213212
let mapError: (result<'a, 'b>, 'b => 'c) => result<'a, 'c>

0 commit comments

Comments
 (0)