Elm Exactly
Results / elm-parser /

ParserSpacesTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks that `Parser.spaces` skips whitespace around a value: `"   42   "` gives `Ok 42`.

Results

elm-0.19.1

passran in 56 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: Ok 42

elm-0.19.2

passran in 56 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: Ok 42

elm-0.19.3

passran in 65 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: Ok 42

lamdera-1.5.0

passran in 49 ms
Output
result: Ok 42

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ParserSpacesTest exposing (main)
{-| Checks that `Parser.spaces` skips whitespace around a value: `" 42 "` gives `Ok 42`.
-}
-- CHECK: result: Ok 42
import Html exposing (text)
import Parser exposing ((|.), (|=))
p : Parser.Parser Int
p =
Parser.succeed identity
|. Parser.spaces
|= Parser.int
|. Parser.spaces
main =
let
result = Parser.run p " 42 "
_ = Debug.log "result" result
in
text "done"