summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Session.hs
diff options
context:
space:
mode:
authorM Farkas-Dyck <strake888@proton.me>2022-09-29 01:03:13 -0800
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-19 10:46:29 -0400
commit83638dce4e20097b9b7073534e488a92dce6e88f (patch)
treee18b4b2484354c8875914a4b35a37d0377258eb4 /compiler/GHC/Driver/Session.hs
parentf7b7a3122185222d5059e37315991afcf319e43c (diff)
downloadhaskell-83638dce4e20097b9b7073534e488a92dce6e88f.tar.gz
Scrub various partiality involving lists (again).
Lets us avoid some use of `head` and `tail`, and some panics.
Diffstat (limited to 'compiler/GHC/Driver/Session.hs')
-rw-r--r--compiler/GHC/Driver/Session.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs
index 836ad88005..19b874dcf7 100644
--- a/compiler/GHC/Driver/Session.hs
+++ b/compiler/GHC/Driver/Session.hs
@@ -4467,12 +4467,11 @@ setCallerCcFilters arg =
setMainIs :: String -> DynP ()
setMainIs arg
- | not (null main_fn) && isLower (head main_fn)
- -- The arg looked like "Foo.Bar.baz"
+ | x:_ <- main_fn, isLower x -- The arg looked like "Foo.Bar.baz"
= upd $ \d -> d { mainFunIs = Just main_fn,
mainModuleNameIs = mkModuleName main_mod }
- | isUpper (head arg) -- The arg looked like "Foo" or "Foo.Bar"
+ | x:_ <- arg, isUpper x -- The arg looked like "Foo" or "Foo.Bar"
= upd $ \d -> d { mainModuleNameIs = mkModuleName arg }
| otherwise -- The arg looked like "baz"