From d9adf74e1272a2076b3cd8ae40041292ce1fb312 Mon Sep 17 00:00:00 2001 From: Trevor Settles Date: Thu, 11 Jul 2024 20:21:08 -0600 Subject: [PATCH] addign generic decode error type --- platform/Env.roc | 2 +- platform/EnvDecoding.roc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/Env.roc b/platform/Env.roc index f073b492..5b6f11ee 100644 --- a/platform/Env.roc +++ b/platform/Env.roc @@ -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 diff --git a/platform/EnvDecoding.roc b/platform/EnvDecoding.roc index da947434..47551d00 100644 --- a/platform/EnvDecoding.roc +++ b/platform/EnvDecoding.roc @@ -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 }