| class Ord a => Ix a where | 
The first argument (l,u) of each of these operations is a pair specifying the lower and upper bounds of a contiguous subrange of values.
An implementation is entitled to assume the following laws about these operations:
Minimal complete instance: range, index and inRange.
Methods
| range :: (a, a) -> [a] | 
| index :: (a, a) -> a -> Int | 
| inRange :: (a, a) -> a -> Bool | 
| rangeSize :: (a, a) -> Int | 
| instance Ix Bool | 
| instance Ix Char | 
| instance Ix Int | 
| instance Ix Int8 | 
| instance Ix Int16 | 
| instance Ix Int32 | 
| instance Ix Int64 | 
| instance Ix Integer | 
| instance Ix Ordering | 
| instance Ix Word | 
| instance Ix Word8 | 
| instance Ix Word16 | 
| instance Ix Word32 | 
| instance Ix Word64 | 
| instance Ix () | 
| instance Ix GeneralCategory | 
| instance Ix SeekMode | 
| instance Ix IOMode | 
| instance (Ix a, Ix b) => Ix (a, b) | 
| instance (Ix a1, Ix a2, Ix a3) => Ix (a1, a2, a3) | 
| instance (Ix a1, Ix a2, Ix a3, Ix a4) => Ix (a1, a2, a3, a4) | 
| instance (Ix a1, Ix a2, Ix a3, Ix a4, Ix a5) => Ix (a1, a2, a3, a4, a5) | 
It is possible to derive an instance of Ix automatically, using a deriving clause on a data declaration. Such derived instance declarations for the class Ix are only possible for enumerations (i.e. datatypes having only nullary constructors) and single-constructor datatypes, whose constituent types are instances of Ix. A Haskell implementation must provide Ix instances for tuples up to at least size 15.
For an enumeration, the nullary constructors are assumed to be numbered left-to-right with the indices being 0 to n-1 inclusive. This is the same numbering defined by the Enum class. For example, given the datatype:
we would have:
For single-constructor datatypes, the derived instance declarations are as shown for tuples: