title: How do I add the "containers" package to my .cabal file (without getting overwritten by stack at compile time)?
body: <p>I am working on the &quot;roman-numerals&quot; task from the exercism Haskell track and followed their <a href="http://exercism.io/languages/haskell/installing" rel="noreferrer">instructions to installing stack</a>. I am working on a Fedora 24 box.</p>
  <p>As long as I was working with Haskell modules from base, I didn't have a problem. Now I am trying to import the Data.Map module. It works fine using the ghci command line:</p>
  <pre><code>$ ghci
  GHCi, version 7.8.4: http://www.haskell.org/ghc/  :? for help
  Loading package ghc-prim ... linking ... done.
  Loading package integer-gmp ... linking ... done.
  Loading package base ... linking ... done.
  Prelude&gt; import Data.Map
  Prelude Data.Map&gt; 
  </code></pre>
  <p>However, when I try to import it from inside my src file with the command:</p>
  <pre><code>import qualified Data.Map as M (foldlWithKey, fromList)
  </code></pre>
  <p>I am running into problems when I try to run the test:</p>
  <pre><code>$ stack test
  roman-numerals-0.0.0: build (lib + test)
  Preprocessing library roman-numerals-0.0.0...
  [2 of 2] Compiling Roman            (...)
  (...) /roman-numerals/src/Roman.hs:3:1: error:
      Failed to load interface for ‘Data.Map’
      It is a member of the hidden package ‘containers-0.5.7.1’.
      Perhaps you need to add ‘containers’ to the build-depends in your .cabal file.
      Use -v to see a list of the files searched for.
  Progress: 1/2
  (...)
  </code></pre>
  <p>I googled the problem and found a straightforward solution at <a href="https://www.haskell.org/cabal/FAQ.html#hidden-packages-a" rel="noreferrer">the Cabal FAQ at haskell.org</a>:</p>
  <blockquote>
  <p>What you need to do is to add containers to the build-depends in your .cabal file.</p>
  </blockquote>
  <p>I am assuming they mean the file roman-numerals.cabal that is in my working directory. The contents are:</p>
  <pre><code>-- This file has been generated from package.yaml by hpack version 0.14.0.
  --
  -- see: https://github.com/sol/hpack
  
  name:           roman-numerals
  version:        0.0.0
  build-type:     Simple
  cabal-version:  &gt;= 1.10
  
  library
    hs-source-dirs:
        src
    build-depends:
        base
    exposed-modules:
        Roman
    other-modules:
        Paths_roman_numerals
    default-language: Haskell2010
  
  test-suite test
    type: exitcode-stdio-1.0
    main-is: Tests.hs
    hs-source-dirs:
        test
    build-depends:
        base
      , roman-numerals
      , hspec
    default-language: Haskell2010
  </code></pre>
  <p>I tried to add &quot;containers&quot; to the build-depends in either and both the &quot;library&quot; and &quot;test-suite&quot; sections, but when I run</p>
  <pre><code>$ stack test
  </code></pre>
  <p>the error persists, and the .cabal file is reverted to the same contents shown above.</p>
  <p>Any pointers? Much appreciated!</p>