The SquareRank data type and related functions and definitions.
Tries to convert a Char to a SquareRank. Returns Nothing if the
character is not a digit in the range 1-8.
fromChar '5' == Just five
List.map fromChar [ '1', 'x', '8' ] == [ Just one, Nothing, Just eight ]Tries to convert a String to a SquareRank by looking at the first
character of the string. Returns Nothing if the first character is not a
digit in the range 1-8.
fromChar '5' == Just five
List.map fromChar [ '1', 'x', '8' ] == [ Just one, Nothing, Just eight ]Converts a SquareRank to a Char in the range 1-8.
toChar three == '3'
List.map toChar all == [ '1', '2', '3', '4', '5', '6', '7', '8' ]Converts a SquareRank to a single-character String consisting of a
letter in the range 1-8.
toString three == "3"
List.map toString all == [ "1", "2", "3", "4", "5", "6", "7", "8" ]List of all ranks on the board.
The first rank, seen from white's point of view.
The second rank, seen from white's point of view.
The third rank, seen from white's point of view.
The fourth rank, seen from white's point of view.
The fifth rank, seen from white's point of view.
The sixth rank, seen from white's point of view.
The seventh rank, seen from white's point of view.
The eighth rank, seen from white's point of view.
The vertical distance between two ranks.
distance one eight == 7
distance five three == 2Convert a rank to an index in the range 0 (for the first rank) to 7 (for the last rank).
A
SquareRankis a type representing a rank on a chess board, i.e. one of the horizontal rows labeled 1-8.