summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Outputable.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Utils/Outputable.hs')
-rw-r--r--compiler/GHC/Utils/Outputable.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/Utils/Outputable.hs b/compiler/GHC/Utils/Outputable.hs
index fd065266d6..1c6126d208 100644
--- a/compiler/GHC/Utils/Outputable.hs
+++ b/compiler/GHC/Utils/Outputable.hs
@@ -121,6 +121,7 @@ import GHC.Utils.Ppr ( Doc, Mode(..) )
import GHC.Serialized
import GHC.LanguageExtensions (Extension)
import GHC.Utils.GlobalVars( unsafeHasPprDebug )
+import GHC.Utils.Misc (lastMaybe)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
@@ -716,7 +717,7 @@ quotes d = sdocOption sdocCanUseUnicode $ \case
in case str of
[] -> Pretty.quotes pp_d
'\'' : _ -> pp_d
- _ | '\'' <- last str -> pp_d
+ _ | Just '\'' <- lastMaybe str -> pp_d
| otherwise -> Pretty.quotes pp_d
semi, comma, colon, equals, space, dcolon, underscore, dot, vbar :: SDoc