Elm Exactly
Results / elm-core /

TupleMapFirstTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Tuple.mapFirst` applies a function to the first component of a pair and leaves the second unchanged.

Results

elm-0.19.1

passran in 80 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
mapFirst1: (2,10)
mapFirst2: (10,20)

elm-0.19.2

passran in 62 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
mapFirst1: (2,10)
mapFirst2: (10,20)

elm-0.19.3

passran in 53 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
mapFirst1: (2,10)
mapFirst2: (10,20)

lamdera-1.5.0

passran in 40 ms
Output
mapFirst1: (2,10)
mapFirst2: (10,20)

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module TupleMapFirstTest exposing (main)
{-| `Tuple.mapFirst` applies a function to the first component of a pair and leaves the second unchanged.
-}
-- CHECK: mapFirst1: (2,10)
-- CHECK: mapFirst2: (10,20)
import Html exposing (text)
main =
let
_ = Debug.log "mapFirst1" (Tuple.mapFirst (\x -> x * 2) (1, 10))
_ = Debug.log "mapFirst2" (Tuple.mapFirst (\x -> x + 5) (5, 20))
in
text "done"