diff options
author | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2014-07-11 13:54:45 +0200 |
---|---|---|
committer | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2015-09-03 05:55:15 +0200 |
commit | 374457809de343f409fbeea0a885877947a133a2 (patch) | |
tree | a354d0f4ddb6c32e6c85b853071d2107f6b8398c /compiler/utils/Outputable.hs | |
parent | bd16e0bc6af13f1347235782935f7dcd40b260e2 (diff) | |
download | haskell-374457809de343f409fbeea0a885877947a133a2.tar.gz |
Injective type families
For details see #6018, Phab:D202 and the wiki page:
https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies
This patch also wires-in Maybe data type and updates haddock submodule.
Test Plan: ./validate
Reviewers: simonpj, goldfire, austin, bgamari
Subscribers: mpickering, bgamari, alanz, thomie, goldfire, simonmar,
carter
Differential Revision: https://phabricator.haskell.org/D202
GHC Trac Issues: #6018
Diffstat (limited to 'compiler/utils/Outputable.hs')
-rw-r--r-- | compiler/utils/Outputable.hs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/compiler/utils/Outputable.hs b/compiler/utils/Outputable.hs index 93645d38fe..cb42d75327 100644 --- a/compiler/utils/Outputable.hs +++ b/compiler/utils/Outputable.hs @@ -32,7 +32,8 @@ module Outputable ( sep, cat, fsep, fcat, hang, punctuate, ppWhen, ppUnless, - speakNth, speakNTimes, speakN, speakNOf, plural, isOrAre, + speakNth, speakNTimes, speakN, speakNOf, plural, + thirdPerson, isOrAre, doOrDoes, coloured, PprColour, colType, colCoerc, colDataCon, colBinder, bold, keyword, @@ -994,6 +995,16 @@ plural :: [a] -> SDoc plural [_] = empty -- a bit frightening, but there you are plural _ = char 's' +-- | Determines the suffix to use in 3rd person singular depending on the length +-- of a list: +-- +-- > thirdPerson [] = empty +-- > thirdPerson ["Hello"] = char 's' +-- > thirdPerson ["Hello", "World"] = empty +thirdPerson :: [a] -> SDoc +thirdPerson [_] = char 's' +thirdPerson _ = empty + -- | Determines the form of to be appropriate for the length of a list: -- -- > isOrAre [] = ptext (sLit "are") @@ -1003,6 +1014,15 @@ isOrAre :: [a] -> SDoc isOrAre [_] = ptext (sLit "is") isOrAre _ = ptext (sLit "are") +-- | Determines the form of to do appropriate for the length of a list: +-- +-- > doOrDoes [] = ptext (sLit "do") +-- > doOrDoes ["Hello"] = ptext (sLit "does") +-- > doOrDoes ["Hello", "World"] = ptext (sLit "do") +doOrDoes :: [a] -> SDoc +doOrDoes [_] = ptext (sLit "does") +doOrDoes _ = ptext (sLit "do") + {- ************************************************************************ * * |