Cabal builds file at top level incorrectly

Cabal's behaviour is strange to me. My example cabal file is as follows: name: break version: 0.1 cabal-version: >= 1.2 build-type: Simple library hs-source-dirs: src build-depends: base >= 4 && < 5 exposed-modules: Break and I have a module `src/Break.hs` that I want it to compile. That would work fine. But if I have another file at the top-level caled `Break.hs` it compiles that one instead. It also seems to want it to be an executable. What's going on? Full reproduction below. You can see it is trying to compile `Break.hs` not `src/Break.hs`. % git clone https://github.com/tomjaguarpaw/break.git Cloning into 'break'... [...] % cd break % cabal configure && cabal test Resolving dependencies... Configuring break-0.1... Re-configuring with test suites enabled. If this fails, please run configure manually. Resolving dependencies... Configuring break-0.1... Building break-0.1... Preprocessing library break-0.1... [1 of 1] Compiling Main ( Break.hs, dist/build/Main.o ) Break.hs:1:1: The function `main' is not defined in module `main:Main'

This appears to be a bug in ghc, not cabal. Cabal correctly calls ghc with -i, which should empty the search path. Apparently, that -i is ignored. Please report this to ghc trac. (Feel free to copy this email as an explanation.) Roman On 10/12/14 21:09, Tom Ellis wrote:
Cabal's behaviour is strange to me. My example cabal file is as follows:
name: break version: 0.1 cabal-version: >= 1.2 build-type: Simple
library hs-source-dirs: src build-depends: base >= 4 && < 5 exposed-modules: Break
and I have a module `src/Break.hs` that I want it to compile. That would work fine. But if I have another file at the top-level caled `Break.hs` it compiles that one instead. It also seems to want it to be an executable.
What's going on?
Full reproduction below. You can see it is trying to compile `Break.hs` not `src/Break.hs`.
% git clone https://github.com/tomjaguarpaw/break.git Cloning into 'break'... [...] % cd break % cabal configure && cabal test Resolving dependencies... Configuring break-0.1... Re-configuring with test suites enabled. If this fails, please run configure manually. Resolving dependencies... Configuring break-0.1... Building break-0.1... Preprocessing library break-0.1... [1 of 1] Compiling Main ( Break.hs, dist/build/Main.o )
Break.hs:1:1: The function `main' is not defined in module `main:Main' _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
Roman Cheplyaka
-
Tom Ellis