-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Shared functionality between GHC and its boot libraries
--   
--   This library is shared between GHC, ghc-pkg, and other boot libraries.
--   . A note about <a>GHC.Unit.Database</a>: it only deals with the subset
--   of the package database that the compiler cares about: modules paths
--   etc and not package metadata like description, authors etc. It is thus
--   not a library interface to ghc-pkg and is *not* suitable for modifying
--   GHC package databases. . The package database format and this library
--   are constructed in such a way that while ghc-pkg depends on Cabal, the
--   GHC library and program do not have to depend on Cabal.
@package ghc-boot
@version 9.6.3


-- | Note [Base Dir] ~~~~~~~~~~~~~~~~~ GHC's base directory or top
--   directory containers miscellaneous settings and the package database.
--   The main compiler of course needs this directory to read those
--   settings and read and write packages. ghc-pkg uses it to find the
--   global package database too.
--   
--   In the interest of making GHC builds more relocatable, many settings
--   also will expand `${top_dir}` inside strings so GHC doesn't need to
--   know it's on installation location at build time. ghc-pkg also can
--   expand those variables and so needs the top dir location to do that
--   too.
module GHC.BaseDir

-- | Expand occurrences of the <tt>$topdir</tt> interpolation in a string.
expandTopDir :: FilePath -> String -> String

-- | <pre>
--   expandPathVar var value str
--   </pre>
--   
--   replaces occurrences of variable <tt>$var</tt> with <tt>value</tt> in
--   str.
expandPathVar :: String -> FilePath -> String -> String

-- | Calculate the location of the base dir
getBaseDir :: IO (Maybe String)

module GHC.Data.SizedSeq
data SizedSeq a
SizedSeq :: {-# UNPACK #-} !Word -> [a] -> SizedSeq a
emptySS :: SizedSeq a
addToSS :: SizedSeq a -> a -> SizedSeq a
addListToSS :: SizedSeq a -> [a] -> SizedSeq a
ssElts :: SizedSeq a -> [a]
sizeSS :: SizedSeq a -> Word
instance GHC.Show.Show a => GHC.Show.Show (GHC.Data.SizedSeq.SizedSeq a)
instance GHC.Generics.Generic (GHC.Data.SizedSeq.SizedSeq a)
instance GHC.Base.Functor GHC.Data.SizedSeq.SizedSeq
instance Data.Foldable.Foldable GHC.Data.SizedSeq.SizedSeq
instance Data.Traversable.Traversable GHC.Data.SizedSeq.SizedSeq
instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (GHC.Data.SizedSeq.SizedSeq a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (GHC.Data.SizedSeq.SizedSeq a)


-- | See <tt>GHC.LanguageExtensions</tt> for an explanation on why this is
--   needed
module GHC.ForeignSrcLang
instance Data.Binary.Class.Binary GHC.ForeignSrcLang.Type.ForeignSrcLang


-- | See GHC #10762 and #15021.
module GHC.HandleEncoding

-- | Handle GHC-specific character encoding flags, allowing us to control
--   how GHC produces output regardless of OS.
configureHandleEncoding :: IO ()


-- | This module re-exports the <a>Extension</a> type along with an orphan
--   <a>Binary</a> instance for it.
--   
--   Note that the <tt>ghc-boot</tt> package has a large set of
--   dependencies; for this reason the <a>Extension</a> type itself is
--   defined in the <a>GHC.LanguageExtensions.Type</a> module provided by
--   the <tt>ghc-boot-th</tt> package, which has no dependencies outside of
--   <tt>base</tt>. For this reason <tt>template-haskell</tt> depends upon
--   <tt>ghc-boot-th</tt>, not <tt>ghc-boot</tt>.
module GHC.LanguageExtensions
instance Data.Binary.Class.Binary GHC.LanguageExtensions.Type.Extension


-- | Platform architecture and OS
--   
--   We need it in ghc-boot because ghc-pkg needs it.
module GHC.Platform.ArchOS

-- | Platform architecture and OS.
data ArchOS
ArchOS :: Arch -> OS -> ArchOS
[archOS_arch] :: ArchOS -> Arch
[archOS_OS] :: ArchOS -> OS

-- | Architectures
--   
--   TODO: It might be nice to extend these constructors with information
--   about what instruction set extensions an architecture might support.
data Arch
ArchUnknown :: Arch
ArchX86 :: Arch
ArchX86_64 :: Arch
ArchPPC :: Arch
ArchPPC_64 :: PPC_64ABI -> Arch
ArchS390X :: Arch
ArchARM :: ArmISA -> [ArmISAExt] -> ArmABI -> Arch
ArchAArch64 :: Arch
ArchAlpha :: Arch
ArchMipseb :: Arch
ArchMipsel :: Arch
ArchRISCV64 :: Arch
ArchLoongArch64 :: Arch
ArchJavaScript :: Arch
ArchWasm32 :: Arch

-- | Operating systems.
--   
--   Using OSUnknown to generate code should produce a sensible default,
--   but no promises.
data OS
OSUnknown :: OS
OSLinux :: OS
OSDarwin :: OS
OSSolaris2 :: OS
OSMinGW32 :: OS
OSFreeBSD :: OS
OSDragonFly :: OS
OSOpenBSD :: OS
OSNetBSD :: OS
OSKFreeBSD :: OS
OSHaiku :: OS
OSQNXNTO :: OS
OSAIX :: OS
OSHurd :: OS
OSWasi :: OS
OSGhcjs :: OS

-- | ARM Instruction Set Architecture
data ArmISA
ARMv5 :: ArmISA
ARMv6 :: ArmISA
ARMv7 :: ArmISA

-- | ARM extensions
data ArmISAExt
VFPv2 :: ArmISAExt
VFPv3 :: ArmISAExt
VFPv3D16 :: ArmISAExt
NEON :: ArmISAExt
IWMMX2 :: ArmISAExt

-- | ARM ABI
data ArmABI
SOFT :: ArmABI
SOFTFP :: ArmABI
HARD :: ArmABI

-- | PowerPC 64-bit ABI
data PPC_64ABI

-- | PowerPC64
ELF_V1 :: PPC_64ABI

-- | PowerPC64 LE
ELF_V2 :: PPC_64ABI

-- | See Note [Platform Syntax].
stringEncodeArch :: Arch -> String

-- | See Note [Platform Syntax].
stringEncodeOS :: OS -> String
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArmISA
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArmISA
instance GHC.Show.Show GHC.Platform.ArchOS.ArmISA
instance GHC.Read.Read GHC.Platform.ArchOS.ArmISA
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArmISAExt
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArmISAExt
instance GHC.Show.Show GHC.Platform.ArchOS.ArmISAExt
instance GHC.Read.Read GHC.Platform.ArchOS.ArmISAExt
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArmABI
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArmABI
instance GHC.Show.Show GHC.Platform.ArchOS.ArmABI
instance GHC.Read.Read GHC.Platform.ArchOS.ArmABI
instance GHC.Classes.Ord GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Classes.Eq GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Show.Show GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Read.Read GHC.Platform.ArchOS.PPC_64ABI
instance GHC.Classes.Ord GHC.Platform.ArchOS.Arch
instance GHC.Classes.Eq GHC.Platform.ArchOS.Arch
instance GHC.Show.Show GHC.Platform.ArchOS.Arch
instance GHC.Read.Read GHC.Platform.ArchOS.Arch
instance GHC.Classes.Ord GHC.Platform.ArchOS.OS
instance GHC.Classes.Eq GHC.Platform.ArchOS.OS
instance GHC.Show.Show GHC.Platform.ArchOS.OS
instance GHC.Read.Read GHC.Platform.ArchOS.OS
instance GHC.Classes.Ord GHC.Platform.ArchOS.ArchOS
instance GHC.Classes.Eq GHC.Platform.ArchOS.ArchOS
instance GHC.Show.Show GHC.Platform.ArchOS.ArchOS
instance GHC.Read.Read GHC.Platform.ArchOS.ArchOS

module GHC.Platform.Host
hostPlatformArch :: Arch
hostPlatformOS :: OS
hostPlatformArchOS :: ArchOS

module GHC.Serialized

-- | Represents a serialized value of a particular type. Attempts can be
--   made to deserialize it at certain types
data Serialized
Serialized :: TypeRep -> [Word8] -> Serialized

-- | Put a Typeable value that we are able to actually turn into bytes into
--   a <a>Serialized</a> value ready for deserialization later
toSerialized :: forall a. Typeable a => (a -> [Word8]) -> a -> Serialized

-- | If the <a>Serialized</a> value contains something of the given type,
--   then use the specified deserializer to return <tt>Just</tt> that.
--   Otherwise return <tt>Nothing</tt>.
fromSerialized :: forall a. Typeable a => ([Word8] -> a) -> Serialized -> Maybe a

-- | Use a <a>Data</a> instance to implement a serialization scheme dual to
--   that of <a>deserializeWithData</a>
serializeWithData :: Data a => a -> [Word8]

-- | Use a <a>Data</a> instance to implement a deserialization scheme dual
--   to that of <a>serializeWithData</a>
deserializeWithData :: Data a => [Word8] -> a

module GHC.Settings.Utils
maybeRead :: Read a => String -> Maybe a
maybeReadFuzzy :: Read a => String -> Maybe a
type RawSettings = Map String String

-- | Read target Arch/OS from the settings
getTargetArchOS :: FilePath -> RawSettings -> Either String ArchOS
getRawSetting :: FilePath -> RawSettings -> String -> Either String String
getRawFilePathSetting :: FilePath -> FilePath -> RawSettings -> String -> Either String String
getRawBooleanSetting :: FilePath -> RawSettings -> String -> Either String Bool
readRawSetting :: (Show a, Read a) => FilePath -> RawSettings -> String -> Either String a


-- | Simple, non-streaming UTF-8 codecs.
--   
--   This is one of several UTF-8 implementations provided by GHC; see Note
--   [GHC's many UTF-8 implementations] in <a>GHC.Encoding.UTF8</a> for an
--   overview.
module GHC.Utils.Encoding.UTF8

-- | Decode a single character at the given <a>Addr#</a>.
utf8DecodeCharAddr# :: Addr# -> Int# -> (# Char#, Int# #)

-- | Decode a single codepoint starting at the given <a>Ptr</a>.
utf8DecodeCharPtr :: Ptr Word8 -> (Char, Int)

-- | Decode a single codepoint starting at the given byte offset into a
--   <a>ByteArray#</a>.
utf8DecodeCharByteArray# :: ByteArray# -> Int# -> (# Char#, Int# #)

-- | Find the start of the codepoint preceding the codepoint at the given
--   <a>Ptr</a>. This is undefined if there is no previous valid codepoint.
utf8PrevChar :: Ptr Word8 -> IO (Ptr Word8)

-- | Find the start of the codepoint at the given <a>Ptr</a>. This is
--   undefined if there is no previous valid codepoint.
utf8CharStart :: Ptr Word8 -> IO (Ptr Word8)
utf8UnconsByteString :: ByteString -> Maybe (Char, ByteString)

-- | Decode a <a>ByteString</a> containing a UTF-8 string.
utf8DecodeByteString :: ByteString -> [Char]
utf8DecodeShortByteString :: ShortByteString -> [Char]
utf8DecodeForeignPtr :: ForeignPtr Word8 -> Int -> Int -> [Char]
utf8DecodeByteArray# :: ByteArray# -> [Char]
utf8CountCharsShortByteString :: ShortByteString -> Int
utf8CountCharsByteArray# :: ByteArray# -> Int
utf8CompareByteArray# :: ByteArray# -> ByteArray# -> Ordering
utf8CompareShortByteString :: ShortByteString -> ShortByteString -> Ordering
utf8EncodeByteArray# :: String -> ByteArray#
utf8EncodePtr :: Ptr Word8 -> String -> IO ()

-- | Encode a <a>String</a> into a <a>ByteString</a>.
utf8EncodeByteString :: String -> ByteString
utf8EncodeShortByteString :: String -> ShortByteString
utf8EncodedLength :: String -> Int

module GHC.Utils.Encoding
type UserString = String
type EncodedString = String
zEncodeString :: UserString -> EncodedString
zDecodeString :: EncodedString -> UserString
toBase62 :: Word64 -> String

-- | Converts a 64-bit word into a base-62 string
toBase62Padded :: Word64 -> String


-- | An Unicode string for internal GHC use. Meant to replace String in
--   places where being a lazy linked is not very useful and a more memory
--   efficient data structure is desirable.
module GHC.Data.ShortText

-- | A <a>ShortText</a> is a modified UTF-8 encoded string meant for short
--   strings like file paths, module descriptions, etc.
newtype ShortText
ShortText :: ShortByteString -> ShortText
[contents] :: ShortText -> ShortByteString

-- | Create a singleton
singleton :: Char -> ShortText

-- | <i>O(n)</i> Convert a <a>String</a> into a <a>ShortText</a>.
pack :: String -> ShortText

-- | <i>O(n)</i> Convert a <a>ShortText</a> into a <a>String</a>.
unpack :: ShortText -> String

-- | <i>O(n)</i> Returns the length of the <a>ShortText</a> in characters.
codepointLength :: ShortText -> Int

-- | <i>O(1)</i> Returns the length of the <a>ShortText</a> in bytes.
byteLength :: ShortText -> Int

-- | <i>O(1)</i> Test whether the <a>ShortText</a> is the empty string.
null :: ShortText -> Bool

-- | <i>O(n)</i> Split a <a>ShortText</a> representing a file path into its
--   components by separating on the file separator characters for this
--   platform.
splitFilePath :: ShortText -> [ShortText]

-- | <i>O(1)</i> Returns the first UTF-8 codepoint in the <a>ShortText</a>.
--   Depending on the string in question, this may or may not be the actual
--   first character in the string due to Unicode non-printable characters.
head :: ShortText -> Char

-- | <i>O(n)</i> The <a>stripPrefix</a> function takes two
--   <a>ShortText</a>s and returns <a>Just</a> the remainder of the second
--   iff the first is its prefix, and otherwise Nothing.
stripPrefix :: ShortText -> ShortText -> Maybe ShortText
instance Control.DeepSeq.NFData GHC.Data.ShortText.ShortText
instance GHC.Base.Monoid GHC.Data.ShortText.ShortText
instance GHC.Base.Semigroup GHC.Data.ShortText.ShortText
instance Data.Binary.Class.Binary GHC.Data.ShortText.ShortText
instance GHC.Classes.Ord GHC.Data.ShortText.ShortText
instance GHC.Classes.Eq GHC.Data.ShortText.ShortText
instance GHC.Show.Show GHC.Data.ShortText.ShortText
instance Data.String.IsString GHC.Data.ShortText.ShortText


-- | This module provides the view of GHC's database of registered packages
--   that is shared between GHC the compiler/library, and the ghc-pkg
--   program. It defines the database format that is shared between GHC and
--   ghc-pkg.
--   
--   The database format, and this library are constructed so that GHC does
--   not have to depend on the Cabal library. The ghc-pkg program acts as
--   the gateway between the external package format (which is defined by
--   Cabal) and the internal package format which is specialised just for
--   GHC.
--   
--   GHC the compiler only needs some of the information which is kept
--   about registered packages, such as module names, various paths etc. On
--   the other hand ghc-pkg has to keep all the information from Cabal
--   packages and be able to regurgitate it for users and other tools.
--   
--   The first trick is that we duplicate some of the information in the
--   package database. We essentially keep two versions of the database in
--   one file, one version used only by ghc-pkg which keeps the full
--   information (using the serialised form of the
--   <tt>InstalledPackageInfo</tt> type defined by the Cabal library); and
--   a second version written by ghc-pkg and read by GHC which has just the
--   subset of information that GHC needs.
--   
--   The second trick is that this module only defines in detail the format
--   of the second version -- the bit GHC uses -- and the part managed by
--   ghc-pkg is kept in the file but here we treat it as an opaque blob of
--   data. That way this library avoids depending on Cabal.
module GHC.Unit.Database

-- | Information about an unit (a unit is an installed module library).
--   
--   This is a subset of Cabal's <tt>InstalledPackageInfo</tt>, with just
--   the bits that GHC is interested in.
--   
--   Some types are left as parameters to be instantiated differently in
--   ghc-pkg and in ghc itself.
data GenericUnitInfo srcpkgid srcpkgname uid modulename mod
GenericUnitInfo :: uid -> uid -> [(modulename, mod)] -> srcpkgid -> srcpkgname -> Version -> Maybe srcpkgname -> ShortText -> [uid] -> [(uid, ShortText)] -> [FilePathST] -> [ShortText] -> [ShortText] -> [ShortText] -> [FilePathST] -> [FilePathST] -> [ShortText] -> [FilePathST] -> [ShortText] -> [ShortText] -> [ShortText] -> [FilePathST] -> [FilePathST] -> [FilePathST] -> [(modulename, Maybe mod)] -> [modulename] -> Bool -> Bool -> Bool -> GenericUnitInfo srcpkgid srcpkgname uid modulename mod

-- | Unique unit identifier that is used during compilation (e.g. to
--   generate symbols).
[unitId] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> uid

-- | Identifier of an indefinite unit (i.e. with module holes) that this
--   unit is an instance of.
--   
--   For non instantiated units, unitInstanceOf=unitId
[unitInstanceOf] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> uid

-- | How this unit instantiates some of its module holes. Map hole module
--   names to actual module
[unitInstantiations] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(modulename, mod)]

-- | Source package identifier.
--   
--   Cabal instantiates this with Distribution.Types.PackageId.PackageId
--   type which only contains the source package name and version. Notice
--   that it doesn't contain the Hackage revision, nor any kind of hash.
[unitPackageId] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> srcpkgid

-- | Source package name
[unitPackageName] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> srcpkgname

-- | Source package version
[unitPackageVersion] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Version

-- | Name of the component.
--   
--   Cabal supports more than one components (libraries, executables,
--   testsuites) in the same package. Each component has a name except the
--   default one (that can only be a library component) for which we use
--   <a>Nothing</a>.
--   
--   GHC only deals with "library" components as they are the only kind of
--   components that can be registered in a database and used by other
--   modules.
[unitComponentName] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Maybe srcpkgname

-- | ABI hash used to avoid mixing up units compiled with different
--   dependencies, compiler, options, etc.
[unitAbiHash] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> ShortText

-- | Identifiers of the units this one depends on
[unitDepends] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [uid]

-- | Like <a>unitDepends</a>, but each dependency is annotated with the ABI
--   hash we expect the dependency to respect.
[unitAbiDepends] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(uid, ShortText)]

-- | Directories containing module interfaces
[unitImportDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Names of the Haskell libraries provided by this unit
[unitLibraries] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | Names of the external system libraries that this unit depends on. See
--   also <a>unitExtDepLibsGhc</a> field.
[unitExtDepLibsSys] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | Because of slight differences between the GHC dynamic linker (in
--   GHC.Runtime.Linker) and the native system linker, some packages have
--   to link with a different list of libraries when using GHC's. Examples
--   include: libs that are actually gnu ld scripts, and the possibility
--   that the .a libs do not exactly match the .so/.dll equivalents.
--   
--   If this field is set, then we use that instead of the
--   <a>unitExtDepLibsSys</a> field.
[unitExtDepLibsGhc] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | Directories containing libraries provided by this unit. See also
--   <a>unitLibraryDynDirs</a>.
--   
--   It seems to be used to store paths to external library dependencies
--   too.
[unitLibraryDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Directories containing the dynamic libraries provided by this unit.
--   See also <a>unitLibraryDirs</a>.
--   
--   It seems to be used to store paths to external dynamic library
--   dependencies too.
[unitLibraryDynDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Names of the external MacOS frameworks that this unit depends on.
[unitExtDepFrameworks] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | Directories containing MacOS frameworks that this unit depends on.
[unitExtDepFrameworkDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Linker (e.g. ld) command line options
[unitLinkerOptions] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | C compiler options that needs to be passed to the C compiler when we
--   compile some C code against this unit.
[unitCcOptions] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | C header files that are required by this unit (provided by this unit
--   or external)
[unitIncludes] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [ShortText]

-- | Directories containing C header files that this unit depends on.
[unitIncludeDirs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Paths to Haddock interface files for this unit
[unitHaddockInterfaces] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Paths to Haddock directories containing HTML files
[unitHaddockHTMLs] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [FilePathST]

-- | Modules exposed by the unit.
--   
--   A module can be re-exported from another package. In this case, we
--   indicate the module origin in the second parameter.
[unitExposedModules] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [(modulename, Maybe mod)]

-- | Hidden modules.
--   
--   These are useful for error reporting (e.g. if a hidden module is
--   imported)
[unitHiddenModules] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> [modulename]

-- | True if this unit has some module holes that need to be instantiated
--   with real modules to make the unit usable (a.k.a. Backpack).
[unitIsIndefinite] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool

-- | True if the unit is exposed. A unit could be installed in a database
--   by "disabled" by not being exposed.
[unitIsExposed] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool

-- | True if the unit is trusted (cf Safe Haskell)
[unitIsTrusted] :: GenericUnitInfo srcpkgid srcpkgname uid modulename mod -> Bool

-- | <tt>ghc-boot</tt>'s UnitInfo, serialized to the database.
type DbUnitInfo = GenericUnitInfo ByteString ByteString ByteString ByteString DbModule

-- | <tt>ghc-boot</tt>'s <tt>Module</tt>, serialized to the database.
data DbModule
DbModule :: DbInstUnitId -> ByteString -> DbModule
[dbModuleUnitId] :: DbModule -> DbInstUnitId
[dbModuleName] :: DbModule -> ByteString
DbModuleVar :: ByteString -> DbModule
[dbModuleVarName] :: DbModule -> ByteString

-- | <tt>ghc-boot</tt>'s instantiated unit id, serialized to the database.
data DbInstUnitId

-- | Instantiated unit
DbInstUnitId :: ByteString -> [(ByteString, DbModule)] -> DbInstUnitId

-- | Uninstantiated unit
DbUnitId :: ByteString -> DbInstUnitId

-- | Convert between GenericUnitInfo instances
mapGenericUnitInfo :: (uid1 -> uid2) -> (srcpkg1 -> srcpkg2) -> (srcpkgname1 -> srcpkgname2) -> (modname1 -> modname2) -> (mod1 -> mod2) -> GenericUnitInfo srcpkg1 srcpkgname1 uid1 modname1 mod1 -> GenericUnitInfo srcpkg2 srcpkgname2 uid2 modname2 mod2

-- | Mode to open a package db in.
data DbMode
DbReadOnly :: DbMode
DbReadWrite :: DbMode

-- | <a>DbOpenMode</a> holds a value of type <tt>t</tt> but only in
--   <a>DbReadWrite</a> mode. So it is like <a>Maybe</a> but with a type
--   argument for the mode to enforce that the mode is used consistently.
data DbOpenMode (mode :: DbMode) t
[DbOpenReadOnly] :: DbOpenMode 'DbReadOnly t
[DbOpenReadWrite] :: t -> DbOpenMode 'DbReadWrite t
isDbOpenReadMode :: DbOpenMode mode t -> Bool

-- | Read the part of the package DB that GHC is interested in.
readPackageDbForGhc :: FilePath -> IO [DbUnitInfo]

-- | Read the part of the package DB that ghc-pkg is interested in
--   
--   Note that the Binary instance for ghc-pkg's representation of packages
--   is not defined in this package. This is because ghc-pkg uses Cabal
--   types (and Binary instances for these) which this package does not
--   depend on.
--   
--   If we open the package db in read only mode, we get its contents.
--   Otherwise we additionally receive a PackageDbLock that represents a
--   lock on the database, so that we can safely update it later.
readPackageDbForGhcPkg :: Binary pkgs => FilePath -> DbOpenMode mode t -> IO (pkgs, DbOpenMode mode PackageDbLock)

-- | Write the whole of the package DB, both parts.
writePackageDb :: Binary pkgs => FilePath -> [DbUnitInfo] -> pkgs -> IO ()

-- | Represents a lock of a package db.
data PackageDbLock

-- | Acquire an exclusive lock related to package DB under given location.
lockPackageDb :: FilePath -> IO PackageDbLock

-- | Release the lock related to package DB.
unlockPackageDb :: PackageDbLock -> IO ()
mkMungePathUrl :: FilePathST -> FilePathST -> (FilePathST -> FilePathST, FilePathST -> FilePathST)

-- | Perform path/URL variable substitution as per the Cabal ${pkgroot}
--   spec
--   (http:/<i>www.haskell.org</i>pipermail<i>libraries</i>2009-May/011772.html)
--   Paths/URLs can be relative to ${pkgroot} or ${pkgrooturl}. The
--   "pkgroot" is the directory containing the package database.
--   
--   Also perform a similar substitution for the older GHC-specific
--   "$topdir" variable. The "topdir" is the location of the ghc
--   installation (obtained from the -B option).
mungeUnitInfoPaths :: FilePathST -> FilePathST -> GenericUnitInfo a b c d e -> GenericUnitInfo a b c d e
instance (GHC.Show.Show uid, GHC.Show.Show modulename, GHC.Show.Show mod, GHC.Show.Show srcpkgid, GHC.Show.Show srcpkgname) => GHC.Show.Show (GHC.Unit.Database.GenericUnitInfo srcpkgid srcpkgname uid modulename mod)
instance (GHC.Classes.Eq uid, GHC.Classes.Eq modulename, GHC.Classes.Eq mod, GHC.Classes.Eq srcpkgid, GHC.Classes.Eq srcpkgname) => GHC.Classes.Eq (GHC.Unit.Database.GenericUnitInfo srcpkgid srcpkgname uid modulename mod)
instance GHC.Show.Show GHC.Unit.Database.DbModule
instance GHC.Classes.Eq GHC.Unit.Database.DbModule
instance GHC.Show.Show GHC.Unit.Database.DbInstUnitId
instance GHC.Classes.Eq GHC.Unit.Database.DbInstUnitId
instance GHC.Base.Functor (GHC.Unit.Database.DbOpenMode mode)
instance Data.Foldable.Foldable (GHC.Unit.Database.DbOpenMode mode)
instance Data.Traversable.Traversable (GHC.Unit.Database.DbOpenMode mode)
instance Data.Binary.Class.Binary GHC.Unit.Database.DbUnitInfo
instance Data.Binary.Class.Binary GHC.Unit.Database.DbModule
instance Data.Binary.Class.Binary GHC.Unit.Database.DbInstUnitId

module GHC.Version
cProjectGitCommitId :: String
cProjectVersion :: String
cProjectVersionInt :: String
cProjectPatchLevel :: String
cProjectPatchLevel1 :: String
cProjectPatchLevel2 :: String

module GHC.UniqueSubdir

-- | A filepath like <tt>x86_64-linux-7.6.3</tt> with the platform string
--   to use when constructing platform-version-dependent files that need to
--   co-exist.
uniqueSubdir :: ArchOS -> FilePath
