Fix Trac #3966: warn about unused UNPACK pragmas
[ghc-hetmet.git] / compiler / typecheck / TcSplice.lhs
index d67a57b..d114efb 100644 (file)
@@ -74,6 +74,7 @@ import BasicTypes
 import Panic
 import FastString
 import Exception
+import Control.Monad   ( when )
 
 import qualified Language.Haskell.TH as TH
 -- THSyntax gives access to internal functions and data types
@@ -655,15 +656,16 @@ runQuasiQuote :: Outputable hs_syn
               -> RnM hs_syn
 runQuasiQuote (HsQuasiQuote quoter q_span quote) quote_selector meta_ty meta_ops
   = do { quoter' <- lookupOccRn quoter
-               -- If 'quoter' is not in scope, proceed no further
-               -- Otherwise lookupOcc adds an error messsage and returns 
-               -- an "unubound name", which makes the subsequent attempt to
-               -- run the quote fail
-               --
                -- We use lookupOcc rather than lookupGlobalOcc because in the
                -- erroneous case of \x -> [x| ...|] we get a better error message
                -- (stage restriction rather than out of scope).
 
+        ; when (isUnboundName quoter') failM 
+               -- If 'quoter' is not in scope, proceed no further
+               -- The error message was generated by lookupOccRn, but it then
+               -- succeeds with an "unbound name", which makes the subsequent 
+               -- attempt to run the quote fail in a confusing way
+
           -- Check that the quoter is not locally defined, otherwise the TH
           -- machinery will not be able to run the quasiquote.
        ; this_mod <- getModule
@@ -1119,7 +1121,7 @@ reifyKind  ki
         kis_rep    = map reifyKind kis
         ki'_rep    = reifyNonArrowKind ki'
     in
-    foldl TH.ArrowK ki'_rep kis_rep
+    foldr TH.ArrowK ki'_rep kis_rep
   where
     reifyNonArrowKind k | isLiftedTypeKind k = TH.StarK
                         | otherwise          = pprPanic "Exotic form of kind"