<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19088"></HEAD>
<BODY>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>I want to learn more
about Haskell and I started with my Sudoku solver</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>class SudokuClass
s where<BR> initAreas :: s -> s<BR>
createEmptySudoku :: s<BR> getBoardLength :: s ->
Int<BR> setBoard :: s -> Board -> s</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>
getCellToAreas :: s ->CellToAreas<BR> ... other functions with
default implementations</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>I created a Sudoku
solver for 9x9 sudoku's.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>data Sudoku9x9 =
Sudoku9x9 {<BR> board :: Board,<BR> areas::
Areas,<BR> cellToAreas :: CellToAreas<BR>} deriving
(Show)</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>Board, Areas and
CellToAreas are of type Map.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>After that I create
an instance:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>instance SudokuClass
Sudoku9x9 where<BR> initAreas s = .....</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>After implementing
the 9x9 solver I wanted to create a second instance SudokuTwins,
that solves a different kind of sudoku, but uses the same
record:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>data SudokuTwins =
SudokuTwins {<BR> board :: Board,<BR> areas::
Areas,<BR> cellToAreas :: CellToAreas<BR>} deriving
(Show)</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>This is almost a
copy of Soduku9x9 (right side of the =)</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011>How can I express
the fact that all sudoku solvers use the same recordtype? Can I make a type
of the record structure {board:: Board.... } and use it in the constructor
function or can I incorperate the recordtype in the class or
......?</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=546453810-17062011></SPAN></FONT><FONT
size=2 face=Arial><SPAN class=546453810-17062011></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=546453810-17062011>Kees</SPAN></FONT></DIV></DIV></SPAN></FONT></BODY></HTML>