mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-01 10:52:18 +00:00
Add Decode.mapResult
This commit is contained in:
parent
bb8888b115
commit
e08b613047
2 changed files with 5 additions and 0 deletions
|
@ -27,6 +27,7 @@ interface Decode
|
|||
decodeWith,
|
||||
fromBytesPartial,
|
||||
fromBytes,
|
||||
mapResult,
|
||||
]
|
||||
imports [
|
||||
List,
|
||||
|
@ -96,3 +97,6 @@ fromBytes = \bytes, fmt ->
|
|||
Err TooShort -> Err TooShort
|
||||
else
|
||||
Err (Leftover rest)
|
||||
|
||||
mapResult : DecodeResult a, (a -> b) -> DecodeResult b
|
||||
mapResult = \{result, rest}, mapper -> {result: Result.map result mapper, rest}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue