Question

I have src/Main.hs define the Main module and tests/Tests.hs import the Main module. Why does cabal build tell me module 'Main' (tests/Tests.hs) imports itself?

Was it helpful?

Solution

Did you give Tests a module header?

module Tests where

import Main

-- ...

Also, depending on the testing framework, test suites are usually run as a standalone executable with their own main, importing common modules that Main also uses.

OTHER TIPS

I had the same problem, and changing the name of the module Main to something else fixed it. May be Main has a particular meaning for haskell...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top