I am not sure I understand the answer. If you are talking about calling
decode function then, as Jacob mentioned, it works in all cases but the one
we're wondering about.

Check this example:

onScroll tagger =
>   on "scroll" (Json.Decode.map tagger decodeScrollPosition)


Where decodeScrollPosition is:

> decodeScrollPosition : Json.Decode.Decoder Int


"on" function is only accepting value of type Json.Decode.Decoder. If I was
decoding myself (e.g. by calling Json.Decode.decodeString) I would get a
Result and process it the way you mention. But in case of an event listener
decoding is happening somewhere within Elm runtime which silently swallows
error. If I, for example, misspell event's field name, nothing will happen.
No runtime error (that's still valid), but no result either.

I am wondering if I am missing something. To my mind it does not fit to the
whole impression Elm's trying to create. And I am a bit confused.

Sergey Zubtsovskiy
sergey.zubtsovs...@gmail.com
Skype: szubtsovskiy


2016-08-19 21:31 GMT+02:00 Simon <hotbe...@gmail.com>:

> <shamless-plug>
> My emulator may help - http://simonh1000.github.io/decoder/
> </shamless-plug>
>
> On Friday, 19 August 2016 19:56:05 UTC+2, OvermindDL1 wrote:
>
> On Friday, August 19, 2016 at 11:17:45 AM UTC-6, Sergey Zubtsovskiy wrote:
>>>
>>> Hey Jacob,
>>>
>>> Any update on this topic? I am facing the same issue, even in Elm 0.17
>>> with latest libraries...
>>>
>>
>> You can setup multiple branches in a decode so it one fails then you can
>> fall back to a default value so it still passes.  You could even return a
>> Maybe and return a default value of Nothing if you want, wrapping the main
>> decode branch in a Just.
>>
> ​
>
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to