[Haskell-cafe] Cabal: other-modules necessary?

Artem Pelenitsyn a.pelenitsyn at gmail.com
Mon Sep 19 22:53:12 UTC 2022


On the topic of cabal creating inconsistent environments: I keep seeing
these issues on SO and elsewhere.
This thread was the last drop for me, and I started an RFC over on cabal
bug tracker with a proposal to simply refuse to do the thing that is known
to fail.
https://github.com/haskell/cabal/issues/8483
Unfortunately, it's not going well so far. See if you have something to
contribute there.

--
Best, Artem

On Sun, 18 Sept 2022 at 12:47, Tom Ellis <
tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk> wrote:

> Ah, that's interesting Oleg, thanks.  I like the idea of Cabal being
> able to specify the exact mapping between modules and source files.
>
> Tom
>
> On Fri, Sep 16, 2022 at 04:05:53PM +0300, Oleg Grenrus wrote:
> > That is error generated by GHC.
> >
> > The culprit is `ghc --make` mode which discovers modules/files on its
> own.
> >
> > If there were a way to say (for Cabal to GHC) that use these files to
> > compile the component, and fail otherwise, then -Wmissing-home-modules
> > would turn into error.
> >
> > In fact, it would be great if it where possible to say that *this*
> > module is in *that* file, something like `MyFoo:src/MyFoo.hs`.
> >
> > That would also solve a problem of having same hs-source-dirs for
> > different components, as Cabal would be able to tell GHC that "don't
> > look for this modules locally, use dependencies". As currently GHC will
> > eagerly look for modules locally first. Always.
> >
> > - Oleg
> >
> > On 16.9.2022 12.23, Tom Ellis wrote:
> > > 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)?
> _______________________________________________
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20220919/9bd3ddc7/attachment.html>


More information about the Haskell-Cafe mailing list