Skip to content

Commit ceef935

Browse files
binary heap halfword fix (#615)
1 parent d65e774 commit ceef935

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

ghc-lib-gen/src/Ghclibgen.hs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -856,22 +856,31 @@ applyPatchGHCiMessage ghcFlavor =
856856
"#if MIN_VERSION_ghc_heap(8,11,0)"
857857
(unlines rs <> "#if MIN_VERSION_ghc_heap(8,11,0)")
858858
. replace
859-
(unlines
860-
[ "#if MIN_VERSION_ghc_internal(9,1500,0)"
861-
, "instance Binary Heap.HalfWord where"
862-
, " put x = put (fromIntegral x :: Word32)"
863-
, " get = fromIntegral <$> (get :: Get Word32)"
864-
, "#endif"
865-
])
866-
(unlines
867-
[ "instance Binary Heap.HalfWord where"
868-
, " put x = put (fromIntegral x :: Word32)"
869-
, " get = fromIntegral <$> (get :: Get Word32)"
870-
])
859+
(unlines $
860+
[ "#if MIN_VERSION_ghc_internal(9,1500,0)"] ++
861+
binaryHeapHalfWordInstanceLines ++
862+
["#endif"]
863+
)
864+
binaryHeapHalfWordInstance
865+
. replace
866+
(unlines $
867+
[ "#if MIN_VERSION_GLASGOW_HASKELL(9,12,2,20250919)"] ++
868+
binaryHeapHalfWordInstanceLines ++
869+
["#endif"]
870+
)
871+
binaryHeapHalfWordInstance
871872
=<< readFile' messageHs
872873
where
873874
messageHs = "libraries/ghci/GHCi/Message.hs"
874875

876+
binaryHeapHalfWordInstanceLines =
877+
[ "instance Binary Heap.HalfWord where"
878+
, " put x = put (fromIntegral x :: Word32)"
879+
, " get = fromIntegral <$> (get :: Get Word32)"
880+
]
881+
882+
binaryHeapHalfWordInstance = unlines binaryHeapHalfWordInstanceLines
883+
875884
applyPatchHaddockHs :: GhcFlavor -> IO ()
876885
applyPatchHaddockHs ghcFlavor = do
877886
-- See https://github.com/ndmitchell/hlint/issues/1224

0 commit comments

Comments
 (0)