summaryrefslogtreecommitdiff
path: root/compiler/utils/Outputable.hs
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@richarde.dev>2019-12-11 15:58:56 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-01-12 21:29:27 -0500
commit350e2b78788d47255d27489dfc62d664498b5de4 (patch)
tree50f2f1982c9f120e6b8aac1970579d34333cd16a /compiler/utils/Outputable.hs
parent9129210f7e9937c1065330295f06524661575839 (diff)
downloadhaskell-350e2b78788d47255d27489dfc62d664498b5de4.tar.gz
Don't zap to Any; error instead
This changes GHC's treatment of so-called Naughty Quantification Candidates to issue errors, instead of zapping to Any. Close #16775. No new test cases, because existing ones cover this well.
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r--compiler/utils/Outputable.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs
index d81c754866..02805c6c7c 100644
--- a/compiler/utils/Outputable.hs
+++ b/compiler/utils/Outputable.hs
@@ -34,7 +34,7 @@ module Outputable (
sep, cat,
fsep, fcat,
hang, hangNotEmpty, punctuate, ppWhen, ppUnless,
- speakNth, speakN, speakNOf, plural, isOrAre, doOrDoes,
+ speakNth, speakN, speakNOf, plural, isOrAre, doOrDoes, itsOrTheir,
unicodeSyntax,
coloured, keyword,
@@ -1160,6 +1160,15 @@ doOrDoes :: [a] -> SDoc
doOrDoes [_] = text "does"
doOrDoes _ = text "do"
+-- | Determines the form of possessive appropriate for the length of a list:
+--
+-- > itsOrTheir [x] = text "its"
+-- > itsOrTheir [x,y] = text "their"
+-- > itsOrTheir [] = text "their" -- probably avoid this
+itsOrTheir :: [a] -> SDoc
+itsOrTheir [_] = text "its"
+itsOrTheir _ = text "their"
+
{-
************************************************************************
* *