Elm Exactly
Results / elm-json /

DecodeKeyValuePairsTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Json.Decode.keyValuePairs` decodes a JSON object to a list of (key, value) pairs, here in the
order the keys appear in the input.

Results

elm-0.19.1

passran in 55 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
kvp1: Ok [("a",1),("b",2)]

elm-0.19.2

passran in 66 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
kvp1: Ok [("a",1),("b",2)]

elm-0.19.3

passran in 56 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
kvp1: Ok [("a",1),("b",2)]

lamdera-1.5.0

passran in 71 ms
Output
kvp1: Ok [("a",1),("b",2)]

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-json/DecodeKeyValuePairsTest] in its title.

Source

The -- CHECK: lines give the expected output.

module DecodeKeyValuePairsTest exposing (main)
{-| `Json.Decode.keyValuePairs` decodes a JSON object to a list of (key, value) pairs, here in the
order the keys appear in the input.
-}
-- CHECK: kvp1: Ok [("a",1),("b",2)]
import Html exposing (text)
import Json.Decode as Decode
main =
let
_ = Debug.log "kvp1" (Decode.decodeString (Decode.keyValuePairs Decode.int) "{\"a\":1,\"b\":2}")
in
text "done"