Skip to content

Insufficient location information for parse errors before ''module'' keyword

I've seen this error with GHC 6.6 on a PPC Mac (10.4.8), but I suspect it happens on multiple systems.

Consider Main.hs

module Main where

import Test

main = test

and Test.hs

mmmodule Test where

test = putStr "stutter"

The error message for trying to load the Main module is

$ ghci Main
[snip]
Loading package base ... linking ... done.

<no location info>: file name does not match module name `Main'
Failed, modules loaded: none.
Prelude> 

This provides no information regarding the actual location of the error. In a program of a considerable number of modules, the offending module can be difficult to track down. Moreover, the error provides no direct indication that there's a source file without the module keyword in it.

The path of the offending file should be included in the error.

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Multiple
Architecture Multiple
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information