[Haskell-cafe] Suggestion for error message improvement

Edward Z. Yang ezyang at mit.edu
Wed Oct 26 07:05:33 UTC 2016


It's a very good suggestion, and also a bit fiddly to implement.
The trouble is that this error message is produced by GHC, but
GHC has no idea where the Cabal file lives (separation of
concerns)!  One possible way to work around this is for there
to somehow be a way to indicate the name of the Cabal file
being built so that GHC could build an error message, but for
editor support I imagine you would much rather have the
proper line.  And then there's yet another yak to shave,
which is that the Cabal library doesn't keep track of line/col
of source elements (although https://github.com/haskell/cabal/pull/3602
should put a dent in this yak.)

Anyway, if you still think it's worth fixing please do file
a ticket on the GHC Trac.

Edward

Excerpts from Zachary Kessin's message of 2016-10-26 09:57:05 +0300:
> When I compiled some code this morning I got an error that said that I
> should edit my cabal file, but I notice that one thing is missing, the path
> to the cabal file. Having that in the error message would make fixing it a
> bit easier and faster in that emacs could take me right to the correct
> cabal file and that I would know for sure which one it was using.
> 
> I tried filing this as a bug on the stack github repo but they said it is a
> ghc issue.
> 
> 
> [1 of 1] Compiling Main             ( tests/test.hs,
> .stack-work/dist/x86_64-linux/Cabal-1.24.0.0/build/test/test-tmp/Main.o
> )
> 
> /home/zkessin/Documents/*****/tests/test.hs:17:1: error:
>     Failed to load interface for ‘Control.Lens’
>     It is a member of the hidden package ‘lens-4.14’.
>     Perhaps you need to add ‘lens’ to the build-depends in your .cabal file.
>     Use -v to see a list of the files searched for.
> Progress: 1/2
> --  While building package ***********-0.1.0.0 using:
>       /home/zkessin/.stack/setup-exe-cache/x86_64-linux/setup-Simple-Cabal-1.24.0.0-ghc-8.0.1
> --builddir=.stack-work/dist/x86_64-linux/Cabal-1.24.0.0 build
> lib:********** test:test --ghc-options " -ddump-hi -ddump-to-file"
>     Process exited with code: ExitFailure 1
> 


More information about the Haskell-Cafe mailing list