summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
authorArthur Fayzrakhmanov (Артур Файзрахманов) <heraldhoi@gmail.com>2016-01-17 19:27:12 +0100
committerBen Gamari <ben@smart-cactus.org>2016-01-17 23:40:42 +0100
commitb3eb8fad4c9d5aa293e197bfff7039d6fa112a54 (patch)
tree32ba92be0948b5e105535a4247937231ae33372c /libraries/base
parentd1ce1aa9beed4d3ecd3a0324ae4c98625fbe8d33 (diff)
downloadhaskell-b3eb8fad4c9d5aa293e197bfff7039d6fa112a54.tar.gz
Complete operators properly
Fix operator completions: list of suitable completions only rather than everything from imported modules. Signed-off-by: Arthur Fayzrakhmanov (Артур Файзрахманов) <heraldhoi@gmail.com> ghc: fix operator completions Reviewers: austin, hvr, thomie, bgamari Reviewed By: thomie, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1058 GHC Trac Issues: #10576
Diffstat (limited to 'libraries/base')
-rw-r--r--libraries/base/Text/Read/Lex.hs27
1 files changed, 15 insertions, 12 deletions
diff --git a/libraries/base/Text/Read/Lex.hs b/libraries/base/Text/Read/Lex.hs
index ed4d204c86..7054be9d79 100644
--- a/libraries/base/Text/Read/Lex.hs
+++ b/libraries/base/Text/Read/Lex.hs
@@ -30,6 +30,8 @@ module Text.Read.Lex
, readOctP
, readDecP
, readHexP
+
+ , isSymbolChar
)
where
@@ -214,18 +216,19 @@ lexSymbol =
return (Punc s) -- Reserved-ops count as punctuation
else
return (Symbol s)
- where
- isSymbolChar c = not (isPuncChar c) && case generalCategory c of
- MathSymbol -> True
- CurrencySymbol -> True
- ModifierSymbol -> True
- OtherSymbol -> True
- DashPunctuation -> True
- OtherPunctuation -> not (c `elem` "'\"")
- ConnectorPunctuation -> c /= '_'
- _ -> False
- reserved_ops = ["..", "::", "=", "\\", "|", "<-", "->", "@", "~", "=>"]
-
+ where
+ reserved_ops = ["..", "::", "=", "\\", "|", "<-", "->", "@", "~", "=>"]
+
+isSymbolChar :: Char -> Bool
+isSymbolChar c = not (isPuncChar c) && case generalCategory c of
+ MathSymbol -> True
+ CurrencySymbol -> True
+ ModifierSymbol -> True
+ OtherSymbol -> True
+ DashPunctuation -> True
+ OtherPunctuation -> not (c `elem` "'\"")
+ ConnectorPunctuation -> c /= '_'
+ _ -> False
-- ----------------------------------------------------------------------
-- identifiers