Proposal: Improve Read Integer

Yitzchak Gale gale at
Wed Nov 17 02:33:28 EST 2010

I wrote:
>> This is a good change. But for GHC the patch is not complete.
>> It needs to provide the old behavior in H98 and H2010 mode.

Ian Lynagh wrote:
> To do this we'd have to have a separate Integer type in
> haskell98/haskell2010, and therefore separate definitions of all
> classes and functions whose types contain Integer, and different
> default type defaulting.

Effectively, we are talking about a library change for Haskell 2011.
This is the version of Haskell Prime where we expect
such changes, including Prelude changes, to begin happening, so
this won't be the only one.

Breaking changes to the base libraries have
sometimes created quite a mess. May I mention
extensible exceptions? I think Simon did a great
job on the module design side, but I hope we are a
little wiser now about how that process should go
in Cabal, on Hackage, and for the Haskell Platform.

What mechanism are you proposing?

> I doubt anyone relies on the current behaviour, and I think it's just an
> oversight (i.e. bug) in the language definition anyway.

The current behavior is consistent with the behavior of just
about every other popular programming language. Of course,
most of them are sullied with all kinds of horrid numeric type
coercion, and you are absolutely correct that this unseemliness
should not be allowed to seep into Haskell's pristine waters.

But most people wouldn't think of it at first. That's probably
why the Read instance is what it is. And I'm not sure you're
correct that no one has ever unthinkingly relied upon
that behavior.

> So I suggest we shouldn't be strictly backwards compatible
> in this case.

Perhaps that is OK, perhaps not.

In any case, we do need a sane mechanism for introducing
these kinds of library changes simply while at the same time
providing a reasonable deprecation process with legacy support.


More information about the Libraries mailing list