From f69bf6be6101d6b5d7952c384dd5eeb1917b4cdb Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Wed, 17 Mar 2010 12:35:19 +0000 Subject: [PATCH] Fix Trac #3920: Template Haskell kinds 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 | 2 +- compiler/typecheck/TcSplice.lhs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index f071a17..3f7f4d0 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -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 diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs index d67a57b..61ed8c7 100644 --- a/compiler/typecheck/TcSplice.lhs +++ b/compiler/typecheck/TcSplice.lhs @@ -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" -- 1.7.10.4