Elm Exactly
Results / elm-core /

EmbeddedNothingAndThenTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Nothing` propagates through a chain of `Maybe.andThen` calls, whether it
starts the chain or is returned partway along it.

Results

elm-0.19.1

passran in 95 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
chain1: Nothing
chain2: Nothing

elm-0.19.2

passran in 71 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
chain1: Nothing
chain2: Nothing

elm-0.19.3

passran in 86 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
chain1: Nothing
chain2: Nothing

lamdera-1.5.0

passran in 38 ms
Output
chain1: Nothing
chain2: Nothing

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module EmbeddedNothingAndThenTest exposing (main)
{-| `Nothing` propagates through a chain of `Maybe.andThen` calls, whether it
starts the chain or is returned partway along it.
-}
-- CHECK: chain1: Nothing
-- CHECK: chain2: Nothing
import Html exposing (text)
main =
let
chain1 =
Just 5
|> Maybe.andThen (\_ -> Nothing)
|> Maybe.andThen (\x -> Just (x + 1))
chain2 =
Nothing
|> Maybe.andThen (\x -> Just (x + 1))
|> Maybe.andThen (\x -> Just (x * 2))
_ = Debug.log "chain1" chain1
_ = Debug.log "chain2" chain2
in
text "done"