Numeric read seems too strict

wren romano winterkoninkje at gmail.com
Sun Oct 9 04:56:07 UTC 2016


On Sat, Oct 1, 2016 at 8:34 PM, David Feuer <david.feuer at gmail.com> wrote:
> Instead of scanning first (in lexing) to find the end of the number and then
> scanning the string again to calculate the number, start to calculate once
> the first digit appears.

Ah, yes. bytestring-lexing does that (among numerous other things). It
does save a second pass over the characters, but I'm not sure what
proportion of the total slowdown of typical parser combinators is
actually due to the second pass, as opposed to other problems with the
typical "how hard can it be" lexers/parsers people knock out. Given
the multitude of other problems (e.g., using Integer or other
expensive types throughout the computation, not forcing things often
enough to prevent thunks and stack depth, etc), I'm not sure it's
legit to call it a "parser vs lexer" issue.

-- 
Live well,
~wren


More information about the Libraries mailing list