is this change in TH error message intentional?

Ömer Sinan Ağacan omeragacan at gmail.com
Mon Oct 19 20:38:18 UTC 2015


Hi all,

I realized this change in TH error messages:

GHC 7.10.2:

    ➜  th-test  ghc --make Main.hs
    [1 of 1] Compiling Main             ( Main.hs, Main.o )

    Main.hs:13:15:
        Not in scope: ‘locaton’
        Perhaps you meant ‘location’ (imported from Language.Haskell.TH.Syntax)
        In the splice: $locaton

    Main.hs:13:15:
        GHC stage restriction:
          ‘locaton’ is used in a top-level splice or annotation,
          and must be imported, not defined locally
        In the expression: locaton
        In the splice: $locaton

I think both error messages are quite useful in this context. I don't see
second one as redundant.

However, with HEAD:

    ➜  th-test  ghc-stage2 --make Main.hs
    [1 of 1] Compiling Main             ( Main.hs, Main.o )

    Main.hs:13:15: error:
        Variable not in scope: locaton :: ExpQ
        Perhaps you meant ‘location’ (imported from Language.Haskell.TH.Syntax)

I think this new message is quite worse than previous one. First, "In the
splice ..." part is missing. Second, "It must be imported, not defined locally"
message is not given at all.

Was this change intentional? May I ask why it's changed?


More information about the ghc-devs mailing list