mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-20 23:37:56 +03:00
Implement Json fromBytes without let-generalization
This commit is contained in:
parent
3fdde9e8f0
commit
10ce5d0615
@ -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…
Reference in New Issue
Block a user