
29 Jan
2012
29 Jan
'12
5:09 p.m.
On 1/29/12 3:43 AM, Erik de Castro Lopo wrote:
Would you consider a function with the following signature in bytestring-lexing?
readDecimalX :: Integral a => ByteString -> a
The idea is that it gives something faster for applications like Warp where reading an valid decimal should be as fast as possible, but if the string isn't valid it doesn't really matter what the result is.
If I can figure out a way to do so without too much code duplication I will. Another option would be to use the trick that's used by the pack* functions which causes the initial checks to be inlined ---and hence easily optimized away when used with fst.fromMaybe(0,"")--- without inlining the whole thing. I'll keep you informed. -- Live well, ~wren