Data.Ix.Enum

utility-ht-0.0.12: Various small helper functions for Lists, Maybes, Tuples, Functions

Safe Haskell | Safe
Language | Haskell98

Data.Ix.Enum

Description

Implementations of `Ix` methods in terms of `Enum` methods.

For a type `T` of class `Enum` you can easily define an `Ix` instance by copying the following code into your module:

    import qualified Data.Ix.Enum as IxEnum

    instance Ix T where
       range           = IxEnum.range
       index           = IxEnum.index
       inRange         = IxEnum.inRange
       rangeSize       = IxEnum.rangeSize
       unsafeIndex     = IxEnum.unsafeIndex
       unsafeRangeSize = IxEnum.unsafeRangeSize

# Documentation

range :: Enum a => (a, a) -> [a] #

index :: Enum a => (a, a) -> a -> Int #

unsafeIndex :: Enum a => (a, a) -> a -> Int #

inRange :: Enum a => (a, a) -> a -> Bool #

rangeSize :: Enum a => (a, a) -> Int #

unsafeRangeSize :: Enum a => (a, a) -> Int #