Validates the number of fields, the board layout (exactly 8 ranks, 8 files each), and each piece character. The half-move clock and full-move number default to 0 and 1 respectively when absent (short FEN).
Value parameters
fen
a FEN string with at least 4 space-separated fields
Attributes
Returns
Right(state) on success, or Left(errorMessage) describing the first parse failure
Produces all six FEN fields. Piece placement is written rank-8-first (as required by the standard). This method is the inverse of parse: parse(serialize(s)) always yields Right(s) for a valid state.