--- This module defines the ;Symbol; type and some helper functions. module Logic.Symbol; import Stdlib.Prelude open; --- A symbol represents a token that can be placed in a square type Symbol := | --- The circle token O | --- The cross token X; instance eqSymbolI : Eq Symbol := mkEq@{ eq (sym1 sym2 : Symbol) : Bool := case sym1, sym2 of | O, O := true | X, X := true | _, _ := false; }; --- Turns ;O; into ;X; and ;X; into ;O; switch (sym : Symbol) : Symbol := case sym of | O := X | X := O; --- Textual representation of a ;Symbol; showSymbol (sym : Symbol) : String := case sym of | O := "O" | X := "X";