Haskell 2010: libraries
Ian Lynagh
igloo at earth.li
Sun Jul 19 12:00:47 EDT 2009
On Tue, Jul 14, 2009 at 12:23:51PM +0100, Duncan Coutts wrote:
> On Tue, 2009-07-14 at 00:20 +0100, Ian Lynagh wrote:
> > On Mon, Jul 13, 2009 at 09:56:50PM +0100, Duncan Coutts wrote:
> > >
> > > Specifically, I suggest:
> > >
> > > 4. Ix keep as Data.Ix
> > > 5. Array keep as Data.Array
>
> Though also note that we have not changed any of the existing ones. Is
> there a problem with specifying in the libraries section of the report
> that the exports are a minimum and not a maximum?
Here's another example I've just been looking at:
Prelude> Array.listArray (1,4) [1..4] Array.! 5
*** Exception: Ix{Integer}.index: Index (5) out of range ((1,4))
Prelude> Array.listArray ((0,0), (3,3)) (repeat 0) Array.! (0,5)
*** Exception: Error in array index
Because the "Ix Integer" instance is for a type that we have a "Show"
instance for, it can give a nice out-of-bounds error message.
But the "Ix (a, b)" instance doesn't know if "(Show a, Show b)"
instances exist, so it has to fall back to an unhelpful error message.
So one could certainly argue that we should make Show a superclass of
Ix, leaving us with a class that is incompatible with the older class
definition.
Thanks
Ian
More information about the Haskell-prime
mailing list