summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2022-05-25 10:25:15 +0200
committerdoyougnu <jeffrey.young@iohk.io>2022-06-13 13:42:45 -0400
commitdc1c712ed69a832dd96e9aefb516c0b178ccc40b (patch)
treefe0a15613cd0a31a7900b57a154c7eccfe72611a
parent64a632204fd7a380fb6bab4b9a0d6ae572cd6fc1 (diff)
downloadhaskell-dc1c712ed69a832dd96e9aefb516c0b178ccc40b.tar.gz
Outputable: add ShortText instance
-rw-r--r--compiler/GHC/Utils/Outputable.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Outputable.hs b/compiler/GHC/Utils/Outputable.hs
index 032c8502f8..841e67f75b 100644
--- a/compiler/GHC/Utils/Outputable.hs
+++ b/compiler/GHC/Utils/Outputable.hs
@@ -112,6 +112,7 @@ import {-# SOURCE #-} GHC.Types.Name.Occurrence( OccName )
import GHC.Utils.BufHandle (BufHandle)
import GHC.Data.FastString
+import GHC.Data.ShortText (ShortText)
import qualified GHC.Utils.Ppr as Pretty
import qualified GHC.Utils.Ppr.Colour as Col
import GHC.Utils.Ppr ( Doc, Mode(..) )
@@ -642,6 +643,7 @@ empty :: SDoc
char :: Char -> SDoc
text :: String -> SDoc
ftext :: FastString -> SDoc
+stext :: ShortText -> SDoc
ptext :: PtrString -> SDoc
ztext :: FastZString -> SDoc
int :: Int -> SDoc
@@ -661,6 +663,8 @@ text s = docToSDoc $ Pretty.text s
{-# INLINE CONLIKE ftext #-}
ftext s = docToSDoc $ Pretty.ftext s
+{-# INLINE CONLIKE stext #-}
+stext s = docToSDoc $ Pretty.stext s
{-# INLINE CONLIKE ptext #-}
ptext s = docToSDoc $ Pretty.ptext s
{-# INLINE CONLIKE ztext #-}
@@ -1019,6 +1023,9 @@ instance Outputable FastString where
deriving newtype instance Outputable NonDetFastString
deriving newtype instance Outputable LexicalFastString
+instance Outputable ShortText where
+ ppr s = stext s
+
instance (Outputable key, Outputable elt) => Outputable (M.Map key elt) where
ppr m = ppr (M.toList m)