haskell - Flexibility of the hierarchy of module sources allowed in cabal project -
i have project source tree:
src/ src/a/ src/a/a.hs src/b/ src/b/c/ src/b/c/c.hs ...
the 2 haskell files divide source code modules:
-- file a/a.hs module ...
and
-- file b/c/c.hs module b.c ...
the cabal file contains:
other-modules: a, b.c, ... hs-source-dirs: src/, src/a/, src/b/, src/b/c/, ...
but while module a
can found, cabal complains b.c
:
cabal: can't find source b/c in ...
i see no rational explanation why placing file defining module a
under a/a.hs
ok placing b.c
under b/c/c.hs
isn't. there workaround other placing c.hs
directly under b
(i maintain separation of sources)?
the reason error module b.c should defined in file b/c.hs
, not b/c/c.hs
(that module b.c.c
). error have appeared if had 1 source dir 1 source file, not because of parts have put in.
also, dir appears in hs-source-dirs
directive should root of dir tree, doubtful need of parts put in, instance, src/b/c
(which treat src/b/c
root.... meaning can define top level modules in dir. if doing that, consider mistake).
what want define multiple top level source dirs, this
a_src/a.hs b_src/b/c.hs hs-source-dirs: a_src, b_src
even better, suggest use stack, allows separate different modules own source dirs, called src
, , independent .cabal files, allowing richer dependencies between each module.
Comments
Post a Comment