Created
January 22, 2019 17:36
-
-
Save abhin4v/af131df51e3416b0be062a8cba60dcca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
readGrid :: String -> Maybe Grid | |
readGrid s | |
| length s == 81 = traverse (traverse readCell) . Data.List.Split.chunksOf 9 $ s | |
| otherwise = Nothing | |
where | |
readCell '.' = Just $ Possible [1..9] | |
readCell c | |
| Data.Char.isDigit c && c > '0' = Just . Fixed . Data.Char.digitToInt $ c | |
| otherwise = Nothing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment