Skip to content

On case insensitive file system, imported module is blamed for case error in importing module

On Mac OS, with ghc 8.6.4, files

  • Nonempty.hs (imported file):
module Nonempty where
  • Main.hs (importing files):
import NonEmpty

main = putStrLn "Hello, world!"

I get the following error:

NonEmpty.hs:1:8: error:
    File name does not match module name:
    Saw: ‘Nonempty’
    Expected: ‘NonEmpty’
  |
1 | module Nonempty where
  |        ^^^^^^^^

Two bugs here:

  • the imported module is blamed for a misspelling in the import statement of the main module
  • the error message suggest that the spelling of the imported file is NonEmpty.hs, while it is Nonempty.hs

The blame should go the other way round, and the actual file name of the imported file should be taken as fact, not the one computed from the import statement.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information