[Haskell-cafe] Re: Matrices in Haskell

apfelmus apfelmus at quantentunnel.de
Tue Mar 20 11:08:02 EDT 2007

Ivan Miljenovic wrote:
> (a primitive Sudoku solver, to be precise)

Concerning Sudoku, there is a beautiful talk from R. Bird


> The other problem with using a list of lists is that the only reason I'm sure
> that the matrix is valid (i.e. all the rows are the same length, etc.)
> is because I created it that way, not because the data structure
> requires it. 

You can use nested data types in order to ensure squareness, see also

   C. Okasaki.
   From Fast Exponentiation to Square Matrices: An Adventure in Types


More information about the Haskell-Cafe mailing list