问题
I have been trying to import the 'Data.List.Split' module since yesterday. I looked around stack overflow for similar questions, but I couldn't find a definitive solution to my slightly basic problem.
This is what I wrote in the text editor (excluding comments).
import Data.List
import Data.Char
import System.IO
data Cell = Fixed Int | Possible [Int] deriving (Show, Eq)
type Grid = [Row]
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
This is what I wrote in the command line.
cabal update
cabal install --lib split
cd 'C:\Users\Username\Haskell Sudoku Solver'
ghci
:l Sudoku-Solver
And this is the error message that appears
Sudoku-Solver.hs:53:53: error:
Not in scope: `Data.List.Split.chunksOf'
No module named `Data.List.Split' is imported.
|
53 | | length s == 81 = traverse (traverse readCell) . Data.List.Split.chunksOf 9 $ s
| ^^^^^^^^^^^^^^^^^^^^^^
I presumed 'cabal install --lib split' would have solved the problem but the error still appears nonetheless. Sorry for the very beginner level question.
来源:https://stackoverflow.com/questions/62357916/how-do-i-install-the-data-list-split-module-for-haskell