How do I install the 'Data.List.Split' module for Haskell?

倾然丶 夕夏残阳落幕 提交于 2021-01-06 04:27:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!