mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
update internal references to Result.map
This commit is contained in:
parent
326558337c
commit
297dd0233e
6 changed files with 11 additions and 11 deletions
|
@ -54,8 +54,8 @@ with_default = \result, default ->
|
|||
## function on it. Then returns a new `Ok` holding the transformed value. If the
|
||||
## result is `Err`, this has no effect. Use [map_err] to transform an `Err`.
|
||||
## ```roc
|
||||
## Result.map(Ok(12), Num.neg)
|
||||
## Result.map(Err("yipes!"), Num.neg)
|
||||
## Result.map_ok(Ok(12), Num.neg)
|
||||
## Result.map_ok(Err("yipes!"), Num.neg)
|
||||
## ```
|
||||
##
|
||||
## Functions like `map` are common in Roc; see for example [List.map],
|
||||
|
|
|
@ -37,7 +37,7 @@ cheapest_open = \cost_function, model ->
|
|||
Ok(smallest_so_far)
|
||||
|
||||
Set.walk(model.open_set, Err(KeyNotFound), folder)
|
||||
|> Result.map(\x -> x.position)
|
||||
|> Result.map_ok(\x -> x.position)
|
||||
|
||||
reconstruct_path : Map position position, position -> List position
|
||||
reconstruct_path = \came_from, goal ->
|
||||
|
|
|
@ -37,7 +37,7 @@ cheapest_open = \cost_function, model ->
|
|||
Ok(smallest_so_far)
|
||||
|
||||
Set.walk(model.open_set, Err(KeyNotFound), folder)
|
||||
|> Result.map(\x -> x.position)
|
||||
|> Result.map_ok(\x -> x.position)
|
||||
|
||||
reconstruct_path : Dict position position, position -> List position where position implements Hash & Eq
|
||||
reconstruct_path = \came_from, goal ->
|
||||
|
|
|
@ -37,7 +37,7 @@ decoder = @MDecoder \lst, fmt ->
|
|||
#^^^^^^^{-1} MyU8#decoder(12): MDecoder MyU8 fmt where fmt implements MDecoderFormatting
|
||||
when decode_with lst u8 fmt is
|
||||
{ result, rest } ->
|
||||
{ result: Result.map result (\n -> @MyU8 n), rest }
|
||||
{ result: Result.map_ok result (\n -> @MyU8 n), rest }
|
||||
|
||||
my_u8 : Result MyU8 _
|
||||
my_u8 = from_bytes [15] (@Linear {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue