Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jberryman
GHC
Commits
1a137b03
Commit
1a137b03
authored
Jun 22, 2012
by
Ian Lynagh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change more uses of sortLe to sortBy
parent
0043f07a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
30 deletions
+25
-30
compiler/codeGen/CgStackery.lhs
compiler/codeGen/CgStackery.lhs
+2
-1
compiler/codeGen/CgUtils.hs
compiler/codeGen/CgUtils.hs
+4
-6
compiler/codeGen/StgCmmUtils.hs
compiler/codeGen/StgCmmUtils.hs
+4
-7
compiler/hsSyn/HsBinds.lhs
compiler/hsSyn/HsBinds.lhs
+3
-3
compiler/rename/RnEnv.lhs
compiler/rename/RnEnv.lhs
+2
-1
compiler/simplStg/SRT.lhs
compiler/simplStg/SRT.lhs
+2
-2
compiler/specialise/Rules.lhs
compiler/specialise/Rules.lhs
+2
-3
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcDeriv.lhs
+2
-1
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcRnDriver.lhs
+3
-4
compiler/utils/ListSetOps.lhs
compiler/utils/ListSetOps.lhs
+1
-2
No files found.
compiler/codeGen/CgStackery.lhs
View file @
1a137b03
...
...
@@ -43,6 +43,7 @@ import OrdList
import Outputable
import Control.Monad
import Data.List
\end{code}
%************************************************************************
...
...
@@ -333,7 +334,7 @@ Explicitly free some stack space.
freeStackSlots :: [VirtualSpOffset] -> Code
freeStackSlots extra_free
= do { stk_usg <- getStkUsage
; let all_free = addFreeSlots (freeStk stk_usg) (sort
Le (<=)
extra_free)
; let all_free = addFreeSlots (freeStk stk_usg) (sort extra_free)
; let (new_vsp, new_free) = trim (virtSp stk_usg) all_free
; setStkUsage (stk_usg { virtSp = new_vsp, freeStk = new_free }) }
...
...
compiler/codeGen/CgUtils.hs
View file @
1a137b03
...
...
@@ -72,7 +72,9 @@ import Outputable
import
Data.Char
import
Data.Word
import
Data.List
import
Data.Maybe
import
Data.Ord
-------------------------------------------------------------------------
--
...
...
@@ -527,12 +529,10 @@ emitSwitch tag_expr branches mb_deflt lo_tag hi_tag
;
let
via_C
|
HscC
<-
hscTarget
dflags
=
True
|
otherwise
=
False
;
stmts
<-
mk_switch
tag_expr
(
sort
Le
le
branches
)
;
stmts
<-
mk_switch
tag_expr
(
sort
By
(
comparing
fst
)
branches
)
mb_deflt_id
lo_tag
hi_tag
via_C
;
emitCgStmts
stmts
}
where
(
t1
,
_
)
`
le
`
(
t2
,
_
)
=
t1
<=
t2
mk_switch
::
CmmExpr
->
[(
ConTagZ
,
CgStmts
)]
...
...
@@ -699,10 +699,8 @@ emitLitSwitch _ [] deflt = emitCgStmts deflt
emitLitSwitch
scrut
branches
deflt_blk
=
do
{
scrut'
<-
assignTemp
scrut
;
deflt_blk_id
<-
forkCgStmts
deflt_blk
;
blk
<-
mk_lit_switch
scrut'
deflt_blk_id
(
sort
Le
le
branches
)
;
blk
<-
mk_lit_switch
scrut'
deflt_blk_id
(
sort
By
(
comparing
fst
)
branches
)
;
emitCgStmts
blk
}
where
le
(
t1
,
_
)
(
t2
,
_
)
=
t1
<=
t2
mk_lit_switch
::
CmmExpr
->
BlockId
->
[(
Literal
,
CgStmts
)]
...
...
compiler/codeGen/StgCmmUtils.hs
View file @
1a137b03
...
...
@@ -79,6 +79,8 @@ import FastString
import
Outputable
import
Data.Char
import
Data.List
import
Data.Ord
import
Data.Word
import
Data.Maybe
...
...
@@ -574,14 +576,11 @@ mkCmmSwitch via_C tag_expr branches mb_deflt lo_tag hi_tag
label_branches
join_lbl
branches
$
\
branches
->
assignTemp'
tag_expr
$
\
tag_expr'
->
mk_switch
tag_expr'
(
sort
Le
le
branches
)
mb_deflt
mk_switch
tag_expr'
(
sort
By
(
comparing
fst
)
branches
)
mb_deflt
lo_tag
hi_tag
via_C
-- Sort the branches before calling mk_switch
<*>
mkLabel
join_lbl
where
(
t1
,
_
)
`
le
`
(
t2
,
_
)
=
t1
<=
t2
mk_switch
::
CmmExpr
->
[(
ConTagZ
,
BlockId
)]
->
Maybe
BlockId
->
ConTagZ
->
ConTagZ
->
Bool
...
...
@@ -731,10 +730,8 @@ mkCmmLitSwitch scrut branches deflt
withFreshLabel
"switch join"
$
\
join_lbl
->
label_code
join_lbl
deflt
$
\
deflt
->
label_branches
join_lbl
branches
$
\
branches
->
mk_lit_switch
scrut'
deflt
(
sort
Le
le
branches
)
mk_lit_switch
scrut'
deflt
(
sort
By
(
comparing
fst
)
branches
)
<*>
mkLabel
join_lbl
where
le
(
t1
,
_
)
(
t2
,
_
)
=
t1
<=
t2
mk_lit_switch
::
CmmExpr
->
BlockId
->
[(
Literal
,
BlockId
)]
...
...
compiler/hsSyn/HsBinds.lhs
View file @
1a137b03
...
...
@@ -34,13 +34,13 @@ import NameSet
import BasicTypes
import Outputable
import SrcLoc
import Util
import Var
import Bag
import FastString
import Data.Data hiding ( Fixity )
import Data.List ( intersect )
import Data.List
import Data.Ord
\end{code}
%************************************************************************
...
...
@@ -267,7 +267,7 @@ pprLHsBindsForUser binds sigs
decls = [(loc, ppr sig) | L loc sig <- sigs] ++
[(loc, ppr bind) | L loc bind <- bagToList binds]
sort_by_loc decls = sort
Le (\(l1,_) (l2,_) -> l1 <= l2
) decls
sort_by_loc decls = sort
By (comparing fst
) decls
pprDeclList :: [SDoc] -> SDoc -- Braces with a space
-- Print a bunch of declarations
...
...
compiler/rename/RnEnv.lhs
View file @
1a137b03
...
...
@@ -73,6 +73,7 @@ import ListSetOps ( removeDups )
import DynFlags
import FastString
import Control.Monad
import Data.List
import qualified Data.Set as Set
import Constants ( mAX_TUPLE_SIZE )
\end{code}
...
...
@@ -1641,7 +1642,7 @@ dupNamesErr get_loc names
where
locs = map get_loc names
big_loc = foldr1 combineSrcSpans locs
locations = ptext (sLit "Bound at:") <+> vcat (map ppr (sort
Le (<=)
locs))
locations = ptext (sLit "Bound at:") <+> vcat (map ppr (sort locs))
kindSigErr :: Outputable a => a -> SDoc
kindSigErr thing
...
...
compiler/simplStg/SRT.lhs
View file @
1a137b03
...
...
@@ -20,7 +20,7 @@ import Bitmap
import Outputable
import
Util
import
Data.List
\end{code}
\begin{code}
...
...
@@ -148,7 +148,7 @@ constructSRT table (SRTEntries entries)
where
ints = map (expectJust "constructSRT" . lookupVarEnv table)
(varSetElems entries)
sorted_ints = sort
Le (<=)
ints
sorted_ints = sort ints
offset = head sorted_ints
bitmap_entries = map (subtract offset) sorted_ints
len = last bitmap_entries + 1
...
...
compiler/specialise/Rules.lhs
View file @
1a137b03
...
...
@@ -54,6 +54,7 @@ import Maybes
import Bag
import Util
import Data.List
import Data.Ord
\end{code}
Note [Overall plumbing for rules]
...
...
@@ -239,10 +240,8 @@ pprRulesForUser :: [CoreRule] -> SDoc
pprRulesForUser rules
= withPprStyle defaultUserStyle $
pprRules $
sort
Le le_rule
$
sort
By (comparing ru_name)
$
tidyRules emptyTidyEnv rules
where
le_rule r1 r2 = ru_name r1 <= ru_name r2
\end{code}
...
...
compiler/typecheck/TcDeriv.lhs
View file @
1a137b03
...
...
@@ -62,6 +62,7 @@ import FastString
import Bag
import Control.Monad
import Data.List
\end{code}
%************************************************************************
...
...
@@ -1406,7 +1407,7 @@ inferInstanceContexts oflag infer_specs
-- Claim: the result instance declaration is guaranteed valid
-- Hence no need to call:
-- checkValidInstance tyvars theta clas inst_tys
; return (sort
Le (\p1 p2 -> cmpType p1 p2 /= GT)
theta) } -- Canonicalise before returning the solution
; return (sort
By cmpType
theta) } -- Canonicalise before returning the solution
where
the_pred = mkClassPred clas inst_tys
...
...
compiler/typecheck/TcRnDriver.lhs
View file @
1a137b03
...
...
@@ -82,6 +82,7 @@ import TcType ( orphNamesOfDFunHead )
import Inst ( tcGetInstEnvs )
import Data.List ( sortBy )
import Data.IORef ( readIORef )
import Data.Ord
#ifdef GHCI
import TcType ( isUnitTy, isTauTy )
...
...
@@ -1879,17 +1880,15 @@ ppr_fam_insts fam_insts =
ppr_sigs :: [Var] -> SDoc
ppr_sigs ids
-- Print type signatures; sort by OccName
= vcat (map ppr_sig (sort
Le le_sig
ids))
= vcat (map ppr_sig (sort
By (comparing getOccName)
ids))
where
le_sig id1 id2 = getOccName id1 <= getOccName id2
ppr_sig id = hang (ppr id <+> dcolon) 2 (ppr (tidyTopType (idType id)))
ppr_tydecls :: [TyCon] -> SDoc
ppr_tydecls tycons
-- Print type constructor info; sort by OccName
= vcat (map ppr_tycon (sort
Le le_sig
tycons))
= vcat (map ppr_tycon (sort
By (comparing getOccName)
tycons))
where
le_sig tycon1 tycon2 = getOccName tycon1 <= getOccName tycon2
ppr_tycon tycon = ppr (tyThingToIfaceDecl (ATyCon tycon))
ppr_rules :: [CoreRule] -> SDoc
...
...
compiler/utils/ListSetOps.lhs
View file @
1a137b03
...
...
@@ -113,10 +113,9 @@ equivClasses :: (a -> a -> Ordering) -- Comparison
equivClasses _ [] = []
equivClasses _ stuff@[_] = [stuff]
equivClasses cmp items = runs eq (sort
Le le
items)
equivClasses cmp items = runs eq (sort
By cmp
items)
where
eq a b = case cmp a b of { EQ -> True; _ -> False }
le a b = case cmp a b of { LT -> True; EQ -> True; GT -> False }
\end{code}
The first cases in @equivClasses@ above are just to cut to the point
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment