Elm Exactly
Results / elm-core /

StringToListFromListTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.toList` and `String.fromList` convert between a string and its
characters, in both directions and on empty input.

The program logs `String.toList "hello"`, `String.fromList` of the five
characters of `hello`, the round trip `String.fromList (String.toList "abc")`,
and both functions applied to an empty string or list (`[]` and `""`).

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.
toList1: ['h','e','l','l','o']
fromList1: "hello"
roundtrip: "abc"
empty_toList: []
empty_fromList: ""

elm-0.19.2

passran in 42 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
toList1: ['h','e','l','l','o']
fromList1: "hello"
roundtrip: "abc"
empty_toList: []
empty_fromList: ""

elm-0.19.3

passran in 43 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
toList1: ['h','e','l','l','o']
fromList1: "hello"
roundtrip: "abc"
empty_toList: []
empty_fromList: ""

lamdera-1.5.0

passran in 39 ms
Output
toList1: ['h','e','l','l','o']
fromList1: "hello"
roundtrip: "abc"
empty_toList: []
empty_fromList: ""

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringToListFromListTest exposing (main)
{-| `String.toList` and `String.fromList` convert between a string and its
characters, in both directions and on empty input.
The program logs `String.toList "hello"`, `String.fromList` of the five
characters of `hello`, the round trip `String.fromList (String.toList "abc")`,
and both functions applied to an empty string or list (`[]` and `""`).
-}
-- CHECK: toList1: ['h','e','l','l','o']
-- CHECK: fromList1: "hello"
-- CHECK: roundtrip: "abc"
-- CHECK: empty_toList: []
-- CHECK: empty_fromList: ""
import Html exposing (text)
main =
let
_ = Debug.log "toList1" (String.toList "hello")
_ = Debug.log "fromList1" (String.fromList ['h', 'e', 'l', 'l', 'o'])
_ = Debug.log "roundtrip" (String.fromList (String.toList "abc"))
_ = Debug.log "empty_toList" (String.toList "")
_ = Debug.log "empty_fromList" (String.fromList [])
in
text "done"