RE: {-# LINE 100 "Foo.hs #-} vs. # 100 "Foo.hs"
What should be the preferred way of marking correspondence to source positions after some preprocessing?
Here is what is currently supported:
| {-# LINE 100 "Foo.hs #-} | # 100 "Foo.hs" ------------------------+------------------------------+------ ---------- Released ghc, no -cpp | understand | error Released ghc, with -cpp | understand | understand Developed ghc | understand | understand hbc | understand (ignore filename) | understand (warning) Hugs | ignore | error Released nhc98 | error | understand Developed nhc98 | ignore | understand
I would choose LINE pragma. In this case nhc98 should be taught about it.
CPP generates the '# 100 "Foo.hs"' form, which is why GHC understands them. We used to convert these into LINE pragmas automatically before feeding to the compiler, but this required an extra script and preprocessing step (hscpp), so we don't do that anymore. The preferred way should presumably be LINE pragmas. Cheers, Simon
Simon Marlow <simonmar@microsoft.com> wrote,
The preferred way should presumably be LINE pragmas.
Indeed. Or do you want to tell me that you are going to break one of my favourite programs? <EndangeredProgram> import Char instance Eq (a -> b) where _ ==_ = False instance Show (a -> b) where show = const "<function>" instance Num b => Num (a -> b) where fromInteger = const . fromInteger (+) = undefined (*) = undefined signum = undefined abs = undefined (#) :: Int -> Int -> String (x # y) = chr x : chr y : "!" main = putStrLn $ 78 # 111 "Foo.hs" </EndangeredProgram> Cheers, Manuel
participants (2)
-
Manuel M. T. Chakravarty -
Simon Marlow