Elm Exactly
Results / elm-core /

StringFromNumberCaptureTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.fromInt` and `String.fromFloat` work when passed unapplied, as the function
argument of `List.map`.

`[1, 2, 3]` becomes `["1","2","3"]`, and `[0.5, 1.5, 2.5]` becomes `["0.5","1.5","2.5"]`.

Results

elm-0.19.1

passran in 70 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
int_strings: ["1","2","3"]
float_strings: ["0.5","1.5","2.5"]

elm-0.19.2

passran in 44 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
int_strings: ["1","2","3"]
float_strings: ["0.5","1.5","2.5"]

elm-0.19.3

passran in 50 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
int_strings: ["1","2","3"]
float_strings: ["0.5","1.5","2.5"]

lamdera-1.5.0

passran in 36 ms
Output
int_strings: ["1","2","3"]
float_strings: ["0.5","1.5","2.5"]

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringFromNumberCaptureTest exposing (main)
{-| `String.fromInt` and `String.fromFloat` work when passed unapplied, as the function
argument of `List.map`.
`[1, 2, 3]` becomes `["1","2","3"]`, and `[0.5, 1.5, 2.5]` becomes `["0.5","1.5","2.5"]`.
-}
-- CHECK: int_strings: ["1","2","3"]
-- CHECK: float_strings: ["0.5","1.5","2.5"]
import Html exposing (text)
main =
let
ints : List Int
ints =
[ 1, 2, 3 ]
floats : List Float
floats =
[ 0.5, 1.5, 2.5 ]
_ =
Debug.log "int_strings" (List.map String.fromInt ints)
_ =
Debug.log "float_strings" (List.map String.fromFloat floats)
in
text "done"