Skip to content

Instantly share code, notes, and snippets.

@tfausak
Created May 30, 2020 14:09
Show Gist options
  • Save tfausak/6c0e9985d6e44e3b99b6b85db92d6f1f to your computer and use it in GitHub Desktop.
Save tfausak/6c0e9985d6e44e3b99b6b85db92d6f1f to your computer and use it in GitHub Desktop.
{-
this is a little experiment to parse a module with ghc
and extract exports identifiers, top-level declarations, and (documentation) comments
the idea is to use this as a basis for a haddock-like tool
that doesn't require type checking a module in order to run
-}
module Main ( main ) where
import qualified Control.Monad
import qualified DynFlags
import qualified ErrUtils
import qualified FastString
import qualified GHC.Hs
import qualified GHC.Platform
import qualified HeaderInfo
import qualified Lexer
import qualified Outputable
import qualified Parser
import qualified SrcLoc
import qualified StringBuffer
import qualified System.Environment
import qualified ToolSettings
import qualified RdrName
import qualified OccName
main :: IO ()
main = do
let dynFlags1 = defaultDynFlags
[filePath] <- System.Environment.getArgs
stringBuffer <- StringBuffer.hGetStringBuffer filePath
let locatedStrings = HeaderInfo.getOptions dynFlags1 stringBuffer filePath
(dynFlags2, _locatedStrings, _warns) <- DynFlags.parseDynamicFilePragma dynFlags1 locatedStrings
let realSrcLoc = makeRealSrcLoc filePath
let dynFlags3 = DynFlags.gopt_set dynFlags2 DynFlags.Opt_KeepRawTokenStream
let pState1 = Lexer.mkPState dynFlags3 stringBuffer realSrcLoc
case Lexer.unP Parser.parseModule pState1 of
Lexer.PFailed pState2 -> do
let (_warningMessages, errorMessages) = Lexer.getMessages pState2 dynFlags3
fail
. unlines
. fmap (Outputable.showSDoc dynFlags3)
$ ErrUtils.pprErrMsgBagWithLoc errorMessages
Lexer.POk pState2 locatedHsModuleGhcPs -> do
let (_warningMessages, errorMessages) = Lexer.getMessages pState2 dynFlags3
Control.Monad.unless (null errorMessages)
. fail
. unlines
. fmap (Outputable.showSDoc dynFlags3)
$ ErrUtils.pprErrMsgBagWithLoc errorMessages
-- TODO: Make DynFlags from Cabal file?
putStrLn "*** COMMENTS"
mapM_ (putStrLn . Outputable.showPpr dynFlags3)
$ Lexer.comment_q pState2
putStrLn "*** EXPORTS"
mapM_ (putStrLn . Outputable.showPpr dynFlags3 . withoutLocation)
$ maybe [] withoutLocation
$ GHC.Hs.hsmodExports
$ withoutLocation locatedHsModuleGhcPs
putStrLn "*** IMPORTS"
mapM_ (putStrLn . Outputable.showPpr dynFlags3 . withoutLocation . GHC.Hs.ideclName . withoutLocation)
$ GHC.Hs.hsmodImports
$ withoutLocation locatedHsModuleGhcPs
putStrLn "*** DECLARATIONS"
-- TODO: just get name, type, and which HsDecl constructor?
mapM_ print
$ fmap todo
$ GHC.Hs.hsmodDecls
$ withoutLocation locatedHsModuleGhcPs
-- TODO: How do you associate comments with declarations?
fail "POk"
todo :: GHC.Hs.LHsDecl GHC.Hs.GhcPs -> Either String String
todo lHsDecl =
let
unknown :: Outputable.Outputable a => a -> Either String b
unknown = Left . mappend "TODO: unknown " . Outputable.showSDocUnsafe . Outputable.ppr
in case withoutLocation lHsDecl of
GHC.Hs.ValD _ hsBindLR -> case hsBindLR of
[email protected]{} -> case withoutLocation $ GHC.Hs.fun_id fun of
-- TODO: parameter names?
RdrName.Unqual occName -> Right $ "FunBind: " <> OccName.occNameString occName
rdrName -> unknown rdrName
_ -> unknown hsBindLR
GHC.Hs.SigD _ sig -> case sig of
-- (GHC.Hs.HsWC _ (GHC.Hs.HsIB _ (SrcLoc.L _ hsType)))
GHC.Hs.TypeSig _ [SrcLoc.L _ (RdrName.Unqual occName)] x -> Right
$ "TypeSig: "
<> OccName.occNameString occName
<> " :: "
<> Outputable.showSDocUnsafe (Outputable.ppr x)
_ -> unknown sig
hsDecl -> unknown hsDecl
withoutLocation :: SrcLoc.GenLocated l e -> e
withoutLocation (SrcLoc.L _ e) = e
-- | <https://hackage.haskell.org/package/ghc-8.10.1/docs/SrcLoc.html#v:mkRealSrcLoc>
makeRealSrcLoc :: FilePath -> SrcLoc.RealSrcLoc
makeRealSrcLoc filePath =
let
fastString = FastString.mkFastString filePath
line = 1 :: Int
column = 1 :: Int
in SrcLoc.mkRealSrcLoc fastString line column
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:DynFlags
defaultDynFlags :: DynFlags.DynFlags
defaultDynFlags = DynFlags.defaultDynFlags defaultSettings defaultLlvmConfig
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:FileSettings
defaultFileSettings :: DynFlags.FileSettings
defaultFileSettings = DynFlags.FileSettings
{ DynFlags.fileSettings_ghciUsagePath = error "fileSettings_ghciUsagePath :: FilePath"
, DynFlags.fileSettings_ghcUsagePath = error "fileSettings_ghcUsagePath :: FilePath"
, DynFlags.fileSettings_systemPackageConfig = error "fileSettings_systemPackageConfig :: FilePath"
, DynFlags.fileSettings_tmpDir = error "fileSettings_tmpDir :: String"
, DynFlags.fileSettings_toolDir = error "fileSettings_toolDir :: Maybe FilePath"
, DynFlags.fileSettings_topDir = error "fileSettings_topDir :: FilePath"
}
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:GhcNameVersion
defaultGhcNameVersion :: DynFlags.GhcNameVersion
defaultGhcNameVersion = DynFlags.GhcNameVersion
{ DynFlags.ghcNameVersion_programName = error "ghcNameVersion_programName :: String"
, DynFlags.ghcNameVersion_projectVersion = error "ghcNameVersion_projectVersion :: String"
}
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:LlvmConfig
defaultLlvmConfig :: DynFlags.LlvmConfig
defaultLlvmConfig = error "defaultLlvmConfig :: LlvmConfig"
-- TODO: ghc-boot-8.10.1 isn't on Hackage.
defaultPlatform :: GHC.Platform.Platform
defaultPlatform = GHC.Platform.Platform
{ GHC.Platform.platformHasGnuNonexecStack = error "platformHasGnuNonexecStack :: Bool"
, GHC.Platform.platformHasIdentDirective = error "platformHasIdentDirective :: Bool"
, GHC.Platform.platformHasSubsectionsViaSymbols = error "platformHasSubsectionsViaSymbols :: Bool"
, GHC.Platform.platformIsCrossCompiling = error "platformIsCrossCompiling :: Bool"
, GHC.Platform.platformMini = defaultPlatformMini
, GHC.Platform.platformUnregisterised = False
, GHC.Platform.platformWordSize = error "platformWordSize :: PlatformWordSize"
}
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:PlatformConstants
defaultPlatformConstants :: DynFlags.PlatformConstants
defaultPlatformConstants = DynFlags.PlatformConstants
{ DynFlags.pc_AP_STACK_SPLIM = error "pc_AP_STACK_SPLIM :: Int"
, DynFlags.pc_BITMAP_BITS_SHIFT = error "pc_BITMAP_BITS_SHIFT :: Int"
, DynFlags.pc_BLOCK_SIZE = error "pc_BLOCK_SIZE :: Int"
, DynFlags.pc_BLOCKS_PER_MBLOCK = error "pc_BLOCKS_PER_MBLOCK :: Int"
, DynFlags.pc_CINT_SIZE = error "pc_CINT_SIZE :: Int"
, DynFlags.pc_CLONG_LONG_SIZE = error "pc_CLONG_LONG_SIZE :: Int"
, DynFlags.pc_CLONG_SIZE = error "pc_CLONG_SIZE :: Int"
, DynFlags.pc_CONTROL_GROUP_CONST_291 = error "pc_CONTROL_GROUP_CONST_291 :: Int"
, DynFlags.pc_DOUBLE_SIZE = error "pc_DOUBLE_SIZE :: Int"
, DynFlags.pc_DYNAMIC_BY_DEFAULT = False
, DynFlags.pc_ILDV_CREATE_MASK = error "pc_ILDV_CREATE_MASK :: Integer"
, DynFlags.pc_ILDV_STATE_CREATE = error "pc_ILDV_STATE_CREATE :: Integer"
, DynFlags.pc_ILDV_STATE_USE = error "pc_ILDV_STATE_USE :: Integer"
, DynFlags.pc_LDV_SHIFT = error "pc_LDV_SHIFT :: Int"
, DynFlags.pc_MAX_CHARLIKE = error "pc_MAX_CHARLIKE :: Int"
, DynFlags.pc_MAX_Double_REG = error "pc_MAX_Double_REG :: Int"
, DynFlags.pc_MAX_Float_REG = error "pc_MAX_Float_REG :: Int"
, DynFlags.pc_MAX_INTLIKE = error "pc_MAX_INTLIKE :: Int"
, DynFlags.pc_MAX_Long_REG = error "pc_MAX_Long_REG :: Int"
, DynFlags.pc_MAX_Real_Double_REG = error "pc_MAX_Real_Double_REG :: Int"
, DynFlags.pc_MAX_Real_Float_REG = error "pc_MAX_Real_Float_REG :: Int"
, DynFlags.pc_MAX_Real_Long_REG = error "pc_MAX_Real_Long_REG :: Int"
, DynFlags.pc_MAX_Real_Vanilla_REG = error "pc_MAX_Real_Vanilla_REG :: Int"
, DynFlags.pc_MAX_Real_XMM_REG = error "pc_MAX_Real_XMM_REG :: Int"
, DynFlags.pc_MAX_SPEC_AP_SIZE = error "pc_MAX_SPEC_AP_SIZE :: Int"
, DynFlags.pc_MAX_SPEC_SELECTEE_SIZE = error "pc_MAX_SPEC_SELECTEE_SIZE :: Int"
, DynFlags.pc_MAX_Vanilla_REG = error "pc_MAX_Vanilla_REG :: Int"
, DynFlags.pc_MAX_XMM_REG = error "pc_MAX_XMM_REG :: Int"
, DynFlags.pc_MIN_CHARLIKE = error "pc_MIN_CHARLIKE :: Int"
, DynFlags.pc_MIN_INTLIKE = error "pc_MIN_INTLIKE :: Int"
, DynFlags.pc_MIN_PAYLOAD_SIZE = error "pc_MIN_PAYLOAD_SIZE :: Int"
, DynFlags.pc_MUT_ARR_PTRS_CARD_BITS = error "pc_MUT_ARR_PTRS_CARD_BITS :: Int"
, DynFlags.pc_OFFSET_bdescr_blocks = error "pc_OFFSET_bdescr_blocks :: Int"
, DynFlags.pc_OFFSET_bdescr_flags = error "pc_OFFSET_bdescr_flags :: Int"
, DynFlags.pc_OFFSET_bdescr_free = error "pc_OFFSET_bdescr_free :: Int"
, DynFlags.pc_OFFSET_bdescr_start = error "pc_OFFSET_bdescr_start :: Int"
, DynFlags.pc_OFFSET_Capability_r = error "pc_OFFSET_Capability_r :: Int"
, DynFlags.pc_OFFSET_CostCentreStack_mem_alloc = error "pc_OFFSET_CostCentreStack_mem_alloc :: Int"
, DynFlags.pc_OFFSET_CostCentreStack_scc_count = error "pc_OFFSET_CostCentreStack_scc_count :: Int"
, DynFlags.pc_OFFSET_StgArrBytes_bytes = error "pc_OFFSET_StgArrBytes_bytes :: Int"
, DynFlags.pc_OFFSET_stgEagerBlackholeInfo = error "pc_OFFSET_stgEagerBlackholeInfo :: Int"
, DynFlags.pc_OFFSET_StgEntCounter_allocd = error "pc_OFFSET_StgEntCounter_allocd :: Int"
, DynFlags.pc_OFFSET_StgEntCounter_allocs = error "pc_OFFSET_StgEntCounter_allocs :: Int"
, DynFlags.pc_OFFSET_StgEntCounter_entry_count = error "pc_OFFSET_StgEntCounter_entry_count :: Int"
, DynFlags.pc_OFFSET_StgEntCounter_link = error "pc_OFFSET_StgEntCounter_link :: Int"
, DynFlags.pc_OFFSET_StgEntCounter_registeredp = error "pc_OFFSET_StgEntCounter_registeredp :: Int"
, DynFlags.pc_OFFSET_StgFunInfoExtraFwd_arity = error "pc_OFFSET_StgFunInfoExtraFwd_arity :: Int"
, DynFlags.pc_OFFSET_StgFunInfoExtraRev_arity = error "pc_OFFSET_StgFunInfoExtraRev_arity :: Int"
, DynFlags.pc_OFFSET_stgGCEnter1 = error "pc_OFFSET_stgGCEnter1 :: Int"
, DynFlags.pc_OFFSET_stgGCFun = error "pc_OFFSET_stgGCFun :: Int"
, DynFlags.pc_OFFSET_StgHeader_ccs = error "pc_OFFSET_StgHeader_ccs :: Int"
, DynFlags.pc_OFFSET_StgHeader_ldvw = error "pc_OFFSET_StgHeader_ldvw :: Int"
, DynFlags.pc_OFFSET_StgMutArrPtrs_ptrs = error "pc_OFFSET_StgMutArrPtrs_ptrs :: Int"
, DynFlags.pc_OFFSET_StgMutArrPtrs_size = error "pc_OFFSET_StgMutArrPtrs_size :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rCCCS = error "pc_OFFSET_StgRegTable_rCCCS :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rCurrentNursery = error "pc_OFFSET_StgRegTable_rCurrentNursery :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rCurrentTSO = error "pc_OFFSET_StgRegTable_rCurrentTSO :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rD1 = error "pc_OFFSET_StgRegTable_rD1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rD2 = error "pc_OFFSET_StgRegTable_rD2 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rD3 = error "pc_OFFSET_StgRegTable_rD3 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rD4 = error "pc_OFFSET_StgRegTable_rD4 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rD5 = error "pc_OFFSET_StgRegTable_rD5 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rD6 = error "pc_OFFSET_StgRegTable_rD6 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rF1 = error "pc_OFFSET_StgRegTable_rF1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rF2 = error "pc_OFFSET_StgRegTable_rF2 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rF3 = error "pc_OFFSET_StgRegTable_rF3 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rF4 = error "pc_OFFSET_StgRegTable_rF4 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rF5 = error "pc_OFFSET_StgRegTable_rF5 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rF6 = error "pc_OFFSET_StgRegTable_rF6 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rHp = error "pc_OFFSET_StgRegTable_rHp :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rHpAlloc = error "pc_OFFSET_StgRegTable_rHpAlloc :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rHpLim = error "pc_OFFSET_StgRegTable_rHpLim :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rL1 = error "pc_OFFSET_StgRegTable_rL1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR1 = error "pc_OFFSET_StgRegTable_rR1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR10 = error "pc_OFFSET_StgRegTable_rR10 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR2 = error "pc_OFFSET_StgRegTable_rR2 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR3 = error "pc_OFFSET_StgRegTable_rR3 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR4 = error "pc_OFFSET_StgRegTable_rR4 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR5 = error "pc_OFFSET_StgRegTable_rR5 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR6 = error "pc_OFFSET_StgRegTable_rR6 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR7 = error "pc_OFFSET_StgRegTable_rR7 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR8 = error "pc_OFFSET_StgRegTable_rR8 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rR9 = error "pc_OFFSET_StgRegTable_rR9 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rSp = error "pc_OFFSET_StgRegTable_rSp :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rSpLim = error "pc_OFFSET_StgRegTable_rSpLim :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rXMM1 = error "pc_OFFSET_StgRegTable_rXMM1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rXMM2 = error "pc_OFFSET_StgRegTable_rXMM2 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rXMM3 = error "pc_OFFSET_StgRegTable_rXMM3 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rXMM4 = error "pc_OFFSET_StgRegTable_rXMM4 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rXMM5 = error "pc_OFFSET_StgRegTable_rXMM5 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rXMM6 = error "pc_OFFSET_StgRegTable_rXMM6 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rYMM1 = error "pc_OFFSET_StgRegTable_rYMM1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rYMM2 = error "pc_OFFSET_StgRegTable_rYMM2 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rYMM3 = error "pc_OFFSET_StgRegTable_rYMM3 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rYMM4 = error "pc_OFFSET_StgRegTable_rYMM4 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rYMM5 = error "pc_OFFSET_StgRegTable_rYMM5 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rYMM6 = error "pc_OFFSET_StgRegTable_rYMM6 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rZMM1 = error "pc_OFFSET_StgRegTable_rZMM1 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rZMM2 = error "pc_OFFSET_StgRegTable_rZMM2 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rZMM3 = error "pc_OFFSET_StgRegTable_rZMM3 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rZMM4 = error "pc_OFFSET_StgRegTable_rZMM4 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rZMM5 = error "pc_OFFSET_StgRegTable_rZMM5 :: Int"
, DynFlags.pc_OFFSET_StgRegTable_rZMM6 = error "pc_OFFSET_StgRegTable_rZMM6 :: Int"
, DynFlags.pc_OFFSET_StgSmallMutArrPtrs_ptrs = error "pc_OFFSET_StgSmallMutArrPtrs_ptrs :: Int"
, DynFlags.pc_OFFSET_StgStack_sp = error "pc_OFFSET_StgStack_sp :: Int"
, DynFlags.pc_OFFSET_StgStack_stack = error "pc_OFFSET_StgStack_stack :: Int"
, DynFlags.pc_OFFSET_StgTSO_alloc_limit = error "pc_OFFSET_StgTSO_alloc_limit :: Int"
, DynFlags.pc_OFFSET_StgTSO_cccs = error "pc_OFFSET_StgTSO_cccs :: Int"
, DynFlags.pc_OFFSET_StgTSO_stackobj = error "pc_OFFSET_StgTSO_stackobj :: Int"
, DynFlags.pc_OFFSET_StgUpdateFrame_updatee = error "pc_OFFSET_StgUpdateFrame_updatee :: Int"
, DynFlags.pc_PROF_HDR_SIZE = error "pc_PROF_HDR_SIZE :: Int"
, DynFlags.pc_REP_CostCentreStack_mem_alloc = error "pc_REP_CostCentreStack_mem_alloc :: Int"
, DynFlags.pc_REP_CostCentreStack_scc_count = error "pc_REP_CostCentreStack_scc_count :: Int"
, DynFlags.pc_REP_StgEntCounter_allocd = error "pc_REP_StgEntCounter_allocd :: Int"
, DynFlags.pc_REP_StgEntCounter_allocs = error "pc_REP_StgEntCounter_allocs :: Int"
, DynFlags.pc_REP_StgFunInfoExtraFwd_arity = error "pc_REP_StgFunInfoExtraFwd_arity :: Int"
, DynFlags.pc_REP_StgFunInfoExtraRev_arity = error "pc_REP_StgFunInfoExtraRev_arity :: Int"
, DynFlags.pc_RESERVED_C_STACK_BYTES = error "pc_RESERVED_C_STACK_BYTES :: Int"
, DynFlags.pc_RESERVED_STACK_WORDS = error "pc_RESERVED_STACK_WORDS :: Int"
, DynFlags.pc_SIZEOF_CostCentreStack = error "pc_SIZEOF_CostCentreStack :: Int"
, DynFlags.pc_SIZEOF_StgArrBytes_NoHdr = error "pc_SIZEOF_StgArrBytes_NoHdr :: Int"
, DynFlags.pc_SIZEOF_StgFunInfoExtraRev = error "pc_SIZEOF_StgFunInfoExtraRev :: Int"
, DynFlags.pc_SIZEOF_StgMutArrPtrs_NoHdr = error "pc_SIZEOF_StgMutArrPtrs_NoHdr :: Int"
, DynFlags.pc_SIZEOF_StgSmallMutArrPtrs_NoHdr = error "pc_SIZEOF_StgSmallMutArrPtrs_NoHdr :: Int"
, DynFlags.pc_SIZEOF_StgSMPThunkHeader = error "pc_SIZEOF_StgSMPThunkHeader :: Int"
, DynFlags.pc_SIZEOF_StgUpdateFrame_NoHdr = error "pc_SIZEOF_StgUpdateFrame_NoHdr :: Int"
, DynFlags.pc_STD_HDR_SIZE = error "pc_STD_HDR_SIZE :: Int"
, DynFlags.pc_TAG_BITS = error "pc_TAG_BITS :: Int"
, DynFlags.pc_TICKY_BIN_COUNT = error "pc_TICKY_BIN_COUNT :: Int"
, DynFlags.pc_WORD_SIZE = error "pc_WORD_SIZE :: Int"
, DynFlags.pc_WORDS_BIGENDIAN = error "pc_WORDS_BIGENDIAN :: Bool"
}
-- TODO: ghc-boot-8.10.1 isn't on Hackage.
defaultPlatformMini :: GHC.Platform.PlatformMini
defaultPlatformMini = GHC.Platform.PlatformMini
{ GHC.Platform.platformMini_arch = error "platformMini_arch :: Arch"
, GHC.Platform.platformMini_os = GHC.Platform.OSUnknown
}
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:PlatformMisc
defaultPlatformMisc :: DynFlags.PlatformMisc
defaultPlatformMisc = DynFlags.PlatformMisc
{ DynFlags.platformMisc_ghcDebugged = error "platformMisc_ghcDebugged :: Bool"
, DynFlags.platformMisc_ghcRTSWays = error "platformMisc_ghcRTSWays :: String"
, DynFlags.platformMisc_ghcRtsWithLibdw = error "platformMisc_ghcRtsWithLibdw :: Bool"
, DynFlags.platformMisc_ghcThreaded = error "platformMisc_ghcThreaded :: Bool"
, DynFlags.platformMisc_ghcWithInterpreter = error "platformMisc_ghcWithInterpreter :: Bool"
, DynFlags.platformMisc_ghcWithNativeCodeGen = False
, DynFlags.platformMisc_ghcWithSMP = error "platformMisc_ghcWithSMP :: Bool"
, DynFlags.platformMisc_integerLibrary = error "platformMisc_integerLibrary :: String"
, DynFlags.platformMisc_integerLibraryType = error "platformMisc_integerLibraryType :: IntegerLibrary"
, DynFlags.platformMisc_leadingUnderscore = error "platformMisc_leadingUnderscore :: Bool"
, DynFlags.platformMisc_libFFI = error "platformMisc_libFFI :: Bool"
, DynFlags.platformMisc_llvmTarget = error "platformMisc_llvmTarget :: String"
, DynFlags.platformMisc_tablesNextToCode = error "platformMisc_tablesNextToCode :: Bool"
, DynFlags.platformMisc_targetPlatformString = error "platformMisc_targetPlatformString :: String"
}
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/DynFlags.html#t:Settings
defaultSettings :: DynFlags.Settings
defaultSettings = DynFlags.Settings
{ DynFlags.sFileSettings = defaultFileSettings
, DynFlags.sGhcNameVersion = defaultGhcNameVersion
, DynFlags.sPlatformConstants = defaultPlatformConstants
, DynFlags.sPlatformMisc = defaultPlatformMisc
, DynFlags.sRawSettings = error "sRawSettings :: [(String, String)]"
, DynFlags.sTargetPlatform = defaultPlatform
, DynFlags.sToolSettings = defaultToolSettings
}
-- https://hackage.haskell.org/package/ghc-8.10.1/docs/ToolSettings.html#t:ToolSettings
defaultToolSettings :: ToolSettings.ToolSettings
defaultToolSettings = ToolSettings.ToolSettings
{ ToolSettings.toolSettings_ccSupportsNoPie = error "toolSettings_ccSupportsNoPie :: Bool"
, ToolSettings.toolSettings_extraGccViaCFlags = error "toolSettings_extraGccViaCFlags :: [String]"
, ToolSettings.toolSettings_ldIsGnuLd = error "toolSettings_ldIsGnuLd :: Bool"
, ToolSettings.toolSettings_ldSupportsBuildId = error "toolSettings_ldSupportsBuildId :: Bool"
, ToolSettings.toolSettings_ldSupportsCompactUnwind = error "toolSettings_ldSupportsCompactUnwind :: Bool"
, ToolSettings.toolSettings_ldSupportsFilelist = error "toolSettings_ldSupportsFilelist :: Bool"
, ToolSettings.toolSettings_opt_a = error "toolSettings_opt_a :: [String]"
, ToolSettings.toolSettings_opt_c = error "toolSettings_opt_c :: [String]"
, ToolSettings.toolSettings_opt_cxx = error "toolSettings_opt_cxx :: [String]"
, ToolSettings.toolSettings_opt_F = error "toolSettings_opt_F :: [String]"
, ToolSettings.toolSettings_opt_i = error "toolSettings_opt_i :: [String]"
, ToolSettings.toolSettings_opt_l = error "toolSettings_opt_l :: [String]"
, ToolSettings.toolSettings_opt_L = error "toolSettings_opt_L :: [String]"
, ToolSettings.toolSettings_opt_lc = error "toolSettings_opt_lc :: [String]"
, ToolSettings.toolSettings_opt_lcc = error "toolSettings_opt_lcc :: [String]"
, ToolSettings.toolSettings_opt_lo = error "toolSettings_opt_lo :: [String]"
, ToolSettings.toolSettings_opt_P = error "toolSettings_opt_P :: [String]"
, ToolSettings.toolSettings_opt_P_fingerprint = error "toolSettings_opt_P_fingerprint :: Fingerprint"
, ToolSettings.toolSettings_opt_windres = error "toolSettings_opt_windres :: [String]"
, ToolSettings.toolSettings_pgm_a = error "toolSettings_pgm_a :: (String, [Option])"
, ToolSettings.toolSettings_pgm_ar = error "toolSettings_pgm_ar :: String"
, ToolSettings.toolSettings_pgm_c = error "toolSettings_pgm_c :: String"
, ToolSettings.toolSettings_pgm_dll = error "toolSettings_pgm_dll :: (String, [Option])"
, ToolSettings.toolSettings_pgm_F = error "toolSettings_pgm_F :: String"
, ToolSettings.toolSettings_pgm_i = error "toolSettings_pgm_i :: String"
, ToolSettings.toolSettings_pgm_l = error "toolSettings_pgm_l :: (String, [Option])"
, ToolSettings.toolSettings_pgm_L = error "toolSettings_pgm_L :: String"
, ToolSettings.toolSettings_pgm_lc = error "toolSettings_pgm_lc :: (String, [Option])"
, ToolSettings.toolSettings_pgm_lcc = error "toolSettings_pgm_lcc :: (String, [Option])"
, ToolSettings.toolSettings_pgm_libtool = error "toolSettings_pgm_libtool :: String"
, ToolSettings.toolSettings_pgm_lo = error "toolSettings_pgm_lo :: (String, [Option])"
, ToolSettings.toolSettings_pgm_P = error "toolSettings_pgm_P :: (String, [Option])"
, ToolSettings.toolSettings_pgm_ranlib = error "toolSettings_pgm_ranlib :: String"
, ToolSettings.toolSettings_pgm_T = error "toolSettings_pgm_T :: String"
, ToolSettings.toolSettings_pgm_windres = error "toolSettings_pgm_windres :: String"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment