Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell module imports itself

Tags:

haskell

ghc

cabal

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?

like image 427
Rose Perrone Avatar asked Dec 18 '13 06:12

Rose Perrone


1 Answers

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.

like image 140
Jon Purdy Avatar answered Oct 03 '22 06:10

Jon Purdy