Skip to content

LINE pragma ignored on parse errors

Given the following file, the LINE pragma works as expected:

{-# LINE 3 "NotInScope.hs" #-}

module NotInScope where

main :: IO ()
main = do
  test -- 8
  putStrLn "test"
runghc NotInScope.hs

NotInScope.hs:8:3: Not in scope: `test'

However, in case of a parse error, it seems like the LINE pragma is being ignored:

{-# LINE 3 "ParseError.hs" #-}

module ParseError where

main :: IO ()
main = do
   test -- 8
  putStrLn "test"
runghc ParseError.hs

ParseError.hs:9:3: parse error on input `putStrLn'

Notice that the parse error is reported to be on line 9, when it should be reported to be on line 8 due to the LINE 3.


ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information