Nested datatype for square matrices
I am trying to understand how this datatype (Square) represents square matrices. type Square = Square' Nil data Square' t a = Zero (t (t a) ) | Succ (Square' (Cons t) a) data Nil a = Nil data Cons t a = Cons a (t a) So. What is t here? I suppose it is one of the types declared above. I decided to start with the simplest, so Zero (Nil (Nil Int)) If I put integer 4 as a value, is this a matrix (4) ? Suppose it is something. Now, what is this: Succ ( Zero (Cons t) a) if I am right about t , then this, perhaps, must represent some 2×2 matrix, but what are its values? Succ (Zero (Cons Nil) a) I