ResultMapTypeMismatchTest
Checks that `Result.map` can change the `Ok` type, here mapping `Ok 42` through `\x -> x > 0` from `Int` to `Bool` to get `Ok True`.
Results
elm-0.19.1
passran in 77 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets. result: Ok True
elm-0.19.2
passran in 78 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets. result: Ok True
elm-0.19.3
passran in 62 msOutput
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets. result: Ok True
lamdera-1.5.0
passran in 83 msOutput
result: Ok True
Discussions
Discuss this test·Search the discussions on GitHub
Discussions are on GitHub; one about this test has [t:elm-core/ResultMapTypeMismatchTest] in its title.
Source
The -- CHECK: lines give the expected output.
module ResultMapTypeMismatchTest exposing (main)
{-| Checks that `Result.map` can change the `Ok` type, here mapping `Ok 42` through `\x -> x > 0` from `Int` to `Bool` to get `Ok True`.
-}
-- CHECK: result: Ok True
import Html exposing (text)
main =
let
result =
Result.map (\x -> x > 0) (Ok 42)
_ = Debug.log "result" result
in
text "done"