patch applied (packages/base): IsString is GHC-only (so why is it in the Prelude?)

Ian Lynagh igloo at earth.li
Wed Jan 24 08:15:47 EST 2007


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
98.

This uses a new class

    class IsString a where
        fromString :: String -> a

which is defined in GHC.Base and re-exported by the Prelude.

Letting this Prelude change through was my fault - for some reason I
didn't notice it, or it didn't register, or something.

That said, I'm not sure where else I'd put it. GHC.Exts is the only
place I can think of that it vaguely belongs, but the class itself is
entirely portable, so this doesn't feel right to me.

Also, in GHC(-fglasgow-exts) the class will appear in types with no
other modules loaded. If the extension was in the language then I would
certainly expect the class to be in the Prelude.

When I last asked Isaac about it, it hadn't beeen decided how much
Haskell' will say about libraries. I can't remember if I've said this in
public before, but my opinion is that it should say as little as
possible; we have recently been able to make a number of improvements to
the base libraries as the move to hierarchical libraries has meant that
the Haskell 98 standard hasn't tied our hands, and I think it would be a
mistake to tie them again with Haskell'. Thus I think the addition of
such a class, even to the Prelude, should be OK for Haskell'. Of course,
concensus may not agree with me, and it's also possible there will be
releases of implementations using the HEAD branch of the base packages
before Haskell' is done.


So to summarise, it was a mistake to let it in without discussion;
sorry. But my opinion is that it should be there (for all
implementations) anyway once we are making Haskell' implementations, and
I don't know where to put it in the meantime.


Thanks
Ian



More information about the Libraries mailing list