Skip to content

"Bindings in hs-boot files" error message lacks precise source spans

I think the error message displayed when top-level bindings are included in a hs-boot file could be improved somewhat. Consider for instance:

A.hs-boot:

module A where

a :: Int
a = 3

b :: Int
b = 4
> ghc -c A.hs-boot
A.hs-boot:1:1: error:
    Bindings in hs-boot files are not allowed {a = 3, b = 4}
  |
1 | module A where
  | ^

Note in particular:

  • the incorrect line/column number at the start,
  • the source included inline as {a = 3, b = 4},
  • the incorrectly highlighted source snippet.

I think it would be preferable to have one error message per binding, each one highlighting the correct source location. I'm preparing a little patch.

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