summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-11-14 19:30:50 +0100
committerKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2022-11-14 19:55:00 +0100
commitd56816049e028b525e80e207cf87bb2e1aa194fc (patch)
treeedcc1bb91949144bb4b85bd4d7c49869277c895d /compiler/GHC/Utils
parent268a3ce952f6be00a1dd164dc4d7acb346045e90 (diff)
downloadhaskell-wip/misc-cleanup2.tar.gz
Misc cleanupwip/misc-cleanup2
* Replace catMaybes . map f with mapMaybe f * Use concatFS to concatenate multiple FastStrings * Fix documentation of -exclude-module * Cleanup getIgnoreCount in GHCi.UI
Diffstat (limited to 'compiler/GHC/Utils')
-rw-r--r--compiler/GHC/Utils/Json.hs2
-rw-r--r--compiler/GHC/Utils/Lexeme.hs18
2 files changed, 10 insertions, 10 deletions
diff --git a/compiler/GHC/Utils/Json.hs b/compiler/GHC/Utils/Json.hs
index acccc88658..47f599c950 100644
--- a/compiler/GHC/Utils/Json.hs
+++ b/compiler/GHC/Utils/Json.hs
@@ -24,7 +24,7 @@ renderJSON :: JsonDoc -> SDoc
renderJSON d =
case d of
JSNull -> text "null"
- JSBool b -> text $ if b then "true" else "false"
+ JSBool b -> if b then text "true" else text "false"
JSInt n -> ppr n
JSString s -> doubleQuotes $ text $ escapeJsonString s
JSArray as -> brackets $ pprList renderJSON as
diff --git a/compiler/GHC/Utils/Lexeme.hs b/compiler/GHC/Utils/Lexeme.hs
index f71bf1674a..ef7a076faf 100644
--- a/compiler/GHC/Utils/Lexeme.hs
+++ b/compiler/GHC/Utils/Lexeme.hs
@@ -67,17 +67,17 @@ isLexId cs = isLexConId cs || isLexVarId cs
isLexSym cs = isLexConSym cs || isLexVarSym cs
-------------
-isLexConId cs = case unconsFS cs of -- Prefix type or data constructors
- Nothing -> False -- e.g. "Foo", "[]", "(,)"
- Just (c, _) -> cs == fsLit "[]" || startsConId c
+isLexConId cs = case unpackFS cs of -- Prefix type or data constructors
+ [] -> False -- e.g. "Foo", "[]", "(,)"
+ c:_ -> cs == fsLit "[]" || startsConId c
-isLexVarId cs = case unconsFS cs of -- Ordinary prefix identifiers
- Nothing -> False -- e.g. "x", "_x"
- Just (c, _) -> startsVarId c
+isLexVarId cs = case unpackFS cs of -- Ordinary prefix identifiers
+ [] -> False -- e.g. "x", "_x"
+ c:_ -> startsVarId c
-isLexConSym cs = case unconsFS cs of -- Infix type or data constructors
- Nothing -> False -- e.g. ":-:", ":", "->"
- Just (c, _) -> cs == fsLit "->" || startsConSym c
+isLexConSym cs = case unpackFS cs of -- Infix type or data constructors
+ [] -> False -- e.g. ":-:", ":", "->"
+ c:_ -> cs == fsLit "->" || startsConSym c
isLexVarSym fs -- Infix identifiers e.g. "+"
| fs == (fsLit "~R#") = True