Created
November 10, 2021 17:18
-
-
Save moritzmhmk/86d78cc6b8076ee7a10c40085e23409c to your computer and use it in GitHub Desktop.
Elm Utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- source: https://thoughtbot.com/blog/debugging-dom-event-handlers-in-elm | |
loggingDecoder : Decoder a -> Decoder a | |
loggingDecoder realDecoder = | |
Decode.value | |
|> Decode.andThen | |
(\event -> | |
case Decode.decodeValue realDecoder event of | |
Ok decoded -> | |
Decode.succeed decoded | |
Err error -> | |
error | |
|> Decode.errorToString | |
|> Debug.log "decoding error" | |
|> Decode.fail | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment