[Haskell-cafe] LTS-10.* missing build-depends suggestion

Dan Burton danburton.email at gmail.com
Thu Jan 25 02:02:22 UTC 2018


I believe the particular feature you are talking about is a feature of GHC.
Whether a suggestion is show or not merely depends on whether GHC sees the
package in question in its package database(s).

If you are using stack, then you can look at one of your LTS 9 projects,
and run

stack exec -- ghc-pkg list

In order to see the list of installed packages. (I think something like
`cabal exec ghc-pkg list` should do the same for a cabal project.)

Identify the packages you tend to use, go into one of your LTS 10 projects,
and `stack install pkg1 pkg2 ...`

Note that with stack, each minor version of LTS has its own package
database, so packages locally installed into lts-10.1 will not necessarily
be available in your local instance of lts-10.2. Repeat stack install to
taste.

tl;dr the trick is to set up your package database so that GHC knows what
to suggest for you

-- Dan Burton

On Wed, Jan 24, 2018 at 5:12 PM, Rick Owens <rick at owensmurray.com> wrote:

> Dear Haskell Café,
>
> I am a long-time Haskell developer with a proliferation of private
> projects. I typically make very heavy use of stack and LTS. Today, I tried
> to bootstrap my first project using LTS-10.* (with GHC-8.2.2) and I ran
> into an interesting problem (for me).
>
> In the past, with lts-9.* and below, when I started cranking on some code
> and writing a bunch of imports:
>
> > import Control.Monad.Trans.Class (MonadTrans)
> > import Data.Map (Map)
>
> I would try to build first without updating the cabal file build-depends,
> and I would get something like the following error messages:
>
> >   /path/to/Module.hs:48:1: error:
> >       Failed to load interface for ‘Data.Map’
> >       It is a member of the hidden package ‘containers-0.5.7.1’.
> >       Perhaps you need to add ‘containers’ to the build-depends in your
> .cabal file.
> >       Use -v to see a list of the files searched for.
> >
> >   /path/to/Module.hs:21:1: error:
> >       Failed to load interface for ‘Control.Monad.Trans.Class’
> >       It is a member of the hidden package ‘transformers-0.5.2.0’.
> >       Perhaps you need to add ‘transformers’ to the build-depends in
> your .cabal file.
> >       Use -v to see a list of the files searched for.
>
>
> This was good because the error contained a suggested solution which
> contained the missing package, and I could sort of lazily add the
> build-depends I needed without having to memorize a (Module -> Package)
> mapping. I even had developer tooling to do it automatically.
>
> With lts-10.*, however, the analogous error message looks like this:
>
> > /path/to/Module.hs:9:1: error:
> >     Could not find module ‘Data.DoubleWord’
> >     Use -v to see a list of the files searched for.
> >   |
> > 9 | import Data.DoubleWord (Word256(Word256), Word128(Word128))
> >   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I am wondering, is there a way to bring back the solution suggestion? Not
> having access to it has made me realize how heavily I was using that
> feature. What do others think about this missing bit of supplemental error
> information?
>
> Thanks,
>
> -Rick Owens
>
>
>
>
> _______________________________________________
> 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/20180124/6a231408/attachment.html>


More information about the Haskell-Cafe mailing list