Elm Exactly
Results / elm-core /

EmbeddedReturnEmptyStringTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.uncons` returns `Just` the first character and the rest of a
non-empty string, and `Nothing` for the empty string.

The test logs `String.uncons "hello"`, which is `Just ('h',"ello")`, and
`String.uncons ""`, which is `Nothing`.

Results

elm-0.19.1

passran in 63 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
r1: Just ('h',"ello")
r2: Nothing

elm-0.19.2

passran in 82 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
r1: Just ('h',"ello")
r2: Nothing

elm-0.19.3

passran in 61 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
r2: Nothing
r1: Just ('h',"ello")

lamdera-1.5.0

passran in 52 ms
Output
r2: Nothing
r1: Just ('h',"ello")

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module EmbeddedReturnEmptyStringTest exposing (main)
{-| `String.uncons` returns `Just` the first character and the rest of a
non-empty string, and `Nothing` for the empty string.
The test logs `String.uncons "hello"`, which is `Just ('h',"ello")`, and
`String.uncons ""`, which is `Nothing`.
-}
-- CHECK: r1: Just ('h',"ello")
-- CHECK: r2: Nothing
import Html exposing (text)
main =
let
r1 =
String.uncons "hello"
r2 =
String.uncons ""
_ = Debug.log "r1" r1
_ = Debug.log "r2" r2
in
text "done"