patch applied (packages/base): IsString is GHC-only (so why is
it in the Prelude?)
simonmarhaskell at gmail.com
Wed Jan 24 08:59:51 EST 2007
Ian Lynagh wrote:
> On Tue, Jan 23, 2007 at 06:43:22PM +0000, Duncan Coutts wrote:
>> On Tue, 2007-01-23 at 10:38 -0800, Ross Paterson wrote:
>>> Tue Jan 23 10:30:07 PST 2007 Ross Paterson <ross at soi.city.ac.uk>
>>> * IsString is GHC-only (so why is it in the Prelude?)
>> Yes, can we please have a discussion about what's going on here.
>> Changes to the base library are supposed to go via the libraries review
>> process. I'm not complaining that we slipped up, I just want to make
>> sure people can have a chance to comment. I'm cc'ing the libraries list.
> For those who haven't been following, this comes from a new GHC
> extension that means string literals like "foo" have type (IsString a =>
> a) rather than String. This is analogous to (5 :: Num a => a) in Haskell
> This uses a new class
> class IsString a where
> fromString :: String -> a
> which is defined in GHC.Base and re-exported by the Prelude.
Unfortunately additions to the Prelude module affect compatibility with Haskell
98, so we can't admit any such additions while we claim to support Haskell 98.
I suggest this be backed out.
I don't think there's any issue with the compiler having built-in knowledge of a
class that isn't part of the Prelude. In order to mention the class explicitly
you'd have to import the relevant module, that's all. So how about proposing it
for Data.String, perhaps?
More information about the Libraries