Skip to content

Allow for less eager module discovery

Motivation

Currently cabal is unable to support multiple dependent components sharing a single source directory. This is because GHC is too eager in discovering local modules and will not treat them as part of a separate library.

It would be very nice to have multiple components share a single source directory, as it allows for splitting out a chunk of a library without making a mess of the directory structure.

E.g.

client
  Foo
    Web
      Bar
        Baz
          Handler.hs
common
  Foo
    Web
      Bar
        Baz
          View.hs
          Types.hs
server
  Foo
    Web
      Bar
        Baz
          Database.hs
          Load.hs

vs:

src
  Foo
    Web
      Bar
        Baz
          Handler.hs
          View.hs
          Types.hs
          Database.hs
          Load.hs

Proposal

I do not know enough about the internal details of GHC to know the exact desired changes. But essentially whatever is necessary to allow for components that depend on each other to share a src directory without problems.

See: https://github.com/haskell/cabal/issues/5335

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information