I tried some kind of Haskell because I was intrigued by strong typing and am confused about the best way to handle this:
The vector data type defined in Data.Vector allows the use of multidimensional arrays using nested arrays. However, they are made up of lists, and lists with different lengths are considered the same data type (unlike tuples of different lengths).
How can I extend this data type (or write a similar one) that functions the same, except that vectors of different lengths are considered different data types, so any attempt to create a multidimensional array / matrix with rows of different lengths (for example) will lead to a compile-time error ?
It seems that tuples control this by writing out 63 different definitions (one for each permissible length), but I would like to be able to process vectors of arbitrary length, if possible.
source
share