You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Haskell pretty printer should generate {-# LINE ... #-} pragmas so that GHC error messages can point to locations in the source files (instead of locations in the generated files).
Example:
I have a file src/Foo/Bar/Test.shs:
moduleFoo.Bar.Testwhere// main ::IO()
main ="foo"+13
SugarJ generates the following in bin/Foo/Bar/Test.hs:
moduleFoo.Bar.Testwhere
main = ( "foo"+13 ) where { }
This program does not typecheck, because the use of + in line 3 of Test.shs is not correct. GHC reports the problem, but points to line 2 of Test.hs:
C:\eclipse\sugarj\workspace\test-project\bin\Foo\Bar\Test.hs:2:16:
No instance for (Num [Char])
arising from a use of `+'
Possible fix: add an instance declaration for (Num [Char])
In the expression: ("foo" + 13)
In an equation for `main': main = ("foo" + 13)
It would be better if SugarJ could generate the following bin/Foo/Bar/Test.hs instead:
{-# LINE 1 "C:/eclipse/sugarj/workspace/test-project/src/Foo/Bar/Test.shs" #-}
moduleFoo.Bar.Testwhere
{-# LINE 3 "C:/eclipse/sugarj/workspace/test-project/src/Foo/Bar/Test.shs" #-}
main = ( "foo"+13 ) where { }
GHC would use the information in the LINE-pragmas to generate the following error message, which points to the correct line in the correct file:
C:\eclipse\sugarj\workspace\test-project\src\Foo\Bar\Test.shs:3:16:
No instance for (Num [Char])
arising from a use of `+'
Possible fix: add an instance declaration for (Num [Char])
In the expression: ("foo" + 13)
In an equation for `main': main = ("foo" + 13)
Even better would be if SugarJ would parse this error messages and display it as an error marker on the line.
The text was updated successfully, but these errors were encountered:
The Haskell pretty printer should generate {-# LINE ... #-} pragmas so that GHC error messages can point to locations in the source files (instead of locations in the generated files).
Example:
I have a file
src/Foo/Bar/Test.shs
:SugarJ generates the following in
bin/Foo/Bar/Test.hs
:This program does not typecheck, because the use of
+
in line 3 of Test.shs is not correct. GHC reports the problem, but points to line 2 of Test.hs:It would be better if SugarJ could generate the following
bin/Foo/Bar/Test.hs
instead:GHC would use the information in the LINE-pragmas to generate the following error message, which points to the correct line in the correct file:
Even better would be if SugarJ would parse this error messages and display it as an error marker on the line.
The text was updated successfully, but these errors were encountered: