module Data.Ix.Enum where
{-# INLINE range #-}
{-# INLINE index #-}
{-# INLINE unsafeIndex #-}
{-# INLINE inRange #-}
{-# INLINE rangeSize #-}
{-# INLINE unsafeRangeSize #-}
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
range (l,r) = map toEnum $ range (fromEnum l, fromEnum r)
index (l,r) i = index (fromEnum l, fromEnum r) (fromEnum i)
unsafeIndex (l,r) i = unsafeIndex (fromEnum l, fromEnum r) (fromEnum i)
inRange (l,r) i = inRange (fromEnum l, fromEnum r) (fromEnum i)
rangeSize (l,r) = rangeSize (fromEnum l, fromEnum r)
unsafeRangeSize (l,r) = unsafeRangeSize (fromEnum l, fromEnum r)