Type-safe rectangular multidimensional array type
问题 How do you represent a rectangular 2-dimensional (or multidimensional) array data structure in Scala? That is, each row has the same length, verified at compile time , but the dimensions are determined at runtime? Seq[Seq[A]] has the desired interface, but it permits the user to provide a "ragged" array, which can result in a run-time failure. Seq[(A, A, A, A, A, A)] (and similar) does verify that the lengths are the same, but it also forces this length to be specified at compile time.