-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Hi everyone,
I stumbled upon odd behaviour regarding leading zeros:
Observed
> Parser.run Parser.int "0123"
Ok 0 : Result (List Parser.DeadEnd) Int
> Parser.run Parser.float "0123"
Ok 0 : Result (List Parser.DeadEnd) FloatExpected
The documentation suggests that this would cause an Err-Result. (at least for Parser.int)
I personally expected python-like behaviour:
>>> int("0123")
123
>>> float("0123")
123.0In any case, Ok 0 makes the user think, the input was correctly parsed, when in fact it was not.
Final Thoughts
I want to thank you for your work in the elm community and especially the nice design of the elm/parser. It's a blast to work with so far.
I'd be happy to contribute to a fix, if you too see this as a bug.
asett0, youlam, miniBill, jaredramirez and tomjschuster
Metadata
Metadata
Assignees
Labels
No labels