title: Installed parsec in sandbox, but can't find libraries when trying to load file in ghci
body: <p><strong>tl;dr:</strong> installed library with cabal sandbox, ghci still complains that the library is missing  </p>
  
  <p>I have a directory where I am developing some Haskell stuff. This used to work fine on another computer, with ghc 7.6, but now that I'm working on another computer with ghc 7.8.2 (I don't know if the version would matter) I get errors like this:</p>
  
  <blockquote>
    <p>Prelude> :l Interpreter.hs</p>
    
    <p>Parser.hs:9:8:
        Could not find module ‘Text.ParserCombinators.Parsec’
        Perhaps you meant
          Text.ParserCombinators.ReadPrec (from base)
          Text.ParserCombinators.ReadP (from base)
        Use -v to see a list of the files searched for.</p>
  </blockquote>
  
  <p>when trying to load files from ghci. These files are located in BASE/src/Lib, where BASE is the directory with LIB.cabal and all that. So I figured there was something up with cabal. Wanting to avoid the dreaded 'cabal hell', I made a sandbox in the project (<code>cabal sandbox init</code>), which I hadn't used before. I then manually removed the other cabal related stuff and did <code>cabal init</code>. I did <code>cabal install --dependencies-only</code>, but that didn't actually install anything (I'm guessing because of --dependencies-only? I was too paranoid of global installs to use regular cabal install). So I tried to add things manually to my <code>.cabal</code> file (is that how you should do this?), namely:</p>
  
  <blockquote>
    <p>build-depends:       </p>
    
    <p>base >=4.7 &amp;&amp; &lt;4.8, </p>
  
  <pre><code>containers &gt;=0.5 &amp;&amp; &lt;0.6,
  
  -- 
  
  parsec == 3.1.* -- THIS is the line I added
  </code></pre>
  </blockquote>
  
  <p>Now I did <code>cabal install --dependencies-only</code>. Lo and behold, things were actually installed, specifically:</p>
  
  <blockquote>
    <p>[21 of 25] Compiling Text.Parsec      ( Text/Parsec.hs, dist/dist-sandbox-a2fe5095/build
    /Text/Parsec.o )</p>
    
    <p>...</p>
    
    <p>In-place registering parsec-3.1.5...
    Installing library in /home/PATHTODIR/Stack
    Lang/.cabal-sandbox/lib/x86_64-linux-ghc-7.8.2/parsec-3.1.5
    Registering parsec-3.1.5...
    Installed parsec-3.1.5</p>
  </blockquote>
  
  <p>So I tried to load the same file in ghci, yielding the same error. Note that the problem was Text.ParserCombinators.Parsec, which seemed to be installed just fine according to when I ran <code>cabal install --dependencies-only</code>. Here is the output that I get with <code>ghc -v Interpreter.hs</code>:</p>
  
  <blockquote>
    <p>Glasgow Haskell Compiler, Version 7.8.2, stage 2 booted by GHC version 7.4.1</p>
    
    <p>Using binary package database: /opt/ghc/7.8.2/lib/ghc-7.8.2/package.conf.d/package.cache</p>
    
    <p>wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8</p>
    
    <p>wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-dc47f6b546fc171f67a7f7d311684a99</p>
    
    <p>wired-in package base mapped to base-4.7.0.0-018311399e3b6350d5be3a16b144df9b</p>
    
    <p>wired-in package rts mapped to builtin_rts</p>
    
    <p>wired-in package template-haskell mapped to template-haskell-2.9.0.0-</p>
    
    <p>dcc8c210fb02937e104bc1784d7b0f06</p>
    
    <p>wired-in package dph-seq not found.</p>
    
    <p>wired-in package dph-par not found.</p>
    
    <p>Hsc static flags: </p>
    
    <p>wired-in package ghc-prim mapped to ghc-prim-0.3.1.0-948744e1f99cc8bcc7c7d3ba60c7c2d8</p>
    
    <p>wired-in package integer-gmp mapped to integer-gmp-0.5.1.0-</p>
    
    <p>dc47f6b546fc171f67a7f7d311684a99</p>
    
    <p>wired-in package base mapped to base-4.7.0.0-018311399e3b6350d5be3a16b144df9b</p>
    
    <p>wired-in package rts mapped to builtin_rts</p>
    
    <p>wired-in package template-haskell mapped to template-haskell-2.9.0.0-</p>
    
    <p>dcc8c210fb02937e104bc1784d7b0f06</p>
    
    <p>wired-in package dph-seq not found.</p>
    
    <p>wired-in package dph-par not found.</p>
    
    <p><em>*</em> Chasing dependencies:</p>
    
    <p>Chasing modules from: *Interpreter.hs</p>
    
    <p>Parser.hs:9:8:
        Could not find module ‘Text.ParserCombinators.Parsec’
        Perhaps you meant
          Text.ParserCombinators.ReadPrec (from base)
          Text.ParserCombinators.ReadP (from base)
        Locations searched:
          Text/ParserCombinators/Parsec.hs
          Text/ParserCombinators/Parsec.lhs</p>
    
    <p>Parser.hs:10:18:
        Could not find module ‘Text.Parsec.Token’
        Locations searched:
          Text/Parsec/Token.hs
          Text/Parsec/Token.lhs</p>
    
    <p>Interpreter.hs:11:8:
        Could not find module ‘Control.Monad.Error’
        Perhaps you meant
          Control.Monad.Fix (from base)
          Control.Monad.ST (from base)
          Control.Monad.Zip (from base)
        Locations searched:
          Control/Monad/Error.hs
          Control/Monad/Error.lhs</p>
    
    <p>Interpreter.hs:15:8:
        Could not find module ‘Text.ParserCombinators.Parsec.Error’
        Locations searched:
          Text/ParserCombinators/Parsec/Error.hs
          Text/ParserCombinators/Parsec/Error.lhs
    <strong>* Deleting temp files:
    Deleting: 
    *</strong> Deleting temp dirs:
    Deleting: </p>
  </blockquote>