Installed parsec in sandbox but cannot find libraries when trying to upload file to ghci

tl; dr: installed library with cabal sandbox, ghci still complains that the library is missing

I have a directory in which I am developing Haskell material. This works well on another computer with ghc 7.6, but now when I work on another computer with ghc 7.8.2 (I don’t know if the version will matter), I get errors like this:

Prelude>: l Interpreter.hs

Parser.hs: 9: 8: Could not find the module 'Text.ParserCombinators.Parsec Perhaps you meant Text.ParserCombinators.ReadPrec (from the database) Text.ParserCombinators.ReadP (from the database) Use -v to view the list of search results files.

when trying to download files from ghci. These files are located in BASE / src / Lib, where BASE is the directory with LIB.cabal and all that. So I thought there was something with bondage. Wanting to avoid the terrible "hellish hellish", I made a sandbox ( cabal sandbox init) in the project that I had not used before. Then I manually deleted the other material related to the bondage and did cabal init. I did cabal install --dependencies-only, but didn’t actually install anything (am I guessing because of -dependencies-only? I was too paranoid of global installations to use the usual cabal installation). So, I tried to add things manually to my file .cabal(this is how you should do this?), Namely:

build-depends:

base> = 4.7 && <4.8,

containers >=0.5 && <0.6,

-- 

parsec == 3.1.* -- THIS is the line I added

Now i have done cabal install --dependencies-only. And now, in fact, everything was established, in particular:

[21 25] Text.Parsec(Text/Parsec.hs, dist/dist-sandbox-a2fe5095/build /Text/Parsec.o)

...

parsec-3.1.5... /home/PATHTODIR/Stack Lang/.cabal-/Library/x86_64-Linux-GHC-7.8.2/-3.1.5 parsec-3.1.5... parsec-3.1.5

, ghci, . , Text.ParserCombinators.Parsec, , , , cabal install --dependencies-only. , ghc -v Interpreter.hs:

Glasgow Haskell, 7.8.2, 2, GHC 7.4.1

:/opt/ghc/7.8.2/lib/ghc-7.8.2/package.conf.d/package.cache

ghc-prim, ghc-prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8

integer-gmp, integer-gmp-0.5.1.0-dc47f6b546fc171f67a7f7d311684a99

, 4.7.0.0-018311399e3b6350d5be3a16b144df9b

rts, builtin_rts

-haskell, -haskell-2.9.0.0 -

dcc8c210fb02937e104bc1784d7b0f06

dph-seq .

dph-par .

Hsc:

ghc-prim, ghc-prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8

integer-gmp, integer-gmp-0.5.1.0 -

dc47f6b546fc171f67a7f7d311684a99

, 4.7.0.0-018311399e3b6350d5be3a16b144df9b

rts, builtin_rts

-haskell, -haskell-2.9.0.0 -

dcc8c210fb02937e104bc1784d7b0f06

dph-seq .

dph-par .

* :

: * Interpreter.hs

Parser.hs: 9: 8:      'Text.ParserCombinators.Parsec     ,       Text.ParserCombinators.ReadPrec( )       Text.ParserCombinators.ReadP( )      :        /ParserCombinators/Parsec.hs        /ParserCombinators/Parsec.lhs

Parser.hs: 10: 18:      Text.Parsec.Token      :       //Token.hs       //Token.lhs

Interpreter.hs: 11: 8:      'Control.Monad.Error     ,       Control.Monad.Fix( )       Control.Monad.ST( )       Control.Monad.Zip( )      :       //Error.hs       //Error.lhs

Interpreter.hs: 15: 8:      'Text.ParserCombinators.Parsec.Error      :       /ParserCombinators//Error.hs       /ParserCombinators//Error.lhs * : : * : :

+4
1

ghc/ghci . .

cabal repl ghci, cabal sandbox. ( 1.18) .

+11

Source: https://habr.com/ru/post/1536867/


All Articles