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
4,319
Issues
4,319
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
368
Merge Requests
368
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
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
Glasgow Haskell Compiler
GHC
Commits
d6d5c127
Commit
d6d5c127
authored
Oct 02, 2014
by
Austin Seipp
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Use dropWhileEndLE p instead of reverse . dropWhile p . reverse"
This reverts commit
2a885688
.
parent
35672072
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
41 deletions
+9
-41
compiler/basicTypes/OccName.lhs
compiler/basicTypes/OccName.lhs
+1
-1
compiler/utils/Util.lhs
compiler/utils/Util.lhs
+1
-15
libraries/base/GHC/Windows.hs
libraries/base/GHC/Windows.hs
+1
-2
utils/hpc/HpcMarkup.hs
utils/hpc/HpcMarkup.hs
+6
-19
utils/hpc/HpcUtils.hs
utils/hpc/HpcUtils.hs
+0
-4
No files found.
compiler/basicTypes/OccName.lhs
View file @
d6d5c127
...
...
@@ -833,7 +833,7 @@ tidyOccName env occ@(OccName occ_sp fs)
Nothing -> (addToUFM env fs 1, occ)
where
base :: String -- Drop trailing digits (see Note [TidyOccEnv])
base =
dropWhileEndLE isDigit (unpackFS fs
)
base =
reverse (dropWhile isDigit (reverse (unpackFS fs))
)
find n
= case lookupUFM env new_fs of
...
...
compiler/utils/Util.lhs
View file @
d6d5c127
...
...
@@ -23,8 +23,6 @@ module Util (
mapAndUnzip, mapAndUnzip3, mapAccumL2,
nOfThem, filterOut, partitionWith, splitEithers,
dropWhileEndLE,
foldl1', foldl2, count, all2,
lengthExceeds, lengthIs, lengthAtLeast,
...
...
@@ -595,18 +593,6 @@ dropTail n xs
go _ _ = [] -- Stop when ys runs out
-- It'll always run out before xs does
-- dropWhile from the end of a list. This is similar to Data.List.dropWhileEnd,
-- but is lazy in the elements and strict in the spine. For reasonably short lists,
-- such as path names and typical lines of text, dropWhileEndLE is generally
-- faster than dropWhileEnd. Its advantage is magnified when the predicate is
-- expensive--using dropWhileEndLE isSpace to strip the space off a line of text
-- is generally much faster than using dropWhileEnd isSpace for that purpose.
-- Specification: dropWhileEndLE p = reverse . dropWhile p . reverse
-- Pay attention to the short-circuit (&&)! The order of its arguments is the only
-- difference between dropWhileEnd and dropWhileEndLE.
dropWhileEndLE :: (a -> Bool) -> [a] -> [a]
dropWhileEndLE p = foldr (\x r -> if null r && p x then [] else x:r) []
snocView :: [a] -> Maybe ([a],a)
-- Split off the last element
snocView [] = Nothing
...
...
@@ -665,7 +651,7 @@ cmpList cmp (a:as) (b:bs)
\begin{code}
removeSpaces :: String -> String
removeSpaces =
dropWhileEndLE isSpac
e . dropWhile isSpace
removeSpaces =
reverse . dropWhile isSpace . revers
e . dropWhile isSpace
\end{code}
%************************************************************************
...
...
libraries/base/GHC/Windows.hs
View file @
d6d5c127
...
...
@@ -69,7 +69,6 @@ import GHC.Base
import
GHC.IO
import
GHC.Num
import
System.IO.Error
import
Util
import
qualified
Numeric
...
...
@@ -121,7 +120,7 @@ errCodeToIOError fn_name err_code = do
-- XXX we should really do this directly.
let
errno
=
c_maperrno_func
err_code
let
msg'
=
dropWhileEndLE
isSpac
e
msg
-- drop trailing \n
let
msg'
=
reverse
$
dropWhile
isSpace
$
revers
e
msg
-- drop trailing \n
ioerror
=
errnoToIOError
fn_name
errno
Nothing
Nothing
`
ioeSetErrorString
`
msg'
return
ioerror
...
...
utils/hpc/HpcMarkup.hs
View file @
d6d5c127
...
...
@@ -140,16 +140,6 @@ charEncodingTag =
"<meta http-equiv=
\"
Content-Type
\"
"
++
"content=
\"
text/html; "
++
"charset="
++
show
localeEncoding
++
"
\"
>"
-- Add characters to the left of a string until it is at least as
-- large as requested.
padLeft
::
Int
->
Char
->
String
->
String
padLeft
n
c
str
=
go
n
str
where
-- If the string is already long enough, stop traversing it.
go
0
_
=
str
go
k
[]
=
replicate
k
c
++
str
go
k
(
_
:
xs
)
=
go
(
k
-
1
)
xs
genHtmlFromMod
::
String
->
Flags
...
...
@@ -220,7 +210,8 @@ genHtmlFromMod dest_dir flags tix theFunTotals invertOutput = do
content
<-
readFileFromPath
(
hpcError
markup_plugin
)
origFile
theHsPath
let
content'
=
markup
tabStop
info
content
let
addLine
n
xs
=
"<span class=
\"
lineno
\"
>"
++
padLeft
5
' '
(
show
n
)
++
" </span>"
++
xs
let
show'
=
reverse
.
take
5
.
(
++
" "
)
.
reverse
.
show
let
addLine
n
xs
=
"<span class=
\"
lineno
\"
>"
++
show'
n
++
" </span>"
++
xs
let
addLines
=
unlines
.
map
(
uncurry
addLine
)
.
zip
[
1
::
Int
..
]
.
lines
let
fileName
=
modName0
++
".hs.html"
putStrLn
$
"Writing: "
++
fileName
...
...
@@ -372,14 +363,10 @@ openTick (TopLevelDecl True 1)
openTick
(
TopLevelDecl
True
n0
)
=
"<span class=
\"
funcount
\"
>-- entered "
++
showBigNum
n0
++
" times</span>"
++
openTopDecl
where
showBigNum
n
|
n
<=
9999
=
show
n
|
otherwise
=
case
n
`
quotRem
`
1000
of
(
q
,
r
)
->
showBigNum'
q
++
","
++
showWith
r
|
otherwise
=
showBigNum'
(
n
`
div
`
1000
)
++
","
++
showWith
(
n
`
mod
`
1000
)
showBigNum'
n
|
n
<=
999
=
show
n
|
otherwise
=
case
n
`
quotRem
`
1000
of
(
q
,
r
)
->
showBigNum'
q
++
","
++
showWith
r
showWith
n
=
padLeft
3
'0'
$
show
n
|
otherwise
=
showBigNum'
(
n
`
div
`
1000
)
++
","
++
showWith
(
n
`
mod
`
1000
)
showWith
n
=
take
3
$
reverse
$
(
"000"
++
)
$
reverse
$
show
n
closeTick
::
String
closeTick
=
"</span>"
...
...
@@ -475,7 +462,7 @@ instance Monoid ModuleSummary where
writeFileUsing
::
String
->
String
->
IO
()
writeFileUsing
filename
text
=
do
let
dest_dir
=
dropWhileEndLE
(
\
x
->
x
/=
'/'
)
$
filename
let
dest_dir
=
reverse
.
dropWhile
(
\
x
->
x
/=
'/'
)
.
reverse
$
filename
-- We need to check for the dest_dir each time, because we use sub-dirs for
-- packages, and a single .tix file might contain information about
...
...
utils/hpc/HpcUtils.hs
View file @
d6d5c127
...
...
@@ -3,10 +3,6 @@ module HpcUtils where
import
Trace.Hpc.Util
import
qualified
Data.Map
as
Map
dropWhileEndLE
::
(
a
->
Bool
)
->
[
a
]
->
[
a
]
-- Spec: dropWhileEndLE p = reverse . dropWhileEnd . reverse
dropWhileEndLE
p
=
foldr
(
\
x
r
->
if
null
r
&&
p
x
then
[]
else
x
:
r
)
[]
-- turns \n into ' '
-- | grab's the text behind a HpcPos;
grabHpcPos
::
Map
.
Map
Int
String
->
HpcPos
->
String
...
...
Joachim Breitner
@nomeata
mentioned in issue
#9623 (closed)
·
Sep 21, 2014
mentioned in issue
#9623 (closed)
mentioned in issue #9623
Toggle commit list
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