problem with cabal for syb-with-class

i tried to install wxGeneric and need syb-with-class. i got the package from hackage. configure runs fine, but when i build i get: Data/Generics/SYB/WithClass/Instances.hs:11:7: Could not find module `Data.Array': it is a member of package array-0.1.0.0, which is hidden but array-0.1.0.0 is installed, as shown later. what can be wrong? why is an installed package complained about as hidden? thanks for help! andrew frank@bernH:~/haskellSources/packages/syb-with-class-0.3$ ghc-pkg describe array name: array version: 0.1.0.0 license: BSD3 copyright: maintainer: libraries@haskell.org stability: homepage: package-url: description: This package defines the classes @IArray@ of immutable arrays and @MArray@ of arrays mutable within appropriate monads, as well as some instances of these classes. category: author: exposed: True exposed-modules: Data.Array Data.Array.Base Data.Array.Diff Data.Array.IArray Data.Array.IO Data.Array.MArray Data.Array.ST Data.Array.Storable Data.Array.Unboxed hidden-modules: Data.Array.IO.Internals import-dirs: /usr/lib/ghc-6.8.2/lib/array-0.1.0.0 library-dirs: /usr/lib/ghc-6.8.2/lib/array-0.1.0.0 hs-libraries: HSarray-0.1.0.0 extra-libraries: extra-ghci-libraries: include-dirs: includes: depends: base-3.0.1.0 hugs-options: cc-options: ld-options: framework-dirs: frameworks: haddock-interfaces: /usr/share/doc/ghc6-doc/libraries/array/array.haddock haddock-html: /usr/share/doc/ghc6-doc/libraries/array f

Am Montag, 25. August 2008 18:08 schrieb Andrew U. Frank:
i tried to install wxGeneric and need syb-with-class. i got the package from hackage. configure runs fine, but when i build i get:
Data/Generics/SYB/WithClass/Instances.hs:11:7: Could not find module `Data.Array': it is a member of package array-0.1.0.0, which is hidden
but array-0.1.0.0 is installed, as shown later. what can be wrong? why is an installed package complained about as hidden?
thanks for help!
andrew
Probably an old .cabal file where array is not yet listed among the build-depends. Cabal hides all packages not listed there when building. Try adding array to that list and building again (the same may be necessary for some other packages which were split off base). Cheers, Daniel

in fairness, i have to add that i did inadvertetly install version 0.3. of syb-with-class and got the error i still cannot understand. installing version 0.4 did work flawlessly! nevertheless, i would be interested to understand the problem i encountered. andrew On Mon, 2008-08-25 at 18:08 +0200, Andrew U. Frank wrote:
i tried to install wxGeneric and need syb-with-class. i got the package from hackage. configure runs fine, but when i build i get:
Data/Generics/SYB/WithClass/Instances.hs:11:7: Could not find module `Data.Array': it is a member of package array-0.1.0.0, which is hidden
but array-0.1.0.0 is installed, as shown later. what can be wrong? why is an installed package complained about as hidden?
thanks for help!
andrew
frank@bernH:~/haskellSources/packages/syb-with-class-0.3$ ghc-pkg describe array name: array version: 0.1.0.0 license: BSD3 copyright: maintainer: libraries@haskell.org stability: homepage: package-url: description: This package defines the classes @IArray@ of immutable arrays and @MArray@ of arrays mutable within appropriate monads, as well as some instances of these classes. category: author: exposed: True exposed-modules: Data.Array Data.Array.Base Data.Array.Diff Data.Array.IArray Data.Array.IO Data.Array.MArray Data.Array.ST Data.Array.Storable Data.Array.Unboxed hidden-modules: Data.Array.IO.Internals import-dirs: /usr/lib/ghc-6.8.2/lib/array-0.1.0.0 library-dirs: /usr/lib/ghc-6.8.2/lib/array-0.1.0.0 hs-libraries: HSarray-0.1.0.0 extra-libraries: extra-ghci-libraries: include-dirs: includes: depends: base-3.0.1.0 hugs-options: cc-options: ld-options: framework-dirs: frameworks: haddock-interfaces: /usr/share/doc/ghc6-doc/libraries/array/array.haddock haddock-html: /usr/share/doc/ghc6-doc/libraries/array f

On Tue, 2008-08-26 at 12:06 +0200, Andrew U. Frank wrote:
in fairness, i have to add that i did inadvertetly install version 0.3. of syb-with-class and got the error i still cannot understand.
installing version 0.4 did work flawlessly!
nevertheless, i would be interested to understand the problem i encountered.
The error message unfortunately refers to the mechanism and not the cause. When Cabal builds a package it tells ghc to hide every package and then use only the packages listed in the build-depends field: ghc --make -hide-all-packages -package base-3.0.1.0 ... etc So when ghc finds that one of your modules needs to import something that is not in one of the given packages it says that it's in another package that is 'hidden'. Of course it's only hidden because Cabal told ghc to hide them. So what the error message really means is that you're missing a package from the build-depends field in the .cabal file. The error message will improve when Cabal does it's own dependency chasing, but don't hold your breath. Duncan

On Tue, Aug 26, 2008 at 2:22 PM, Duncan Coutts
So when ghc finds that one of your modules needs to import something that is not in one of the given packages it says that it's in another package that is 'hidden'. Of course it's only hidden because Cabal told ghc to hide them.
Yes, it is one of those unfortunate error messages that says "I know what the problem is *and* how to fix it, but I'm not going to". ;-) Cheers, Dougal

On Tue, 2008-08-26 at 14:30 +0100, Dougal Stanton wrote:
On Tue, Aug 26, 2008 at 2:22 PM, Duncan Coutts
wrote: So when ghc finds that one of your modules needs to import something that is not in one of the given packages it says that it's in another package that is 'hidden'. Of course it's only hidden because Cabal told ghc to hide them.
Yes, it is one of those unfortunate error messages that says "I know what the problem is *and* how to fix it, but I'm not going to". ;-)
Actually it's more like: "I know what the problem is but I cannot fix it. He knows how to fix it, but doesn't know there's a problem!" :-) GHC knows what the problem is but it's just following orders. Cabal gave the orders but doesn't know there is a problem. That's why it'll be fixed when Cabal does the dep chasing rather than delegating that to ghc --make. Cabal will then be able to either just pull in the (probably) right packages, or report the problem using the language of the problem domain and not the implementation. Duncan

So when ghc finds that one of your modules needs to import something that is not in one of the given packages it says that it's in another package that is 'hidden'. Of course it's only hidden because Cabal told ghc to hide them.
Yes, it is one of those unfortunate error messages that says "I know what the problem is *and* how to fix it, but I'm not going to". ;-)
Actually it's more like: "I know what the problem is but I cannot fix it. He knows how to fix it, but doesn't know there's a problem!" :-)
GHC knows what the problem is but it's just following orders. Cabal gave the orders but doesn't know there is a problem.
Since you said "don't hold your breath for Cabal's dependencies": Cabal doesn't have to pass on ghc's messages uninterpreted. That's a lot like implementing a map as a list and complaining about empty list instead of element not found. Cabal is the interface here, ghc is the tool. The interface shouldn't just pass instructions to the tool, it should also interpret and present the tool's responses. As suggested in this thread: http://www.haskell.org/pipermail/cabal-devel/2007-December/001497.html http://www.haskell.org/pipermail/cabal-devel/2007-December/001499.html Hmm, the archive failed to decode the code sketch attached to the last message there (which demonstrated that some basic help could be hacked up as a simple pattern->message script wrapping cabal), so I attach the old code again for reference. Claus

On Tue, 2008-08-26 at 15:53 +0100, Claus Reinke wrote:
GHC knows what the problem is but it's just following orders. Cabal gave the orders but doesn't know there is a problem.
Since you said "don't hold your breath for Cabal's dependencies": Cabal doesn't have to pass on ghc's messages uninterpreted. That's a lot like implementing a map as a list and complaining about empty list instead of element not found.
I see what you're saying, but in practise it's just not possible. GHC can return a non-zero exit code for a multitude of reasons (most of which will be genuine errors in your source code). It's just not practical to parse the error messages that ghc produces and try and reinterpret them. I fear it'd quite easy to introduce more problems than are solved this way. If one wanted to take this approach you'd need to have some mode where error messages are produced in a machine readable format (which is of course doable if you write a client using the ghc api). A quicker hack would be to change ghcs error message in this circumstance, where the -hide-all-packages flag is given. Given our limited amount of volunteer developer time I think it's much better investing it in proper solutions. Duncan

Cabal doesn't have to pass on ghc's messages uninterpreted. That's a lot like implementing a map as a list and complaining about empty list instead of element not found.
I see what you're saying, but in practise it's just not possible. GHC can return a non-zero exit code for a multitude of reasons (most of which will be genuine errors in your source code). It's just not practical to parse the error messages that ghc produces and try and reinterpret them. I fear it'd quite easy to introduce more problems than are solved this way.
Introducing more problems is quite possible, though changes in error messages should mostly mean that the rules won't trigger and no helpful explanation is given. And even that could be cured by having the collection of rules updateable, separately from Cabal itself. And when the forthcoming next base split, and extensible exceptions, and Cabal Api changes, and .. are going to introduce new break points, updating the rules will offer help for those breakages, too. Given the shakiness of this simplistic approach, one might not want to enable it by default, but what about an option '--explain' and a hint if things go wrong: "if you would like help interpreting common Cabal package issues, you can try repeating your command with our experimental --explain option". What I don't understand are your "in practise it's just not possible" and "It's just not practical to parse the error messages that ghc produces and try and reinterpret them". I assume you've tried the code I first sent some 9 months ago, and again this week, and found that it wouldn't work for some reasons,but you haven't told me those reasons yet.
If one wanted to take this approach you'd need to have some mode where error messages are produced in a machine readable format (which is of course doable if you write a client using the ghc api).
A quicker hack would be to change ghcs error message in this circumstance, where the -hide-all-packages flag is given.
One would want to have such support depend on an extra option, '--errors-in-xml' or something equally scary, but I'm afraid the extra readability/stability would be mostly illusionary. We're talking about "good enough" hacks to cover "not quite right" left-overs from too much instability in the Haskell tool chains - as long as the instabilities remain, there is no "perfect" solution.
Given our limited amount of volunteer developer time I think it's much better investing it in proper solutions.
How many times over the last 9 months have you had to explain what a script could have told your Cabal users? And how many more Cabal/Haskell users have been scared away in that time, without even raising their build problems on any of the lists? "Proper" solutions are alright when we have them. "Good enough" but hacky is much better than nothing. With an '--explain' option and a collection of rules, you'd have to explain every error condition just once, then update the rules/explanations, and let Cabal repeat the explanation whenever needed. If those canned explanations don't work, users can still ask here. Claus

On Wed, 2008-08-27 at 12:33 +0100, Claus Reinke wrote:
Cabal doesn't have to pass on ghc's messages uninterpreted. That's a lot like implementing a map as a list and complaining about empty list instead of element not found.
I see what you're saying, but in practise it's just not possible. GHC can return a non-zero exit code for a multitude of reasons (most of which will be genuine errors in your source code). It's just not practical to parse the error messages that ghc produces and try and reinterpret them. I fear it'd quite easy to introduce more problems than are solved this way.
Introducing more problems is quite possible, though changes in error messages should mostly mean that the rules won't trigger and no helpful explanation is given.
Yes, it if it can degrade gracefully that's not so bad.
And even that could be cured by having the collection of rules updateable, separately from Cabal itself.
Hmm. Yet more work.
What I don't understand are your "in practise it's just not possible" and "It's just not practical to parse the error messages that ghc produces and try and reinterpret them". I assume you've tried the code I first sent some 9 months ago, and again this week, and found that it wouldn't work for some reasons,but you haven't told me those reasons yet.
The easiest reason is that we cannot use regexes in Cabal, but that's really just skirting the issue. The next reason is that it is still a not insignificant effort to integrate this concept. The honest reason is that I don't like the whole approach and I'm not inclined to spend my time on it. I'm not saying I'd reject a working patch against Cabal HEAD, just that I'm not interested it doing it myself. Feel free to file a ticket, attach your proof of concept code and persuade someone to put in the time. If it works and doesn't look like it'd cause more problems than it solves then I'd be happy to apply such a patch. Duncan

thank you very much for the explanation! i take that in this case, the error is in the cabal, which does not list the required package. andrew On Tue, 2008-08-26 at 15:09 +0100, Duncan Coutts wrote:
On Tue, 2008-08-26 at 14:30 +0100, Dougal Stanton wrote:
On Tue, Aug 26, 2008 at 2:22 PM, Duncan Coutts
wrote: So when ghc finds that one of your modules needs to import something that is not in one of the given packages it says that it's in another package that is 'hidden'. Of course it's only hidden because Cabal told ghc to hide them.
Yes, it is one of those unfortunate error messages that says "I know what the problem is *and* how to fix it, but I'm not going to". ;-)
Actually it's more like: "I know what the problem is but I cannot fix it. He knows how to fix it, but doesn't know there's a problem!" :-)
GHC knows what the problem is but it's just following orders. Cabal gave the orders but doesn't know there is a problem.
That's why it'll be fixed when Cabal does the dep chasing rather than delegating that to ghc --make. Cabal will then be able to either just pull in the (probably) right packages, or report the problem using the language of the problem domain and not the implementation.
Duncan
participants (5)
-
Andrew U. Frank
-
Claus Reinke
-
Daniel Fischer
-
Dougal Stanton
-
Duncan Coutts