I've setup a cabal file for a project. Building works fine but cabal haddock gives the following error:

src/AFRP/AFRP.hs:1:0:
    File name does not match module name:
    Saw: `Main'
    Expected: `AFRP.AFRP'

However, the module name specified in AFRP.hs is in fact AFRP.AFRP so why is haddock seeing Main, especially since cabal build completes successfully?