diff options
author | Ian Lynagh <igloo@earth.li> | 2012-06-22 22:42:19 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-06-22 22:42:19 +0100 |
commit | 9ce1cc927feec8c78c0701469c89b8e5770ef08c (patch) | |
tree | 976095401dcd9012038dabc1bfc1c542dd73c7a2 | |
parent | ab9b844f6bc2c2f2a699b4b39958a579647d8ca4 (diff) | |
download | haskell-9ce1cc927feec8c78c0701469c89b8e5770ef08c.tar.gz |
Remove another use of sortLe
-rw-r--r-- | compiler/coreSyn/MkCore.lhs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/compiler/coreSyn/MkCore.lhs b/compiler/coreSyn/MkCore.lhs index 76adef1f64..410d62db7d 100644 --- a/compiler/coreSyn/MkCore.lhs +++ b/compiler/coreSyn/MkCore.lhs @@ -86,6 +86,8 @@ import Pair import Constants import Data.Char ( ord ) +import Data.List +import Data.Ord import Data.Word infixl 4 `mkCoreApp`, `mkCoreApps` @@ -101,19 +103,14 @@ infixl 4 `mkCoreApp`, `mkCoreApps` sortQuantVars :: [Var] -> [Var] -- Sort the variables (KindVars, TypeVars, and Ids) -- into order: Type, then Kind, then Id -sortQuantVars = sortLe le +sortQuantVars = sortBy (comparing withCategory) where - v1 `le` v2 = case (is_tv v1, is_tv v2) of - (True, False) -> True - (False, True) -> False - (True, True) -> - case (is_kv v1, is_kv v2) of - (True, False) -> True - (False, True) -> False - _ -> v1 <= v2 -- Same family - (False, False) -> v1 <= v2 - is_tv v = isTyVar v - is_kv v = isKindVar v + withCategory v = (category v, v) + category :: Var -> Int + category v + | isTyVar v = 1 + | isKindVar v = 2 + | otherwise = 3 -- | Bind a binding group over an expression, using a @let@ or @case@ as -- appropriate (see "CoreSyn#let_app_invariant") |