Data.Ix.unindex
Motivation
The Data.Ix.Ix class has an index
method, for translating array coördinates into single-dimensional indices.
https://hackage.haskell.org/package/base-4.13.0.0/docs/Data-Ix.html#v:index
-- | 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.)
Proposal
Add this typeclass method.
-- | The subscript of a position in the subrange. The inverse operation of 'index'.
unindex :: (a, a) -> Int -> a
Further
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.