Fix Trac #3920: Template Haskell kinds
authorsimonpj@microsoft.com <unknown>
Wed, 17 Mar 2010 12:35:19 +0000 (12:35 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 17 Mar 2010 12:35:19 +0000 (12:35 +0000)
Fix two places where we were doing foldl instead of foldr
after decomposing a Kind.  Strange that the same bug appears
in two quite different places!

compiler/deSugar/DsMeta.hs
compiler/typecheck/TcSplice.lhs

index f071a17..3f7f4d0 100644 (file)
@@ -644,7 +644,7 @@ repKind ki
   = do { let (kis, ki') = splitKindFunTys ki
        ; kis_rep <- mapM repKind kis
        ; ki'_rep <- repNonArrowKind ki'
-       ; foldlM repArrowK ki'_rep kis_rep
+       ; foldrM repArrowK ki'_rep kis_rep
        }
   where
     repNonArrowKind k | isLiftedTypeKind k = repStarK
index d67a57b..61ed8c7 100644 (file)
@@ -1119,7 +1119,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"