diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2023-05-16 14:34:19 +0530 |
---|---|---|
committer | Zubin Duggal <zubin.duggal@gmail.com> | 2023-05-17 12:21:31 +0530 |
commit | 17fcce4ca5bf1418d8f335e869d328e1913d3f95 (patch) | |
tree | 18f5adee7cbcc938d4a1dd9b359659ca161c4661 /compiler/GHC/Iface/Binary.hs | |
parent | 2972fd66f91cb51426a1df86b8166a067015e231 (diff) | |
download | haskell-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/Iface/Binary.hs')
-rw-r--r-- | compiler/GHC/Iface/Binary.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/GHC/Iface/Binary.hs b/compiler/GHC/Iface/Binary.hs index a1611fe263..815ee817e4 100644 --- a/compiler/GHC/Iface/Binary.hs +++ b/compiler/GHC/Iface/Binary.hs @@ -106,12 +106,12 @@ readBinIfaceHeader profile _name_cache checkHiWay traceBinIFace hi_path = do (unFixedLength $ binaryInterfaceMagic platform) (unFixedLength magic) -- Check the interface file version and profile tag. - check_ver <- get bh + check_ver <- map getSerialisedChar <$> get bh let our_ver = show hiVersion wantedGot "Version" our_ver check_ver text errorOnMismatch "mismatched interface file versions" our_ver check_ver - check_tag <- get bh + check_tag <- map getSerialisedChar <$> get bh let tag = profileBuildTag profile wantedGot "Way" tag check_tag text when (checkHiWay == CheckHiWay) $ @@ -179,8 +179,8 @@ writeBinIface profile traceBinIface hi_path mod_iface = do put_ bh (binaryInterfaceMagic platform) -- The version, profile tag, and source hash go next - put_ bh (show hiVersion) - let tag = profileBuildTag profile + put_ bh (map SerialisableChar $ show hiVersion) + let tag = map SerialisableChar $ profileBuildTag profile put_ bh tag put_ bh (mi_src_hash mod_iface) |