Proposal: Improve Read Integer

malcolm.wallace malcolm.wallace at me.com
Wed Nov 17 04:50:19 EST 2010


On the other hand,

    import Numeric
    main = do
        print (readDec "1.2" :: [(Integer,String)])
        print (readSigned readDec "1.2" :: [(Integer,String)])

currently gives

    [(1,".2")]
    []

The behaviour of readDec is entirely as I would expect - the behaviour of readSigned is not.  I think it is confusing that (readSigned readDec) and readDec give different results.  As the errata maintainer of the Haskell'98 Report, I would be prepared to regard the current behaviour of readSigned as a Report bug, if there is consensus.  I'm not sure whether Haskell'2010 has an errata maintainer.
Regards,
    Malcolm


On 17 Nov, 2010,at 09:00 AM, Lennart Augustsson <lennart at augustsson.net> wrote:

The current behaviour is consistent with how Haskell tokenizes at the
source level.
I find this easy to remember, and I would be surprised if read behaved
the way you suggest.

-- Lennart

On Tue, Nov 16, 2010 at 8:34 PM, Ian Lynagh <igloo at earth.li> wrote:
>
> Proposal: Improve Read Integer
> http://hackage.haskell.org/trac/ghc/ticket/4500
>
> Currently, according to H98, H2010, GHC and hugs,
>    reads "1.2" :: [(Integer, String)]
> is
>    []
> whereas I would expect it to be
>    [(1,".2")]
>
> Patch:
> http://hackage.haskell.org/trac/ghc/attachment/ticket/4500/read-integer.dpatch
>
> Suggested deadline: 1 Dec 2010.
>
>
> Thanks
> Ian
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
_______________________________________________
Libraries mailing list
Libraries at haskell.org
http://www.haskell.org/mailman/listinfo/libraries
-------------- next part --------------
Skipped content of type multipart/related


More information about the Libraries mailing list