ghc-dump-core 0.1.1.0 → 0.1.2.0
raw patch · 4 files changed
+41/−12 lines, 4 filesdep ~basedep ~ghcPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, ghc
API changes (from Hackage documentation)
+ GhcDump.Ast: LitRubbish :: Lit
Files
- GhcDump/Ast.hs +1/−0
- GhcDump/Convert.hs +29/−7
- GhcDump/Plugin.hs +2/−0
- ghc-dump-core.cabal +9/−5
GhcDump/Ast.hs view
@@ -118,6 +118,7 @@ | MachLabel T.Text | LitInteger Integer | LitNatural Integer+ | LitRubbish deriving (Eq, Ord, Generic, Show) instance Serialise Lit
GhcDump/Convert.hs view
@@ -6,7 +6,9 @@ import qualified Data.Text.Encoding as TE import Literal (Literal(..))+#if MIN_VERSION_ghc(8,6,0) import qualified Literal+#endif import Var (Var) import qualified Var import Id (isFCallId)@@ -23,7 +25,8 @@ import qualified CoreSyn import CoreSyn (Expr(..), CoreExpr, Bind(..), CoreAlt, CoreBind, AltCon(..)) import HscTypes (ModGuts(..))-import FastString (FastString, fastStringToByteString)+import FastString (FastString)+import qualified FastString #if MIN_VERSION_ghc(8,2,0) import TyCoRep as Type (Type(..)) #elif MIN_VERSION_ghc(8,0,0)@@ -45,7 +48,12 @@ cvtSDoc = T.pack . showSDoc unsafeGlobalDynFlags fastStringToText :: FastString -> T.Text-fastStringToText = TE.decodeUtf8 . fastStringToByteString+fastStringToText = TE.decodeUtf8+#if MIN_VERSION_ghc(8,10,0)+ . FastString.bytesFS+#else+ . FastString.fastStringToByteString+#endif occNameToText :: OccName -> T.Text occNameToText = fastStringToText . occNameFS@@ -193,9 +201,22 @@ cvtLit :: Literal -> Ast.Lit cvtLit l = case l of+#if MIN_VERSION_ghc(8,8,0)+ Literal.LitChar x -> Ast.MachChar x+ Literal.LitString x -> Ast.MachStr x+ Literal.LitNullAddr -> Ast.MachNullAddr+ Literal.LitFloat x -> Ast.MachFloat x+ Literal.LitDouble x -> Ast.MachDouble x+ Literal.LitLabel x _ _ -> Ast.MachLabel $ fastStringToText x+ Literal.LitRubbish -> Ast.LitRubbish+#else Literal.MachChar x -> Ast.MachChar x Literal.MachStr x -> Ast.MachStr x Literal.MachNullAddr -> Ast.MachNullAddr+ Literal.MachFloat x -> Ast.MachFloat x+ Literal.MachDouble x -> Ast.MachDouble x+ Literal.MachLabel x _ _ -> Ast.MachLabel $ fastStringToText x+#endif #if MIN_VERSION_ghc(8,6,0) Literal.LitNumber numty n _ -> case numty of@@ -212,9 +233,6 @@ Literal.MachWord64 x -> Ast.MachWord64 x Literal.LitInteger x _ -> Ast.LitInteger x #endif- Literal.MachFloat x -> Ast.MachFloat x- Literal.MachDouble x -> Ast.MachDouble x- Literal.MachLabel x _ _ -> Ast.MachLabel $ fastStringToText x cvtModule :: String -> ModGuts -> Ast.SModule cvtModule phase guts =@@ -225,7 +243,9 @@ cvtModuleName = Ast.ModuleName . fastStringToText . moduleNameFS cvtType :: Type.Type -> Ast.SType-#if MIN_VERSION_ghc(8,2,0)+#if MIN_VERSION_ghc(8,10,0)+cvtType (Type.FunTy _flag a b) = Ast.FunTy (cvtType a) (cvtType b)+#elif MIN_VERSION_ghc(8,2,0) cvtType (Type.FunTy a b) = Ast.FunTy (cvtType a) (cvtType b) #else cvtType t@@ -234,7 +254,9 @@ cvtType (Type.TyVarTy v) = Ast.VarTy (cvtVar v) cvtType (Type.AppTy a b) = Ast.AppTy (cvtType a) (cvtType b) cvtType (Type.TyConApp tc tys) = Ast.TyConApp (cvtTyCon tc) (map cvtType tys)-#if MIN_VERSION_ghc(8,2,0)+#if MIN_VERSION_ghc(8,8,0)+cvtType (Type.ForAllTy (Var.Bndr b _) t) = Ast.ForAllTy (cvtBinder b) (cvtType t)+#elif MIN_VERSION_ghc(8,2,0) cvtType (Type.ForAllTy (Var.TvBndr b _) t) = Ast.ForAllTy (cvtBinder b) (cvtType t) #elif MIN_VERSION_ghc(8,0,0) cvtType (Type.ForAllTy (Named b _) t) = Ast.ForAllTy (cvtBinder b) (cvtType t)
GhcDump/Plugin.hs view
@@ -6,7 +6,9 @@ import qualified Data.ByteString.Lazy as BSL import qualified Codec.Serialise as Ser import GhcPlugins hiding (TB)+#if !MIN_VERSION_ghc(8,8,0) import CoreMonad (pprPassDetails)+#endif import ErrUtils (showPass) import Text.Printf import System.FilePath
ghc-dump-core.cabal view
@@ -1,5 +1,5 @@ name: ghc-dump-core-version: 0.1.1.0+version: 0.1.2.0 synopsis: An AST and compiler plugin for dumping GHC's Core representation. description: @ghc-dump@ is a library, GHC plugin, and set of tools for recording and@@ -27,7 +27,7 @@ copyright: (c) 2017 Ben Gamari category: Development build-type: Simple-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.4+tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.3, GHC==8.10.1 cabal-version: >=1.10 source-repository head@@ -38,16 +38,20 @@ exposed-modules: GhcDump.Convert, GhcDump.Ast, GhcDump.Plugin ghc-options: -Wall other-extensions: GeneralizedNewtypeDeriving- build-depends: base >=4.8 && <4.13,+ build-depends: base >=4.8 && <4.15, bytestring >= 0.10, text >=1.2 && <1.3, filepath >= 1.4, serialise >= 0.2 && <0.3,- ghc >= 7.10 && < 8.8,+ ghc >= 7.10 && < 8.11, directory < 1.4 default-language: Haskell2010 if impl(ghc >= 8.0)- ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances+ ghc-options: -Wcompat+ if impl(ghc < 8.8)+ ghc-options:+ -Wnoncanonical-monad-instances+ -Wnoncanonical-monadfail-instances else -- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8 build-depends: fail == 4.9.*, semigroups == 0.18.*