Re: User defined Ix instances potentially unsafe

2001-05-07 Thread Marcin 'Qrczak' Kowalczyk
Mon, 7 May 2001 03:15:16 -0700, Simon Peyton-Jones [EMAIL PROTECTED] pisze: The constraint (*) also specifies that 'range' returns subscripts in increasing order of index. That seems reasonable, but perhaps less important. It is important if elems should return elements in the same order as

Re: User defined Ix instances potentially unsafe

2001-05-07 Thread Fergus Henderson
On 07-May-2001, Simon Peyton-Jones [EMAIL PROTECTED] wrote: In thinking about this I've realised that there's an assumption in the Ix interface that (*) map index (range (l,u)) = [0..rangeSize (l,u)-1] ... The constraint (*) also specifies that 'range' returns subscripts in increasing

Re: User defined Ix instances potentially unsafe

2001-05-05 Thread Fergus Henderson
On 02-May-2001, Matt Harden [EMAIL PROTECTED] wrote: Matt Harden wrote: blah, blah, blah, bug in the Library Report, blah, blah... OK, so I failed to read the Library Report. It clearly states: An implementation is entitled to assume the following laws about these operations:

Re: User defined Ix instances potentially unsafe

2001-05-02 Thread Matt Harden
Matt Harden wrote: blah, blah, blah, bug in the Library Report, blah, blah... OK, so I failed to read the Library Report. It clearly states: An implementation is entitled to assume the following laws about these operations: range (l,u) !! index (l,u) i == i -- when i is in

Re: User defined Ix instances potentially unsafe

2001-05-02 Thread Matt Harden
Matt Harden wrote: blah, blah, blah, bug in the Library Report, blah, blah... OK, so I failed to read the Library Report. It clearly states: An implementation is entitled to assume the following laws about these operations: range (l,u) !! index (l,u) i == i -- when i is in

User defined Ix instances potentially unsafe

2001-05-01 Thread Matt Harden
Sorry if this has been reported before. I shouldn't be able to crash ghc or hugs without using any unsafe features, right? Well, here 'tis: module CrashArray where import Array import Ix newtype CrashIx = CrashIx Int deriving (Ord, Eq, Show) instance Enum CrashIx where toEnum

User defined Ix instances potentially unsafe

2001-05-01 Thread Matt Harden
Sorry if this has been reported before. I shouldn't be able to crash ghc or hugs without using any unsafe features, right? Well, here 'tis: module CrashArray where import Array import Ix newtype CrashIx = CrashIx Int deriving (Ord, Eq, Show) instance Enum CrashIx where toEnum