No need for the extra mirror' function.
Added undefined for the index functions.
Removed the argument g from arr. This is fine seeing as g is completely specifies the arr anyway.
It is the arr that specifies the g and not the other way round.
Introduced a type class to allow constructing and destructing grids of different types.