mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Implement Json fromBytes without let-generalization
This commit is contained in:
parent
3fdde9e8f0
commit
10ce5d0615
1 changed files with 8 additions and 8 deletions
|
@ -69,11 +69,11 @@ fromBytesPartial = \bytes, fmt -> decodeWith bytes decoder fmt
|
|||
|
||||
fromBytes : List U8, fmt -> Result val [Leftover (List U8)]DecodeError | val has Decoding, fmt has DecoderFormatting
|
||||
fromBytes = \bytes, fmt ->
|
||||
{ result, rest } = fromBytesPartial bytes fmt
|
||||
|
||||
if List.isEmpty rest then
|
||||
when result is
|
||||
Ok val -> Ok val
|
||||
Err TooShort -> Err TooShort
|
||||
else
|
||||
Err (Leftover rest)
|
||||
when fromBytesPartial bytes fmt is
|
||||
{ result, rest } ->
|
||||
if List.isEmpty rest then
|
||||
when result is
|
||||
Ok val -> Ok val
|
||||
Err TooShort -> Err TooShort
|
||||
else
|
||||
Err (Leftover rest)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue