Skip to content

Instantly share code, notes, and snippets.

@vstrimaitis
Created September 17, 2017 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vstrimaitis/9be6c95770c6c42f858f86944c9176c4 to your computer and use it in GitHub Desktop.
Save vstrimaitis/9be6c95770c6c42f858f86944c9176c4 to your computer and use it in GitHub Desktop.
show instance
instance Show ValidationError where
show (SquareTaken x) = "Move #" ++ show (x + 1) ++ " is invalid - the square is already taken!"
show (WrongPiece x expected actual) = "Wrong piece on move #" ++
show (x + 1) ++
". Expected '" ++ show expected ++ "', got '" ++ show actual ++ "'."
show (WrongName x expected actual) = "Wrong player name on move #" ++
show (x + 1) ++ ". Expected '" ++ expected ++ "', got '" ++ actual ++ "'."
show WrongFirstMove = "X must make the first move."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment