Skip to content

Instantly share code, notes, and snippets.

@alejandrociatti
Created February 22, 2022 15:45
Show Gist options
  • Save alejandrociatti/6a5946871a7c6e82430fc07caa6ecea2 to your computer and use it in GitHub Desktop.
Save alejandrociatti/6a5946871a7c6e82430fc07caa6ecea2 to your computer and use it in GitHub Desktop.
loggingDecoder : Decoder a -> Decoder a
loggingDecoder decoderToDebug =
D.value
|> D.andThen
(\value ->
case D.decodeValue decoderToDebug value of
Ok decoded ->
D.succeed decoded
Err error ->
D.fail <| Debug.log "decode error" <| Debug.toString error
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment