Skip to content

Commit

Permalink
GHC-9.8 compatibility: Different module names for Foldable and Real
Browse files Browse the repository at this point in the history
  • Loading branch information
gergoerdi committed Oct 16, 2024
1 parent dc25324 commit 2825dc1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 0 additions & 2 deletions liquidhaskell-boot/src-ghc/Liquid/GHC/API.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,12 @@ import GHC.Builtin.Names as Ghc
, Unique
, and_RDR
, bindMName
, gHC_INTERNAL_DATA_FOLDABLE
, eqClassKey
, eqClassName
, ge_RDR
, gt_RDR
, fractionalClassKey
, fractionalClassKeys
, gHC_INTERNAL_REAL
, getUnique
, hasKey
, isStringClassName
Expand Down
14 changes: 14 additions & 0 deletions liquidhaskell-boot/src-ghc/Liquid/GHC/API/Compat.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
module Liquid.GHC.API.Compat (
UniqueId
, toUniqueId

, foldableModule
, realModule
) where

import Data.Word (Word64)
import qualified GHC.Builtin.Names as Ghc
import GHC (Module)

----------------------
-- Uniques
Expand All @@ -13,3 +18,12 @@ type UniqueId = Word64

toUniqueId :: Word64 -> UniqueId
toUniqueId = id

----------------------
-- Built-in modules
----------------------

foldableModule, realModule :: Module

foldableModule = Ghc.gHC_INTERNAL_DATA_FOLDABLE
realModule = Ghc.gHC_INTERNAL_REAL
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ fixExprToHsExpr env (F.PAnd (e : es)) = L.foldr f (fixExprToHsExpr env e) es
-- (nlHsVar (varQual_RDR dATA_FOLDABLE (fsLit "and")))
-- (nlList $ fixExprToHsExpr env <$> es)
fixExprToHsExpr env (F.POr es) = mkHsApp
(nlHsVar (varQual_RDR gHC_INTERNAL_DATA_FOLDABLE (fsLit "or")))
(nlHsVar (varQual_RDR foldableModule (fsLit "or")))
(nlList $ fixExprToHsExpr env <$> es)
fixExprToHsExpr env (F.PIff e0 e1) = mkHsApp
(mkHsApp (nlHsVar (mkVarUnqual (mkFastString "<=>"))) (fixExprToHsExpr env e0)
Expand Down
4 changes: 2 additions & 2 deletions liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Misc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ withWiredIn m = discardConstraints $ do
return $ TcWiredIn n Nothing ty

prependGHCRealQual :: FastString -> RdrName
prependGHCRealQual = varQual_RDR gHC_INTERNAL_REAL
prependGHCRealQual = varQual_RDR realModule

isFromGHCReal :: NamedThing a => a -> Bool
isFromGHCReal x = Ghc.nameModule (Ghc.getName x) == gHC_INTERNAL_REAL
isFromGHCReal x = Ghc.nameModule (Ghc.getName x) == realModule

0 comments on commit 2825dc1

Please sign in to comment.