title: How do I install and test a Haskell package that I'm developing locally?
body: <p>I'm developing a Haskell package and would like to test it as if it were an installed package. That is, I'd like to be able to install it among my other packages and then either <code>import</code> or <code>:m +</code>.</p>
  
  <p>I can successfully build my package and (apparently) can successfully install it using</p>
  
  <pre><code>cabal install
  </code></pre>
  
  <p>which reports</p>
  
  <pre><code>Resolving dependencies...
  Configuring Exos-0.0.1.0...
  Building Exos-0.0.1.0...
  Installed Exos-0.0.1.0
  </code></pre>
  
  <p>but all attempts to import the package then fail with something like (e.g. in GHCi)</p>
  
  <pre><code>&lt;no location info&gt;:
      Could not find module ‘Exos’
      It is not a module in the current program, or in any known package.
  </code></pre>
  
  <p>even though I can see a populated <code>Exos-0.0.1.0</code> folder in my Haskell <code>lib</code> directory. (Even "uninstalling" fails with <code>ghc-pkg unregister</code>, which reports <code>ghc-pkg: cannot find package Exos-0.0.1.0</code>.) </p>
  
  <p>How do I install and test a package that I'm developing locally, so that it behaves like part of my collection of installed Haskell packages — specifically so that I can import it (and "uninstall" it) like any other?</p>
  
  <hr>
  
  <p>My package has the structure </p>
  
  <pre><code>Exos.cabal
  Exos/
      Cryo/
          Exos.hs
          Exos/
              Display.hs
              Core.hs
  </code></pre>
  
  <p>with (relevant) contents in <code>Exos.cabal</code></p>
  
  <pre><code>name:                   Exos
  version:                0.0.1.0
  build-type:             Simple
  - ...
  
  library
      exposed-modules:    Cryo.Exos,
                          Cryo.Exos.Display
      other-modules:      Cryo.Exos.Core
      -- other-extensions:
      build-depends:      base &gt;=4.8,
                          containers &gt;= 0.5.5.1,
                          split &gt;= 0.2.2,
                          MissingH &gt;= 1.3.0.1
      -- hs-source-dirs:
      default-language:   Haskell2010
  </code></pre>
  
  <p>in <code>Exos.hs</code></p>
  
  <pre><code>module Cryo.Exos
      (
          f,
          g,
          otherFunc
      ) where
  
  import Cryo.Exos.Core
  -- ...
  </code></pre>
  
  <p>in <code>Core.hs</code></p>
  
  <pre><code>module Cryo.Exos.Core where
  -- ...
  </code></pre>
  
  <p>and in <code>Display.hs</code></p>
  
  <pre><code>module Cryo.Exos.Display
      (
          showSomething,
          showSomethingElse
      ) where
  
  import Data.Char
  -- ...
  
  import Cryo.Exos.Core
  import Cryo.Exos
  </code></pre>
  
  <hr>
  
  <p>FWIW, inside my IDE, I can write an and successfully run "Application" with the following section in the above <code>.cabal</code> file</p>
  
  <pre><code>executable enigma-hs
      main-is:            Main.hs
      build-depends:      base &gt;=4.8,
                          Exos
      hs-source-dirs:     tests
      default-language:   Haskell2010
  </code></pre>
  
  <p>and the following (relevant) code in <code>Exos/tests/Main.hs</code></p>
  
  <pre><code>module Main where
  
  import System.IO
  
  import Cryo.Exos
  import Cryo.Exos.Display
  
  main :: IO ()
  main = do
      putStr $ showSomething
      putStr $ showSomethingElse
      -- ...
  </code></pre>