Reputation: 1431
I'm trying to write a test using quickcheck for a simple lexer i've written. However, I seem to be falling foul of some sort of link error
I've building using cabal-dev
my .cabal file is building a library "mylib" The library section has under its exposed modules section Lexical.Token and under the test-suite I have "mylib" listed under build_depends, and I also have Lexical.token listed under other modules.
What am I missing? The error I get out of ghc (7.4.1) is as follows:
Couldn't match expected type `Token'
with actual type `mylib-0.0.0.1:Lexical.Token.Token'
Expected type: [Token]
Actual type: [mylib-0.0.0.1:Lexical.Token.Token]
Upvotes: 0
Views: 120
Reputation: 74374
Cabal is conflicted over two locations for the "Lexical.Token" module. Confusingly, they're both the same file.
mylib-0.0.0.1
from your build-depends
to the "locally installed and registered" version of mylib
.Lexical.Token
in the source as an other-modules
entry, something that should be exposed through your test suite.Fix it be removing Lexical.Token
from other-modules
, I imagine. Your test suite should not share code with your tested code, but instead import all the modules as if your tested code were an external library.
Upvotes: 1