-- | A game result is one of---- * Player 1 wins---- * Player 2 wins---- * Neither player wins (draw)moduleData.TicTacToe.GameResult(GameResult-- * Reduction (fold),gameResult,playerGameResult-- * Construction,win,player1Wins,player2Wins,draw-- * Decisions,isPlayer1Wins,isPlayer2Wins,isDraw)whereimportData.TicTacToe.Player-- | A game result.dataGameResult=WinPlayer|Drawderiving(Eq,Show)-- | Fold a game result.gameResult::(Player->x)-- ^ If either of the players won.->x-- ^ If the game was a draw.->GameResult-- ^ The game result to fold.->xgameResultwin_(Winp)=winpgameResult_drawDraw=draw-- | Fold a game result.playerGameResult::x-- ^ If player 1 won.->x-- ^ If player 2 won.->x-- ^ If the game was a draw.->GameResult-- ^ The game result to fold.->xplayerGameResultp1p2=gameResult(playerp1p2)-- | Construct a game result with a win for the given player.win::Player-- ^ The player to win.->GameResultwin=Win-- | Construct a game result with a win for player 1.player1Wins::GameResultplayer1Wins=Winplayer1-- | Construct a game result with a win for player 2.player2Wins::GameResultplayer2Wins=Winplayer2-- | Construct a game result that is a draw.draw::GameResultdraw=Draw-- | Returns whether or not player 1 won for the game result.isPlayer1Wins::GameResult->BoolisPlayer1Wins=playerGameResultTrueFalseFalse-- | Returns whether or not player 2 won for the game result.isPlayer2Wins::GameResult->BoolisPlayer2Wins=playerGameResultFalseTrueFalse-- | Returns whether the game result is a draw.isDraw::GameResult->BoolisDraw=playerGameResultFalseFalseTrue