diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-07-08 14:09:36 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-07-08 15:06:23 +0200 |
commit | fc53d3658ad87073fbdc080f05ad3ac01d1ec59a (patch) | |
tree | 4c51c2cd522c500b449d2b91788122ac45ee6d3c | |
parent | c4a9dcad885a7bbe0f60b7bef39a7d1789eae5e9 (diff) | |
download | haskell-fc53d3658ad87073fbdc080f05ad3ac01d1ec59a.tar.gz |
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
-rw-r--r-- | compiler/basicTypes/OccName.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs index 6a5c489d9f..caaf90bae3 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) == '_' {- ************************************************************************ |