title: In a cabal package why should I have almost identical `other-modules` fields
body: <p>In my cabal I have a <code>library</code> and a few <code>executable</code> fields. I can sort of understand why cabal wants to know about all the various files in the <code>.cabal</code> manifest, even the ones that are not <code>exposed-modules</code>. My executables only use modules in the <code>exposed-modules</code> of my library. Why then does cabal complain about missing <code>other-modules</code>?</p>
  
  <pre><code>version:             0.0.0.1
  name:                my-pkg
  synopsis:            A package
  description:         Please see README.md
  homepage:            https://homepage.com
  license:             BSD3
  license-file:        LICENSE
  author:              Me
  maintainer:          example@example.com
  copyright:           MIT
  category:            
  build-type:          Simple
  cabal-version:       &gt;=1.10
  
  library
    hs-source-dirs:      src
    default-language:    Haskell2010
    ghc-options:         -Wall -g -Wno-simplifiable-class-constraints -O2
    exposed-modules:     MyLib.Exposed.ImportedByExec
    other-modules:       MyLib.NotExposed.ExecShouldntCare
  
  executable tool
    hs-source-dirs:      tools/Tool
    default-language:    Haskell2010
    ghc-options:         -Wall -g -Wsimplifiable-class-constraints
    main-is:             Main.hs
    build-depends:       base &gt;= 4.7 &amp;&amp; &lt; 5
                       , my-pkg &gt;= 0.1.0.1
    other-modules:     &lt;why should anything be here to avoid a warning??&gt;
  </code></pre>
  
  <p>EDIT: Maybe the question is equivalent to "why does my-pkg not show up in <code>stack exec -- ghc-pkg list</code> after I <code>stack build</code> or even <code>stack install</code>?"</p>