Skip to content

Instantly share code, notes, and snippets.

@Electron-libre
Created September 7, 2017 19: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 Electron-libre/4cda8be04f20b5a76a5cb2d2a7910cde to your computer and use it in GitHub Desktop.
Save Electron-libre/4cda8be04f20b5a76a5cb2d2a7910cde to your computer and use it in GitHub Desktop.
module Analysis.GobanState exposing (GobanState, Intersection(..), Stone(..), blank, addStone)
import Matrix exposing (Matrix, repeat, set)
type alias GobanState = Matrix Intersection
type Intersection = Free | Stone
type Stone = Black | White
blank : Int -> GobanState
blank size =
repeat size size Free
-- addStone : Int -> Int -> Stone -> GobanState -> GobanState Intersection
addStone i j stone goban =
set i j stone goban
-- When
addStone 0 0 Black (blank 3)
-- Type system fails at:
Function `addStone` is expecting the 4th argument to be:
Matrix.Matrix Stone
But it is:
GobanState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment