diff options
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/Outputable.lhs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index da8ffb3f10..f357208077 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -32,7 +32,7 @@ module Outputable ( sep, cat, fsep, fcat, hang, punctuate, ppWhen, ppUnless, - speakNth, speakNTimes, speakN, speakNOf, plural, + speakNth, speakNTimes, speakN, speakNOf, plural, isOrAre, coloured, PprColour, colType, colCoerc, colDataCon, colBinder, bold, keyword, @@ -908,6 +908,15 @@ speakNTimes t | t == 1 = ptext (sLit "once") plural :: [a] -> SDoc plural [_] = empty -- a bit frightening, but there you are plural _ = char 's' + +-- | Determines the form of to be appropriate for the length of a list: +-- +-- > isOrAre [] = ptext (sLit "are") +-- > isOrAre ["Hello"] = ptext (sLit "is") +-- > isOrAre ["Hello", "World"] = ptext (sLit "are") +isOrAre :: [a] -> SDoc +isOrAre [_] = ptext (sLit "is") +isOrAre _ = ptext (sLit "are") \end{code} |