Elm Exactly
Results / elm-core /

StringToFloatLiteralTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.toFloat "1.5"` gives `Just 1.5`, equal to the literal `1.5`.

Results

elm-0.19.1

passran in 58 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
toFloat just: Just 1.5
toFloat just eq: True

elm-0.19.2

passran in 39 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
toFloat just: Just 1.5
toFloat just eq: True

elm-0.19.3

passran in 44 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
toFloat just: Just 1.5
toFloat just eq: True

lamdera-1.5.0

passran in 58 ms
Output
toFloat just: Just 1.5
toFloat just eq: True

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringToFloatLiteralTest exposing (main)
{-| `String.toFloat "1.5"` gives `Just 1.5`, equal to the literal `1.5`.
-}
-- MODE-GUARD: a Char equality must give the same answer as under --optimize
-- NO-SKIP: an edge case every compiler must run
-- CHECK: toFloat just: Just 1.5
-- CHECK: toFloat just eq: True
import Html exposing (text)
main =
let
_ =
Debug.log "toFloat just" (String.toFloat "1.5")
_ =
Debug.log "toFloat just eq" (String.toFloat "1.5" == Just 1.5)
in
text "done"