Hi, this morning I got into a weird bug with a value obtained from a 
decoder. I got elm code compiling but runtime error.
I have this inside an update:

let
    groundtruth : Maybe RLE
    groundtruth =
        Decode.decodeString RLE.decode rleString
            |> Result.toMaybe

    -- The problem appears when I add this code:
    groundtruthMatrix : Maybe (Matrix Bool)
    groundtruthMatrix =
        groundtruth
            |> Maybe.map RLE.toMatrix
in
    ( { model | groundtruth = groundtruth }
    , Cmd.none
    )

where the signature of RLE.toMatrix is:

-- Convert a RLE image to a Matrix.
toMatrix : RLE -> Matrix Bool

and this fonction is working (according to manual tests in REPL).

The error I get when adding the groundthruthMatrix definition is in 
chromium:

main.js:790 Uncaught TypeError: Cannot read property 'length' of undefined
    at calcToRemove (main.js:790)
    at Function.append [as func] (main.js:683)
    at A2 (main.js:92)
    at main.js:16660
    at main.js:7
    at Function.func (main.js:8581)
    at A2 (main.js:92)
    at indexedMap_ (main.js:498)
    at indexedMap_ (main.js:499)
    at Function.indexedMap [as func] (main.js:480)

calcToRemove @ main.js:790
append @ main.js:683
A2 @ main.js:92
(anonymous) @ main.js:16660
(anonymous) @ main.js:7
(anonymous) @ main.js:8581
A2 @ main.js:92
indexedMap_ @ main.js:498
indexedMap_ @ main.js:499
indexedMap @ main.js:480
A2 @ main.js:92
(anonymous) @ main.js:8577
(anonymous) @ main.js:7
A3 @ main.js:99
_mpizenberg$elm_image_annotation$RLE$toMatrix @ main.js:16656
(anonymous) @ main.js:16776
(anonymous) @ main.js:1887
A2 @ main.js:92
(anonymous) @ main.js:16772
A2 @ main.js:92
(anonymous) @ main.js:3439
step @ main.js:4074
work @ main.js:4132

Do you think there is a way to correct this issue?

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to