diff options
author | David Feuer <David.Feuer@gmail.com> | 2014-10-01 23:34:29 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-10-02 22:13:29 +0200 |
commit | 9bf5228fdc1937f44901a945553eea3cb0f14faa (patch) | |
tree | 243925bae6f8869cca1df8595c17c0467b9d5998 /libraries/base/GHC/Windows.hs | |
parent | d6d5c127b86dc186b25add2843cb83fc12e72a85 (diff) | |
download | haskell-9bf5228fdc1937f44901a945553eea3cb0f14faa.tar.gz |
Use dropWhileEndLE p instead of reverse . dropWhile p . reverse
Summary: Using `dropWhileEndLE` tends to be faster and easier to read
than the `reverse . dropWhile p . reverse` idiom. This also cleans up
some other, nearby, messes. Fix #9616 (incorrect number formatting
potentially leading to incorrect numbers in output).
Test Plan: Run validate
Reviewers: thomie, rwbarton, nomeata, austin
Reviewed By: nomeata, austin
Subscribers: simonmar, ezyang, carter, thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D259
GHC Trac Issues: #9623, #9616
Conflicts:
compiler/basicTypes/OccName.lhs
Diffstat (limited to 'libraries/base/GHC/Windows.hs')
-rw-r--r-- | libraries/base/GHC/Windows.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libraries/base/GHC/Windows.hs b/libraries/base/GHC/Windows.hs index 0a57fc3368..83f83df949 100644 --- a/libraries/base/GHC/Windows.hs +++ b/libraries/base/GHC/Windows.hs @@ -69,6 +69,7 @@ import GHC.Base import GHC.IO import GHC.Num import System.IO.Error +import Util import qualified Numeric @@ -120,7 +121,7 @@ errCodeToIOError fn_name err_code = do -- XXX we should really do this directly. let errno = c_maperrno_func err_code - let msg' = reverse $ dropWhile isSpace $ reverse msg -- drop trailing \n + let msg' = dropWhileEndLE isSpace msg -- drop trailing \n ioerror = errnoToIOError fn_name errno Nothing Nothing `ioeSetErrorString` msg' return ioerror |