Commit fc53d365 authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

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
parent c4a9dcad
......@@ -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) == '_'
{-
************************************************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment