newBoard = [if loc == numOfTile then Just player else piece | (loc, piece) <- zip [0..] board ]
Note this is not safe! What if there's already a piece there?
newBoard = [squareFor loc piece | (loc, piece) <- zip [0..] board ]
where squareFor loc piece
| loc == numOfTile && isNothing piece = Just player
| loc /= numOfTile = piece
| otherwise = error -- or Nothing
Or recurse through until numOfTile hits zero, then check
updateBoard 0 p (Nothing:rest) = (Just p:rest)
updateBoard 0 p _ = error "AAAAAAH"
updateBoard n p (h:rest) = h:(updateBoard (n-1) p rest)
https://github.com/TU-CSCI2322-FL22/solver-connect-three/blob/3b398642bada87d610c043c993389cc52d8ec5ec/Main.hs#L79
Note this is not safe! What if there's already a piece there?
Or recurse through until numOfTile hits zero, then check