The Data.Ix.Ix class has an
index method, for translating array coördinates into single-dimensional indices.
-- | The position of a subscript in the subrange. index :: (a, a) -> a -> Int
The inverse operation is also useful, but is missing. (I just went to Data.Ix looking for the inverse operation and was surprised to find it wasn't there.)
Add this typeclass method.
-- | The subscript of a position in the subrange. The inverse operation of 'index'. unindex :: (a, a) -> Int -> a
While we're at it, the documentation for Data.Ix should also explain clearly that this module can be used for multidimensional arrays, with examples. Unless a reader examines the class instances carefully, they will likely not notice that.