[Haskell-cafe] Cabal: other-modules necessary?
Volker Wysk
post at volker-wysk.de
Fri Sep 16 10:52:15 UTC 2022
Am Freitag, dem 16.09.2022 um 18:42 +0900 schrieb 石井大海:
> FWIW, You could use hpack (package.yaml) to automatically fill exposed-
> module:
>
> https://github.com/sol/hpack
>
> In short, hpack is a YAML-encoded cabal format with some syntax sugars and
> automatic module list generation.
> Downside is that if you're using cabal-install as the package manager, you
> should convert hpack to cabal each time you edit package.yaml or add new
> modules (you could set up editor save hook and/or git pre-commit hook to
> reduce such burden, though).
I've taken a look at this. It's somewhat complicated, even though it claims
it doesn't "require the user to state the obvious, make sensible assumptions
by default". There's no user manual. And the examples are quite verbose
(again, even though it claims to be simple).
I'll stick to cabal for now. At least until I know it better.
Thanks for the hint.
Volker
> If you're using stack, however, stack will automatically generate .cabal
> from package.yaml whenever it's needed, as hpack is integrated into stack.
>
> 2022年9月16日(金) 18:34 Volker Wysk <post at volker-wysk.de>:
> > Am Freitag, dem 16.09.2022 um 10:23 +0100 schrieb Tom Ellis:
> > > On Fri, Sep 16, 2022 at 10:47:47AM +0200, Volker Wysk wrote:
> > > > The cabal user guide says (in section 6.2.12): "Every module in the
> > > > package
> > > > must be listed in one of other-modules, library:exposed-modules or
> > > > executable:main-is fields."
> > > >
> > > > However, I only get a warning message, when I comment out the other-
> > > > modules
> > > > field in my .cabal file. The program compiles. This is the message:
> > > >
> > > > <no location info>: warning: [-Wmissing-home-modules]
> > > > These modules are needed for compilation but not listed in your
> > > > .cabal
> > > > file's other-modules:
> > > > Hsskripte Sicherung SicherungAktionen Text Wahl Zeit
> > > >
> > > > Is it really necessary to specify all the imported modules? If so,
> > > > why does
> > > > the program compile? Can that warning message be turned off?
> > >
> > > In response to all the sibling replies at once, is there a good reason
> > > for this behaviour? Succeeding but then failing later with obscure
> > > errors (once the original warning message is nowhere to be seen) seems
> > > like the worst of all worlds. Suppose cabal errored here and failed
> > > to proceed. What would be the downside of that (besides backward
> > > incompatibility)?
> >
> > I've already changed my mind. It's a little bothersome to manually add
> > all
> > the modules, which could be determined automatically. But it's better
> > than
> > having linker errors later.
> >
> > Regards,
> > Volker
> > _______________________________________________
> > Haskell-Cafe mailing list
> > To (un)subscribe, modify options or view archives go to:
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> > Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe
mailing list