Elm Exactly
Results / elm-core /

JsArraySingletonAndPushPrimitivesTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Array.repeat 1` and `Array.push` work on arrays of `Int`, `Float` and `Char`.

For each element type, `Array.repeat 1` makes a one-element array and `Array.push` adds an element to the end of a small array built with `Array.fromList`. Each result is printed through `Array.toList`.

Results

elm-0.19.1

passran in 65 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_singleton: [42]
float_singleton: [3.14]
char_singleton: ['z']
int_push: [1,2,3,99]
float_push: [1.5,2.5,9.5]
char_push: ['a','b','q']

elm-0.19.2

passran in 85 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_singleton: [42]
float_singleton: [3.14]
char_singleton: ['z']
int_push: [1,2,3,99]
float_push: [1.5,2.5,9.5]
char_push: ['a','b','q']

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.
int_singleton: [42]
float_singleton: [3.14]
char_singleton: ['z']
int_push: [1,2,3,99]
float_push: [1.5,2.5,9.5]
char_push: ['a','b','q']

lamdera-1.5.0

passran in 49 ms
Output
int_singleton: [42]
float_singleton: [3.14]
char_singleton: ['z']
int_push: [1,2,3,99]
float_push: [1.5,2.5,9.5]
char_push: ['a','b','q']

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module JsArraySingletonAndPushPrimitivesTest exposing (main)
{-| `Array.repeat 1` and `Array.push` work on arrays of `Int`, `Float` and `Char`.
For each element type, `Array.repeat 1` makes a one-element array and `Array.push` adds an element to the end of a small array built with `Array.fromList`. Each result is printed through `Array.toList`.
-}
-- CHECK: int_singleton: [42]
-- CHECK: float_singleton: [3.14]
-- CHECK: char_singleton: ['z']
-- CHECK: int_push: [1,2,3,99]
-- CHECK: float_push: [1.5,2.5,9.5]
-- CHECK: char_push: ['a','b','q']
import Array
import Html exposing (text)
main =
let
_ =
Debug.log "int_singleton" (Array.toList (Array.repeat 1 42))
_ =
Debug.log "float_singleton" (Array.toList (Array.repeat 1 3.14))
_ =
Debug.log "char_singleton" (Array.toList (Array.repeat 1 'z'))
intArr : Array.Array Int
intArr =
Array.fromList [ 1, 2, 3 ]
floatArr : Array.Array Float
floatArr =
Array.fromList [ 1.5, 2.5 ]
charArr : Array.Array Char
charArr =
Array.fromList [ 'a', 'b' ]
_ =
Debug.log "int_push" (Array.toList (Array.push 99 intArr))
_ =
Debug.log "float_push" (Array.toList (Array.push 9.5 floatArr))
_ =
Debug.log "char_push" (Array.toList (Array.push 'q' charArr))
in
text "done"