Elm Exactly
Results / elm-core /

MaybeMapToUnitTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Maybe.map` with a function returning unit produces a `Maybe ()`: mapping `\_ -> ()` over `Just 42` gives `Just ()`.

Results

elm-0.19.1

passran in 91 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
result: Just ()

elm-0.19.2

passran in 75 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
result: Just ()

elm-0.19.3

passran in 74 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
result: Just ()

lamdera-1.5.0

passran in 52 ms
Output
result: Just ()

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module MaybeMapToUnitTest exposing (main)
{-| `Maybe.map` with a function returning unit produces a `Maybe ()`: mapping `\_ -> ()` over `Just 42` gives `Just ()`.
-}
-- CHECK: result: Just ()
import Html exposing (text)
main =
let
result =
Maybe.map (\_ -> ()) (Just 42)
_ = Debug.log "result" result
in
text "done"