I would like to define a Torus class representing 2D arrays that wrap around at borders. For example, accessing the array with an index beyond the size of the corresponding dimension should return the element at position i mod arraysize. My class should thus only need to define a get method as such:
class Torus a where
get :: a -> Int -> Int -> b
This definition is imprecise. a is supposed to be a 2D array and b should be the type contained in the array. How can I express this?
Thanks,
I suppose you were only looking for the types in the class:
Or did you look for an appropriate instance?