Elm Exactly
Results / elm-parser /

ParserMapChompedStringTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks that `Parser.mapChompedString` passes the consumed text to its function.

`chompWhile Char.isAlpha` on `"abc"` consumes `"abc"`, and the function
combines that text with its upper-cased form, giving `Ok "abc-ABC"`.

Results

elm-0.19.1

passran in 57 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 "abc-ABC"

elm-0.19.2

passran in 78 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 "abc-ABC"

elm-0.19.3

passran in 85 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 "abc-ABC"

lamdera-1.5.0

passran in 81 ms
Output
result: Ok "abc-ABC"

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ParserMapChompedStringTest exposing (main)
{-| Checks that `Parser.mapChompedString` passes the consumed text to its function.
`chompWhile Char.isAlpha` on `"abc"` consumes `"abc"`, and the function
combines that text with its upper-cased form, giving `Ok "abc-ABC"`.
-}
-- CHECK: result: Ok "abc-ABC"
import Char
import Html exposing (text)
import Parser
import String
upperWithRaw : Parser.Parser String
upperWithRaw =
Parser.mapChompedString
(\raw _ -> raw ++ "-" ++ String.toUpper raw)
(Parser.chompWhile Char.isAlpha)
main =
let
result = Parser.run upperWithRaw "abc"
_ = Debug.log "result" result
in
text "done"