Elm Exactly
Results / elm-core /

CharAstralListHeadTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
An astral `Char` (code point above 0xFFFF) held in a list keeps its code point
when read through `List.head`, a cons pattern and `List.map`, and `Debug.log`
prints the list with the characters themselves.

The cons pattern in `secondCode` picks the second element of the list after
`List.drop 1`, which is U+1D11E.

Results

elm-0.19.1

passran in 62 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
head_code: Just 128512
match_code: 119070
list_codes: [128512,97,119070]
list_show: ['๐Ÿ˜€','a']

elm-0.19.2

passran in 60 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
head_code: Just 128512
match_code: 119070
list_codes: [128512,97,119070]
list_show: ['๐Ÿ˜€','a']

elm-0.19.3

passran in 47 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
list_show: ['๐Ÿ˜€','a']
list_codes: [128512,97,119070]
match_code: 119070
head_code: Just 128512

lamdera-1.5.0

passran in 59 ms
Output
list_show: ['๐Ÿ˜€','a']
list_codes: [128512,97,119070]
match_code: 119070
head_code: Just 128512

Discussions

Discuss this testยทSearch the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module CharAstralListHeadTest exposing (main)
{-| An astral `Char` (code point above 0xFFFF) held in a list keeps its code point
when read through `List.head`, a cons pattern and `List.map`, and `Debug.log`
prints the list with the characters themselves.
The cons pattern in `secondCode` picks the second element of the list after
`List.drop 1`, which is U+1D11E.
-}
-- CHECK: head_code: Just 128512
-- CHECK: match_code: 119070
-- CHECK: list_codes: [128512,97,119070]
-- CHECK: list_show: ['๐Ÿ˜€','a']
import Html exposing (text)
secondCode : List Char -> Int
secondCode cs =
case cs of
_ :: c :: _ ->
Char.toCode c
_ ->
-1
main =
let
cs =
[ '๐Ÿ˜€', 'a', Char.fromCode 0x0001D11E ]
_ =
Debug.log "head_code" (Maybe.map Char.toCode (List.head cs))
_ =
Debug.log "match_code" (secondCode (List.drop 1 cs))
_ =
Debug.log "list_codes" (List.map Char.toCode cs)
_ =
Debug.log "list_show" [ '๐Ÿ˜€', 'a' ]
in
text "done"