Fall over more gracefully when there's a Template Haskell error
authorsimonpj@microsoft.com <unknown>
Fri, 18 Aug 2006 11:07:02 +0000 (11:07 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 18 Aug 2006 11:07:02 +0000 (11:07 +0000)
commit7a59afcebe45ea87c42006873f77eb4600d7316f
treefe27fea4d895efc598f0f43e3625cd839ebc15b9
parentd5c6d00221c1398732b45991ecbb1ab0c08cc977
Fall over more gracefully when there's a Template Haskell error

For a long time, Template Haskell has fallen over in a very un-graceful
way (i.e. panic) even when it encounters a programmer error.  In particular,
when DsMeta converts HsSyn to TH syntax, it may find Haskell code that
TH does not understand. This should be reported as a normal programmer
error, not with a compiler panic!

Originally the desugarer was supposed to never generate error
messages, but this TH desugaring thing does make it do so.  And in
fact, for other reasons, the desugarer now uses the TcRnIf monad, the
common monad used by the renamer, typechecker, interface checker, and
desugarer.

This patch completes the job, by
 - allowing the desugarer to generate errors
 - re-plumbing the error handling to take account of this
 - making DsMeta use the new facilities to report error gracefully

Quite a few lines of code are touched, but nothing deep is going on.

Fixes Trac# 760.
compiler/deSugar/Desugar.lhs
compiler/deSugar/DsBinds.lhs
compiler/deSugar/DsExpr.lhs
compiler/deSugar/DsMeta.hs
compiler/deSugar/DsMonad.lhs
compiler/deSugar/Match.lhs
compiler/main/HscMain.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcSplice.lhs