Add support for line pragmas
GHC, like the C preprocessor, has support for line pragmas, which let the user alter the line number and filename in warnings and errors:
{-# LINE 82 "Foo.hs" #-}
f :: Int
f = "abc"
[1 of 2] Compiling Main ( LinePragma.hs, LinePragma.o )
Foo.hs:83:5: error: [GHC-83865]
• Couldn't match type ‘[Char]’ with ‘Int’
Expected: Int
Actual: String
• In the expression: "abc"
In an equation for ‘f’: f = "abc"
For us these pragmas would be primarily of interest in the automatically generated Curry interfaces (.icurry
) where they could be used to refer to the original source locations. This in turn would be nice to have in the language server, which could accurately map definitions to their original locations in source code, even if the Curry compiler uses a cached interface file.
Edited by Fredrik Wieczerkowski