Numeric read seems too strict

Carter Schonwald carter.schonwald at gmail.com
Sun Oct 2 12:10:53 UTC 2016


Do we have benchmarks for your proposed change?
Does it handle hex and binary formats too ?

On Sunday, October 2, 2016, David Feuer <david.feuer at gmail.com> wrote:

> Yeah, that. With a paren count and an accumulator and for fractional
> numbers some care around the decimal point or slash, we can look at each
> digit just once. Fast/lazy failure would be a pleasant side effect of
> running a numbers-only process from top to bottom. Yes, Read is supposed to
> read things that look like Haskell expressions, but it's really not a
> Haskell parser and pretending it is only hurts.
>
> On Oct 2, 2016 12:07 AM, "Ivan Lazar Miljenovic" <
> ivan.miljenovic at gmail.com
> <javascript:_e(%7B%7D,'cvml','ivan.miljenovic at gmail.com');>> wrote:
>
>> On 2 October 2016 at 14:34, David Feuer <david.feuer at gmail.com
>> <javascript:_e(%7B%7D,'cvml','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.
>>
>> As in multiply the current sum by 10 before adding each new digit?
>>
>> >
>> >
>> > On Oct 1, 2016 10:07 PM, "wren romano" <winterkoninkje at gmail.com
>> <javascript:_e(%7B%7D,'cvml','winterkoninkje at gmail.com');>> wrote:
>> >>
>> >> On Mon, Sep 12, 2016 at 11:03 AM, David Feuer <david.feuer at gmail.com
>> <javascript:_e(%7B%7D,'cvml','david.feuer at gmail.com');>>
>> >> wrote:
>> >> > By the way, I believe we should be able to read numbers more
>> efficiently
>> >> > by
>> >> > parsing them directly instead of lexing first. We have to deal with
>> >> > parentheses, white space, and signs uniformly for all number types.
>> Then
>> >> > specialized foldl'-style code *should* be able to parse integral and
>> >> > fractional numbers faster than any lex-first scheme.
>> >>
>> >> I follow the part about parentheses and negations, but I'm not sure I
>> >> get the rest of what you mean. E.g., I'm not sure how any parser could
>> >> be faster than what bytestring-lexing does for Fractional and Integral
>> >> types (ignoring the unoptimized hex and octal functions). What am I
>> >> missing?
>> >>
>> >> --
>> >> Live well,
>> >> ~wren
>> >
>> >
>> > _______________________________________________
>> > Libraries mailing list
>> > Libraries at haskell.org
>> <javascript:_e(%7B%7D,'cvml','Libraries at haskell.org');>
>> > http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>> >
>>
>>
>>
>> --
>> Ivan Lazar Miljenovic
>> Ivan.Miljenovic at gmail.com
>> <javascript:_e(%7B%7D,'cvml','Ivan.Miljenovic at gmail.com');>
>> http://IvanMiljenovic.wordpress.com
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20161002/4d92d4a8/attachment-0001.html>


More information about the Libraries mailing list