Skip to content

Commit

Permalink
addign generic decode error type
Browse files Browse the repository at this point in the history
  • Loading branch information
roboteng committed Jul 12, 2024
1 parent 18709aa commit d9adf74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion platform/Env.roc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ var = \name ->
## fail with [DecodeErr](https://www.roc-lang.org/builtins/Decode#DecodeError)
## because `123456789` is too large to fit in a [U16](https://www.roc-lang.org/builtins/Num#U16).
##
decode : Str -> Task val [VarNotFound, DecodeErr DecodeError] where val implements Decoding
decode : Str -> Task val [VarNotFound, DecodeErr [TooShort]] where val implements Decoding
decode = \name ->
Effect.envVar name
|> Effect.map
Expand Down
4 changes: 2 additions & 2 deletions platform/EnvDecoding.roc
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ envList = \decodeElem -> Decode.custom \bytes, @EnvFormat {} ->
# TODO: we must currently annotate the arrows here so that the lambda sets are
# exercised, and the solver can find an ambient lambda set for the
# specialization.
envRecord : _, (_, _ -> [Keep (Decoder _ _), Skip]), (_, _ -> _) -> Decoder _ _
envRecord : _, (_, _ -> [Keep (Decoder _ _ _), Skip]), (_, _ -> _) -> Decoder _ _ _
envRecord = \_initialState, _stepField, _finalizer -> Decode.custom \bytes, @EnvFormat {} ->
{ result: Err TooShort, rest: bytes }

# TODO: we must currently annotate the arrows here so that the lambda sets are
# exercised, and the solver can find an ambient lambda set for the
# specialization.
envTuple : _, (_, _ -> [Next (Decoder _ _), TooLong]), (_ -> _) -> Decoder _ _
envTuple : _, (_, _ -> [Next (Decoder _ _ _), TooLong]), (_ -> _) -> Decoder _ _ _
envTuple = \_initialState, _stepElem, _finalizer -> Decode.custom \bytes, @EnvFormat {} ->
{ result: Err TooShort, rest: bytes }

0 comments on commit d9adf74

Please sign in to comment.