MaybeMapToStringTest
`Maybe.map` with an Int -> String function produces a `Maybe String`: mapping `String.fromInt` over `Just 42` gives `Just "42"`.
Results
elm-0.19.1
passran in 60 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: Just "42"
elm-0.19.2
passran in 42 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. result: Just "42"
elm-0.19.3
passran in 37 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. result: Just "42"
lamdera-1.5.0
passran in 88 msOutput
result: Just "42"
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/MaybeMapToStringTest] in its title.
Source
The -- CHECK: lines give the expected output.
module MaybeMapToStringTest exposing (main)
{-| `Maybe.map` with an Int -> String function produces a `Maybe String`: mapping `String.fromInt` over `Just 42` gives `Just "42"`.
-}
-- CHECK: result: Just "42"
import Html exposing (text)
main =
let
result =
Maybe.map String.fromInt (Just 42)
_ = Debug.log "result" result
in
text "done"