[Haskell-beginners] share a record type

David Place d at vidplace.com
Fri Jun 17 14:11:58 CEST 2011

On Jun 17, 2011, at 7:00 AM, Kees Bleijenberg wrote:

> 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 ......?

This is a good use for the "newtype" declaration.  Define your SudokuRecord and then specialize it using newtype.

data SudokoRecord ...

newtype SudokuTwins = SudokuTwins SudokuRecord
newtype Sudoku9x9 = Sudoku9x9 SudokuRecord

instance SudokuClass SudokuTwins where

instance SudokuClass Sudoku9x9 where

David Place   
Owner, Panpipes Ho! LLC
d at vidplace.com

More information about the Beginners mailing list