
I have just attempted Cabal-izing my program (splitting it into a library and main program as well), and I'm mystified by some problems I am having. First, when I try to build the library I get: [colin@susannah game-tree]$ runhaskell Setup build Preprocessing library game-tree-1.0.0.0... Building game-tree-1.0.0.0... Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, dist/build/Data/Tree/Game/Tree.o ) Data/Tree/Game/Tree.hs:1:0: Failed to load interface for `Prelude': it is a member of package base-3.0.3.0, which is hidden That mystifies me. Googling, it appears to be a common error in the past, but none of the reasons apparently apply to my case. Incidentally, Tree.hs imports nothing. It just looks like: -- | Nodes in game trees -- Copyright 2009 Colin Adams -- -- This file is part of game-tree. -- -- Game-tree is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- Game-tree is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- You should have received a copy of the GNU General Public License -- along with game-tree. If not, see http://www.gnu.org/licenses/. module Data.Tree.Game.Tree where -- | Nodes in a game search tree class Tree a where -- | Is this a game-terminating node (e.g. checkmate)? is_terminal :: a -> Bool -- | Heuristic value of node node_value :: a -> Int -- | Child nodes in the game tree (positions more deeply searched) children :: a -> [a] So I couldn't build my program using runhaskell, as I couldn't install the library. Instead, i tried ghc --make instead with the -idir option. It looks in the right place, but still doesn't recognise the module: Chasing modules from: *Chu-shogi.hs Generator.hs:27:7: Could not find module `Data.Tree.Game.Tree': locations searched: Data/Tree/Game/Tree.hs Data/Tree/Game/Tree.lhs dirs=../game-tree/Data/Tree/Game/Tree.hs dirs=../game-tree/Data/Tree/Game/Tree.lhs What am I doing wrong? Perhaps Cabal should be named Caballa instead. -- Colin Adams Preston Lancashire

On Sat, Mar 7, 2009 at 6:18 PM, Colin Paul Adams
I have just attempted Cabal-izing my program (splitting it into a library and main program as well), and I'm mystified by some problems I am having.
First, when I try to build the library I get:
[colin@susannah game-tree]$ runhaskell Setup build Preprocessing library game-tree-1.0.0.0... Building game-tree-1.0.0.0...
Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, dist/build/Data/Tree/Game/Tree.o )
Data/Tree/Game/Tree.hs:1:0: Failed to load interface for `Prelude': it is a member of package base-3.0.3.0, which is hidden
What does your .cabal file look like?
Perhaps Cabal should be named Caballa instead.
Nah, it's not /that/ bad. :P You might want to install the mkcabal package, use that to generate the initial .cabal file. Though I'm not sure what you might have gotten wrong.. well, show us the file first. - Svein Ove

"Svein" == Svein Ove Aas
writes:
>> Preprocessing library game-tree-1.0.0.0... Building >> game-tree-1.0.0.0... >> >> Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] >> Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, >> dist/build/Data/Tree/Game/Tree.o ) >> >> Data/Tree/Game/Tree.hs:1:0: Failed to load interface for >> `Prelude': it is a member of package base-3.0.3.0, which >> is hidden >> Svein> What does your .cabal file look like? name: game-tree version: 1.0.0.0 cabal-version: >= 1.6 synopsis: Searching game trees with alpha-beta pruning description: A data type for game trees, as used in decision theory and game theory, along with standard algorithms for searching the tree using alpha-beta pruning. Can be used as the basis of an AI for two-player zero-sum games, such as chess. category: Data license: GPL license-file: LICENSE author: Colin Adams maintainer: colin@colina.demon.co.uk copyright: Copyright: 2009 Colin Adams build-type: Simple build-depends: base >= 4 ghc-options: -Wall -fno-warn-unrecognised-pragmas Library exposed-modules: Data.Tree.Game.Tree, Data.Tree.Game.Negascout source-repository head type: darcs location: http://code.haskell.org/game-tree/ -- Colin Adams Preston Lancashire

Hello Colin, Saturday, March 7, 2009, 8:30:43 PM, you wrote:
>> Data/Tree/Game/Tree.hs:1:0: Failed to load interface for >> `Prelude': it is a member of package base-3.0.3.0, which >> is hidden build-depends: base >= 4
and which ghc version you are running? :) -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sat, 07 Mar 2009 17:30:43 +0000
Colin Paul Adams
"Svein" == Svein Ove Aas
writes: >> Preprocessing library game-tree-1.0.0.0... Building >> game-tree-1.0.0.0... >> >> Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] >> Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, >> dist/build/Data/Tree/Game/Tree.o ) >> >> Data/Tree/Game/Tree.hs:1:0: Failed to load interface for >> `Prelude': it is a member of package base-3.0.3.0, which >> is hidden >> Svein> What does your .cabal file look like?
name: game-tree version: 1.0.0.0 cabal-version: >= 1.6 synopsis: Searching game trees with alpha-beta pruning description: A data type for game trees, as used in decision theory and game theory, along with standard algorithms for searching the tree using alpha-beta pruning. Can be used as the basis of an AI for two-player zero-sum games, such as chess. category: Data license: GPL license-file: LICENSE author: Colin Adams maintainer: colin@colina.demon.co.uk copyright: Copyright: 2009 Colin Adams build-type: Simple build-depends: base >= 4 ghc-options: -Wall -fno-warn-unrecognised-pragmas
Library exposed-modules: Data.Tree.Game.Tree, Data.Tree.Game.Negascout source-repository head type: darcs location: http://code.haskell.org/game-tree/
The build-depends line needs to go in the Library section, I think. It doesn't seem to be having any effect in its current location. Likewise for ghc-options. -- Robin

"Robin" == Robin Green
writes:
Robin> The build-depends line needs to go in the Library section, Robin> I think. It doesn't seem to be having any effect in its Robin> current location. Likewise for ghc-options. Thanks everyone - it's working now. -- Colin Adams Preston Lancashire

On Sat, 2009-03-07 at 17:30 +0000, Colin Paul Adams wrote:
"Svein" == Svein Ove Aas
writes: >> Preprocessing library game-tree-1.0.0.0... Building >> game-tree-1.0.0.0... >> >> Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] >> Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, >> dist/build/Data/Tree/Game/Tree.o ) >> >> Data/Tree/Game/Tree.hs:1:0: Failed to load interface for >> `Prelude': it is a member of package base-3.0.3.0, which >> is hidden >> Svein> What does your .cabal file look like?
Don, mkcabal is generating .cabal files that are confusing people. It should generate new-style .cabal files with library or executable sections. The ghc-options and build-depends etc need to be in the lib or exe section. The files it generates are not actually broken but it leaves new users to do the conversion from old style to new and unsurprisingly many get that wrong. Cabal is also at fault here for not providing good diagnostics but it would help if mkcabal used the current recommended style. Note also that the list of licenses mkcabal offers is wrong. You can get the list from the Cabal lib itself so there is no need to maintain the list manually. I still think mkcabal should be integrated into cabal-install, like: $ cabal init or something. We could also more easily keep it up to date that way. Duncan

On Sun, Mar 8, 2009 at 12:32 PM, Duncan Coutts
Note also that the list of licenses mkcabal offers is wrong. You can get the list from the Cabal lib itself so there is no need to maintain the list manually.
It would also be nice to expand that list somewhat, to at least cover the most used licences - GPL2, GPL3, AGPL, etc. -- Svein Ove Aas

On Sun, 2009-03-08 at 13:13 +0100, Svein Ove Aas wrote:
On Sun, Mar 8, 2009 at 12:32 PM, Duncan Coutts
wrote: Note also that the list of licenses mkcabal offers is wrong. You can get the list from the Cabal lib itself so there is no need to maintain the list manually.
It would also be nice to expand that list somewhat, to at least cover the most used licences - GPL2, GPL3, AGPL, etc.
Cabal HEAD adds MIT and versioned GPL and LGPL. We could not change it much earlier because old Cabal versions (ie 1.2 and earlier) would have barfed on parsing names it did not recognise. Duncan

On Sun, Mar 08, 2009 at 01:13:33PM +0100, Svein Ove Aas wrote:
On Sun, Mar 8, 2009 at 12:32 PM, Duncan Coutts
wrote: Note also that the list of licenses mkcabal offers is wrong. You can get the list from the Cabal lib itself so there is no need to maintain the list manually.
It would also be nice to expand that list somewhat, to at least cover the most used licences - GPL2, GPL3, AGPL, etc.
Why would cabal need a list at all inside of it? It seems very odd to have to upgrade cabal just because I am using a different license. it seems that we should just bite the bullet and switch data License to newtype License = License String and simplify a lot of code to boot as well as create a normalized data layout. John -- John Meacham - ⑆repetae.net⑆john⑈

On Mon, 2009-03-09 at 17:56 -0700, John Meacham wrote:
On Sun, Mar 08, 2009 at 01:13:33PM +0100, Svein Ove Aas wrote:
On Sun, Mar 8, 2009 at 12:32 PM, Duncan Coutts
wrote: Note also that the list of licenses mkcabal offers is wrong. You can get the list from the Cabal lib itself so there is no need to maintain the list manually.
It would also be nice to expand that list somewhat, to at least cover the most used licences - GPL2, GPL3, AGPL, etc.
Why would cabal need a list at all inside of it? It seems very odd to have to upgrade cabal just because I am using a different license.
it seems that we should just bite the bullet and switch data License to
newtype License = License String
and simplify a lot of code to boot as well as create a normalized data layout.
Because it was not that way initially and changing away to something more sensible takes time so that we do not cause unnecessary breakage. Now it does allow any string at all. There are however a list of "well known" licenses and the point of that is so that we can collectively use the same name for the same thing. There's nothing however stopping you from using a custom license. At the moment you cannot give a name in the .cabal file to that custom license and upload it to hackage and I think that's what you're getting at. If everyone agrees that's the way to go then we can certainly change it. The hard part was phasing out the fragile parser. We are now half way through that cycle. When we no longer care about users of ghc-6.8 then we can make use of the extra flexibility. Duncan

duncan.coutts:
On Sat, 2009-03-07 at 17:30 +0000, Colin Paul Adams wrote:
> "Svein" == Svein Ove Aas
writes: >> Preprocessing library game-tree-1.0.0.0... Building >> game-tree-1.0.0.0... >> >> Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] >> Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, >> dist/build/Data/Tree/Game/Tree.o ) >> >> Data/Tree/Game/Tree.hs:1:0: Failed to load interface for >> `Prelude': it is a member of package base-3.0.3.0, which >> is hidden >> Svein> What does your .cabal file look like?
Don, mkcabal is generating .cabal files that are confusing people.
It should generate new-style .cabal files with library or executable sections. The ghc-options and build-depends etc need to be in the lib or exe section.
The files it generates are not actually broken but it leaves new users to do the conversion from old style to new and unsurprisingly many get that wrong. Cabal is also at fault here for not providing good diagnostics but it would help if mkcabal used the current recommended style.
Note also that the list of licenses mkcabal offers is wrong. You can get the list from the Cabal lib itself so there is no need to maintain the list manually.
I still think mkcabal should be integrated into cabal-install, like: $ cabal init or something. We could also more easily keep it up to date that way.
mkcabal is unmaintained. -- Don

colin:
I have just attempted Cabal-izing my program (splitting it into a library and main program as well), and I'm mystified by some problems I am having.
First, when I try to build the library I get:
[colin@susannah game-tree]$ runhaskell Setup build Preprocessing library game-tree-1.0.0.0... Building game-tree-1.0.0.0...
Data/Tree/Game/Negascout.hs:31:0: Unrecognised pragma [1 of 2] Compiling Data.Tree.Game.Tree ( Data/Tree/Game/Tree.hs, dist/build/Data/Tree/Game/Tree.o )
Data/Tree/Game/Tree.hs:1:0: Failed to load interface for `Prelude': it is a member of package base-3.0.3.0, which is hidden
build-depends: base You certainly depend on the base library, unless you're doing only haskell98 work.
participants (7)
-
Bulat Ziganshin
-
Colin Paul Adams
-
Don Stewart
-
Duncan Coutts
-
John Meacham
-
Robin Green
-
Svein Ove Aas