Q:

Cabal not finding sources

While playing with semver and semver-range I was stuck because of conflicting modules name.
As a temporary fix, I forked the semver-range repo to rename modules (the first attempt is available here). I renamed each modules Data.SemVer* by Data.SemVer.Range*.
I didn't change the folder structure, just the cabal file :
Exposed-modules:     Data.SemVer.Range
other-modules:       Data.SemVer.Range.Parser
                   , Data.SemVer.Range.Types

Trying to build the project I have the following error message :
Building semver-range-0.2.0...
Preprocessing library semver-range-0.2.0...
cabal: can't find source for Data/SemVer/Range in src, dist/build/autogen

I made a second attempt (available here). I renamed every module Data.SemVer* with Data.SemVerRange*
I also changed the cabal file and renamed src/Data/SemVer.hs to src/Data/SemVerRange.hs.
This second attempt worked fine but I'm curious what did I do wrong in the first try.
Did I miss something obvious ?

A:

I'm a little bit confused about the precise sequence of renames you've done, but anyway... Looking at your first attempt, I see a file that says
module Data.SemVer.Range.Types where

However, the filename is is src/Data/SemVer/Types.hs, which doesn't match. And that would be why it doesn't work; file path doesn't match module path.
If you had created a folder named Range and moved the files in there, that should work.

