[commit: ghc] master: OccName: Implement startsWithUnderscore in terms of headFS (fc53d36)
git at git.haskell.org
git at git.haskell.org
Fri Jul 8 13:02:14 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/fc53d3658ad87073fbdc080f05ad3ac01d1ec59a/ghc
>---------------------------------------------------------------
commit fc53d3658ad87073fbdc080f05ad3ac01d1ec59a
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Fri Jul 8 14:09:36 2016 +0200
OccName: Implement startsWithUnderscore in terms of headFS
This avoids decoding the entire string just to look at the first
character.
Test Plan: Validate
Reviewers: austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2388
>---------------------------------------------------------------
fc53d3658ad87073fbdc080f05ad3ac01d1ec59a
compiler/basicTypes/OccName.hs | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs
index 6a5c489..caaf90b 100644
--- a/compiler/basicTypes/OccName.hs
+++ b/compiler/basicTypes/OccName.hs
@@ -521,9 +521,7 @@ parenSymOcc occ doc | isSymOcc occ = parens doc
startsWithUnderscore :: OccName -> Bool
-- ^ Haskell 98 encourages compilers to suppress warnings about unsed
-- names in a pattern if they start with @_@: this implements that test
-startsWithUnderscore occ = case occNameString occ of
- ('_' : _) -> True
- _other -> False
+startsWithUnderscore occ = headFS (occNameFS occ) == '_'
{-
************************************************************************
More information about the ghc-commits
mailing list