ListHeadTailTest
`List.head` and `List.tail` return `Just` for a non-empty list and `Nothing` for the empty list.
Results
elm-0.19.1
passran in 83 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. head1: Just 1 head2: Nothing tail1: Just [2,3] tail2: Nothing
elm-0.19.2
passran in 71 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. head1: Just 1 head2: Nothing tail1: Just [2,3] tail2: Nothing
elm-0.19.3
passran in 53 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. head1: Just 1 head2: Nothing tail1: Just [2,3] tail2: Nothing
lamdera-1.5.0
passran in 55 msOutput
head1: Just 1 head2: Nothing tail1: Just [2,3] tail2: Nothing
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ListHeadTailTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ListHeadTailTest exposing (main)
{-| `List.head` and `List.tail` return `Just` for a non-empty list and `Nothing` for
the empty list.
-}
-- CHECK: head1: Just 1
-- CHECK: head2: Nothing
-- CHECK: tail1: Just [2,3]
-- CHECK: tail2: Nothing
import Html exposing (text)
main =
let
_ = Debug.log "head1" (List.head [1, 2, 3])
_ = Debug.log "head2" (List.head [])
_ = Debug.log "tail1" (List.tail [1, 2, 3])
_ = Debug.log "tail2" (List.tail [])
in
text "done"