Talk:Learning Haskell with Chess
list handling vs. abstract data types (array)
Lists are very inefficient, but understanding list handling is important for understanding functional programming. On the other hand, using
Array would provide understanding for abstract data types.
using state monad for the board
Only possible with advanced students, do not try this in introductory courses.
full ruleset vs. reduced and simplified ruleset
To implement the full ruleset you have to remember and consider previous states (in particular for castling rule and capturing en passant).
-- Actually, this isn't so bad to do. It's entirely possibly by simply checking and updating flags. A single Int with a few bit masks could easily do it. One thing to consider as far as what needs to be encoded in any given position to be able to determine all legal moves is the FEN specification for representing moves: [] -- Andrew Wagner.
representation of positions
type Pos = (Int,Int) ok? Or better something like
type Pos = (Row, Column), data Row = A | B | ... | H, data Column = ?. How to model the constraints (0<=x,y<=7)?
-- There are several ways to handle this. Much work has been done in figuring out what the best way is, but I'll just point you to the first two articles at [] I should point out that the theory behind using bitboards has advanced significantly since those articles were written, and I would strongly recommend looking at that. -- Andrew Wagner
-- Andrew, thank you for this link. The facts there strongly apply to imperative programming, however, I cannot see how to transfer these practices to functional programming without getting the fingers too dirty. -- Steffen Mazanek
more general game library
Should students be confronted with a more general gametree generation (successor states-function as param) and minimax algorithm (eval-function as param)?