Renamed to lambda-phi/parser. It is published under that name, and new versions come out there.
Versions published as davidcavazos/parser still install under that name. 2 versions of 12 come from the new location (see their notes). 10 versions could not be recovered and cannot be installed.
Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/lambda-phi/parser exists but has no tag 4.0.0; Software Heritage has not archived the repo; no fork with tag 4.0.0 found (60 same-name repos checked); no cached copy. Use another version.
Common and other useful parsers.
Gets a decimal value as a Float.
import Parser exposing (parse)
import Parser.Error
-- You can parse numbers as `Float` instead of `String`.
parse "12" number --> Ok 12.0
parse "12." number --> Ok 12.0
parse "12.34" number --> Ok 12.34
parse ".12" number --> Ok 0.12
-- It also works with negative numbers.
parse "-12.34" number --> Ok -12.34
parse "-.12" number --> Ok -0.12
-- But not with invalid numbers.
parse "." number
|> Result.mapError Parser.Error.message
--> Err "1:1: I was expecting a digit [0-9]. I got stuck when I got the character '.'."
parse "abc" number
|> Result.mapError Parser.Error.message
--> Err "1:1: I was expecting a digit [0-9]. I got stuck when I got the character 'a'."
Gets an integer value as an
Int.