I am trying to build a static Array in Haskell with a custom Enum Index type and have implemented the required functions like this:
data Ind = One | Two | Three | Four deriving (Eq,Ord,Enum,Show)
instance Ix Ind where
range (m,n) = [m..n]
inRange (m,n) i = m <= i && i <= n
index b i | inRange b i = fromEnum i
| otherwise = -1
rangeSize (m,n) = (index (m,n) n ) + 1
With this I am now trying to build a matrix type:
type Row a = Array Ind a
type Matrix a = Array Ind Row a
However, I am getting this error on the Matrix type:
Illegal type "Array Ind Row a" in constructor application
Could anybody explain to me what this error means and what I am doing wrong?
type Matrix a = Array Ind (Row a)?... deriving (Eq,Ord,Enum,Show, Ix ).