From 2e1a0cb7d5f9d2c4ba7f99a28e666f6ce40cee88 Mon Sep 17 00:00:00 2001
From: Simon Peyton Jones <simonpj@microsoft.com>
Date: Wed, 15 Aug 2012 15:59:26 +0100
Subject: [PATCH] Put kind variables before type variables when quantifying

This is a pretty egregious error; I'm surprised it has lasted so long!

Fixes Trac #7124

MERGED from commit bdce8f0a3b40a60108a99b4635d168c12b79f255
---
 compiler/coreSyn/MkCore.lhs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/compiler/coreSyn/MkCore.lhs b/compiler/coreSyn/MkCore.lhs
index 410d62db7dd5..cd47d664411b 100644
--- a/compiler/coreSyn/MkCore.lhs
+++ b/compiler/coreSyn/MkCore.lhs
@@ -102,14 +102,14 @@ infixl 4 `mkCoreApp`, `mkCoreApps`
 \begin{code}
 sortQuantVars :: [Var] -> [Var]
 -- Sort the variables (KindVars, TypeVars, and Ids) 
--- into order: Type, then Kind, then Id
+-- into order: Kind, then Type, then Id
 sortQuantVars = sortBy (comparing withCategory)
   where
     withCategory v = (category v, v)
     category :: Var -> Int
     category v
-     | isTyVar   v = 1
-     | isKindVar v = 2
+     | isKindVar v = 1
+     | isTyVar   v = 2
      | otherwise   = 3
 
 -- | Bind a binding group over an expression, using a @let@ or @case@ as
-- 
GitLab