Elm Exactly
Results / elm /

LetNumberMap2Test

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
A list of integer literals combined with a list of `Float`s by `List.map2` is
used at `Float`: `[ 30, 40 ]` scaled by 1.5 and rounded logs `[45,60]`.

The list is let-bound with type `List number`. Inside the `List.map2` lambda
each element is multiplied by `1.5` and added to an element of `[ 0.0, 0.0 ]`,
which makes it a `Float`.

`List.map2` is a library function written in elm/core's kernel code, outside A Standard
Definition of Elm? (Appendix C, Library functions), so this test is not tagged `elm-spec`: it
keeps a `number` literal crossing a two-argument kernel function. `LetNumberLocalMap2Test` checks
the same typing with a `map2` written in the program.

Results

elm-0.19.1

passran in 44 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
map2: [45,60]

elm-0.19.2

passran in 67 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
map2: [45,60]

elm-0.19.3

passran in 62 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
map2: [45,60]

lamdera-1.5.0

passran in 61 ms
Output
map2: [45,60]

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module LetNumberMap2Test exposing (main)
{-| A list of integer literals combined with a list of `Float`s by `List.map2` is
used at `Float`: `[ 30, 40 ]` scaled by 1.5 and rounded logs `[45,60]`.
The list is let-bound with type `List number`. Inside the `List.map2` lambda
each element is multiplied by `1.5` and added to an element of `[ 0.0, 0.0 ]`,
which makes it a `Float`.
`List.map2` is a library function written in elm/core's kernel code, outside A Standard
Definition of Elm? (Appendix C, Library functions), so this test is not tagged `elm-spec`: it
keeps a `number` literal crossing a two-argument kernel function. `LetNumberLocalMap2Test` checks
the same typing with a `map2` written in the program.
-}
-- CHECK: map2: [45,60]
import Html exposing (text)
main =
let
xs =
[ 30, 40 ]
result =
List.map2 (\x y -> round (x * 1.5 + y)) xs [ 0.0, 0.0 ]
_ =
Debug.log "map2" result
in
text "done"