Elm Exactly
Results / elm-core /

ListMapTemplateCalleeMemberTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks `List.map` with a callback that applies a function received as a
parameter, here a lambda bound to a typed `let` name in `main`.

`helper` maps `\x -> f x` over its list, and `main` passes it `inc`, which adds
one, so `[1, 2, 3]` maps to `[2, 3, 4]`.

Results

elm-0.19.1

passran in 88 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
mapped: [2,3,4]

elm-0.19.2

passran in 70 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
mapped: [2,3,4]

elm-0.19.3

passran in 80 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
mapped: [2,3,4]

lamdera-1.5.0

passran in 68 ms
Output
mapped: [2,3,4]

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ListMapTemplateCalleeMemberTest exposing (main)
{-| Checks `List.map` with a callback that applies a function received as a
parameter, here a lambda bound to a typed `let` name in `main`.
`helper` maps `\x -> f x` over its list, and `main` passes it `inc`, which adds
one, so `[1, 2, 3]` maps to `[2, 3, 4]`.
-}
-- CHECK: mapped: [2,3,4]
import Html exposing (text)
helper : (Int -> Int) -> List Int -> List Int
helper f xs =
List.map (\x -> f x) xs
main : Html.Html msg
main =
let
inc : Int -> Int
inc =
\y -> y + 1
mapped =
helper inc [ 1, 2, 3 ]
_ =
Debug.log "mapped" mapped
in
text "done"