decimal does not range-check
- Dominant language
- Haskell
- Stars
- 531
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
I just realized that `decimal` does not check for out-of-range values.
https://hackage.haskell.org/package/attoparsec-0.14.4/docs/src/Data.Attoparsec.ByteString.Char8.html#decimal
```
ghci> parseOnly (decimal @Word16) "65536"
Right 0
```
This was surprising to me, but only before considering the type constraint of Integral without Bounded, implying that range check is impossible.
Still, from the user's perspective, doing the appropriate range checks somewhere is necessary, if not by the library then by the user. If done by the user, he can only parse a Natural and the Word16 specialization becomes useless/unused.
Currently, this behavior carries over to cassava, which also fails to do the necessary range-check.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.