diff --git a/liquidhaskell-boot/liquidhaskell-boot.cabal b/liquidhaskell-boot/liquidhaskell-boot.cabal index bea61010bd..78b7561c4b 100644 --- a/liquidhaskell-boot/liquidhaskell-boot.cabal +++ b/liquidhaskell-boot/liquidhaskell-boot.cabal @@ -60,6 +60,7 @@ library Language.Haskell.Liquid.Constraint.Types Language.Haskell.Liquid.Constraint.Relational Liquid.GHC.API + Liquid.GHC.API.Compat Liquid.GHC.API.Extra Liquid.GHC.API.StableModule Language.Haskell.Liquid.GHC.CoreToLogic diff --git a/liquidhaskell-boot/src-ghc/Liquid/GHC/API.hs b/liquidhaskell-boot/src-ghc/Liquid/GHC/API.hs index 1126b7cd4b..f42f39d19d 100644 --- a/liquidhaskell-boot/src-ghc/Liquid/GHC/API.hs +++ b/liquidhaskell-boot/src-ghc/Liquid/GHC/API.hs @@ -18,6 +18,7 @@ module Liquid.GHC.API ( ) where import Liquid.GHC.API.Extra as Ghc +import Liquid.GHC.API.Compat as Ghc import GHC as Ghc ( Class diff --git a/liquidhaskell-boot/src-ghc/Liquid/GHC/API/Compat.hs b/liquidhaskell-boot/src-ghc/Liquid/GHC/API/Compat.hs new file mode 100644 index 0000000000..cf20c34fad --- /dev/null +++ b/liquidhaskell-boot/src-ghc/Liquid/GHC/API/Compat.hs @@ -0,0 +1,15 @@ +module Liquid.GHC.API.Compat ( + UniqueId + , toUniqueId + ) where + +import Data.Word (Word64) + +---------------------- +-- Uniques +---------------------- + +type UniqueId = Word64 + +toUniqueId :: Word64 -> UniqueId +toUniqueId = id diff --git a/liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Misc.hs b/liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Misc.hs index 9726e920f5..113bdcbcf8 100644 --- a/liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Misc.hs +++ b/liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Misc.hs @@ -105,11 +105,11 @@ maybeAuxVar s name = mkInternalName (mkUnique 'x' uid) occ noSrcSpan occ = mkVarOcc (T.unpack (symbolText sym)) -stringTyCon :: Char -> Word64 -> String -> TyCon +stringTyCon :: Char -> UniqueId -> String -> TyCon stringTyCon = stringTyConWithKind anyTy -- FIXME: reusing uniques like this is really dangerous -stringTyConWithKind :: Kind -> Char -> Word64 -> String -> TyCon +stringTyConWithKind :: Kind -> Char -> UniqueId -> String -> TyCon stringTyConWithKind k c n s = Ghc.mkPrimTyCon name [] k [] where name = mkInternalName (mkUnique c n) occ noSrcSpan @@ -508,8 +508,8 @@ takeModuleUnique = mungeNames tailName sepUnique "takeModuleUnique: " where tailName msg = symbol . safeLast msg -splitModuleUnique :: Symbol -> (Symbol, Word64) -splitModuleUnique x = (dropModuleNamesAndUnique x, base62ToW (takeModuleUnique x)) +splitModuleUnique :: Symbol -> (Symbol, UniqueId) +splitModuleUnique x = (dropModuleNamesAndUnique x, toUniqueId $ base62ToW (takeModuleUnique x)) base62ToW :: Symbol -> Word64 base62ToW s = fromMaybe (errorstar "base62ToW Out Of Range") $ go (F.symbolText s) diff --git a/liquidhaskell-boot/src/Language/Haskell/Liquid/Transforms/ANF.hs b/liquidhaskell-boot/src/Language/Haskell/Liquid/Transforms/ANF.hs index 21e76e62fb..e3e3e0447a 100644 --- a/liquidhaskell-boot/src/Language/Haskell/Liquid/Transforms/ANF.hs +++ b/liquidhaskell-boot/src/Language/Haskell/Liquid/Transforms/ANF.hs @@ -11,7 +11,6 @@ module Language.Haskell.Liquid.Transforms.ANF (anormalize) where -import Data.Word (Word64) import Debug.Trace (trace) import Prelude hiding (error) import Language.Haskell.Liquid.GHC.TypeRep @@ -355,7 +354,7 @@ freshNormalVar γ t = do let sp = Sp.srcSpan (aeSrcSpan γ) return (mkUserLocalOrCoVar (anfOcc i) u Ghc.ManyTy t sp) -anfOcc :: Word64 -> OccName +anfOcc :: UniqueId -> OccName anfOcc = mkVarOccFS . GM.symbolFastString . F.intSymbol F.anfPrefix data AnfEnv = AnfEnv