summaryrefslogtreecommitdiff
path: root/compiler/GHC/Hs/DocString.hs
diff options
context:
space:
mode:
authorZubin Duggal <zubin.duggal@gmail.com>2023-05-16 14:34:19 +0530
committerZubin Duggal <zubin.duggal@gmail.com>2023-05-17 12:21:31 +0530
commit17fcce4ca5bf1418d8f335e869d328e1913d3f95 (patch)
tree18f5adee7cbcc938d4a1dd9b359659ca161c4661 /compiler/GHC/Hs/DocString.hs
parent2972fd66f91cb51426a1df86b8166a067015e231 (diff)
downloadhaskell-wip/no-binary-char.tar.gz
compiler: Remove instance Binary Charwip/no-binary-char
It is generally not a good idea to serialise strings as [Char] into interface files, as upon deserialisation each of these would be turned into a highly memory inefficient structure mostly composed of cons cells and pointers. If you really want to serialise a Char, use the SerialisableChar newtype.
Diffstat (limited to 'compiler/GHC/Hs/DocString.hs')
-rw-r--r--compiler/GHC/Hs/DocString.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Hs/DocString.hs b/compiler/GHC/Hs/DocString.hs
index 8e42c4a8d8..d765eda92d 100644
--- a/compiler/GHC/Hs/DocString.hs
+++ b/compiler/GHC/Hs/DocString.hs
@@ -25,6 +25,7 @@ module GHC.Hs.DocString
import GHC.Prelude
+import GHC.Data.FastString
import GHC.Utils.Binary
import GHC.Utils.Encoding
import GHC.Utils.Outputable as Outputable hiding ((<>))
@@ -102,7 +103,7 @@ instance Binary HsDocString where
data HsDocStringDecorator
= HsDocStringNext -- ^ '|' is the decorator
| HsDocStringPrevious -- ^ '^' is the decorator
- | HsDocStringNamed !String -- ^ '$<string>' is the decorator
+ | HsDocStringNamed !LexicalFastString -- ^ '$<string>' is the decorator
| HsDocStringGroup !Int -- ^ The decorator is the given number of '*'s
deriving (Eq, Ord, Show, Data)
@@ -118,7 +119,7 @@ instance NFData HsDocStringDecorator where
printDecorator :: HsDocStringDecorator -> String
printDecorator HsDocStringNext = "|"
printDecorator HsDocStringPrevious = "^"
-printDecorator (HsDocStringNamed n) = '$':n
+printDecorator (HsDocStringNamed (LexicalFastString n)) = '$':unpackFS n
printDecorator (HsDocStringGroup n) = replicate n '*'
instance Binary HsDocStringDecorator where