-
Notifications
You must be signed in to change notification settings - Fork 97
Open
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.
Metadata
Metadata
Assignees
Labels
No labels