-- 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.PackageDb</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 8.0.1

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 :: 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


-- | 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 registerd 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 datbase in
--   one file, one version used only by ghc-pkg which keeps the full
--   information (using the serialised form of the
--   <a>InstalledPackageInfo</a> 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.PackageDb

-- | This is a subset of Cabal's <a>InstalledPackageInfo</a>, with just the
--   bits that GHC is interested in.
data InstalledPackageInfo srcpkgid srcpkgname unitid modulename
InstalledPackageInfo :: unitid -> srcpkgid -> srcpkgname -> Version -> String -> [unitid] -> [FilePath] -> [String] -> [String] -> [String] -> [FilePath] -> [String] -> [FilePath] -> [String] -> [String] -> [String] -> [FilePath] -> [FilePath] -> [FilePath] -> [ExposedModule unitid modulename] -> [modulename] -> Bool -> Bool -> InstalledPackageInfo srcpkgid srcpkgname unitid modulename
[unitId] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> unitid
[sourcePackageId] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> srcpkgid
[packageName] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> srcpkgname
[packageVersion] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> Version
[abiHash] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> String
[depends] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [unitid]
[importDirs] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [FilePath]
[hsLibraries] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[extraLibraries] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[extraGHCiLibraries] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[libraryDirs] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [FilePath]
[frameworks] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[frameworkDirs] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [FilePath]
[ldOptions] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[ccOptions] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[includes] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [String]
[includeDirs] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [FilePath]
[haddockInterfaces] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [FilePath]
[haddockHTMLs] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [FilePath]
[exposedModules] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [ExposedModule unitid modulename]
[hiddenModules] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> [modulename]
[exposed] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> Bool
[trusted] :: InstalledPackageInfo srcpkgid srcpkgname unitid modulename -> Bool

-- | Represents a module name which is exported by a package, stored in the
--   <a>exposedModules</a> field. A module export may be a reexport (in
--   which case <a>exposedReexport</a> is filled in with the original
--   source of the module). Thus:
--   
--   <ul>
--   <li><tt>ExposedModule n Nothing</tt> represents an exposed module
--   <tt>n</tt> which was defined in this package.</li>
--   <li><tt>ExposedModule n (Just o)</tt> represents a reexported module
--   <tt>n</tt> which was originally defined in <tt>o</tt>.</li>
--   </ul>
--   
--   We use a <a>Maybe</a> data types instead of an ADT with two branches
--   because this representation allows us to treat reexports uniformly.
data ExposedModule unitid modulename
ExposedModule :: modulename -> Maybe (OriginalModule unitid modulename) -> ExposedModule unitid modulename
[exposedName] :: ExposedModule unitid modulename -> modulename
[exposedReexport] :: ExposedModule unitid modulename -> Maybe (OriginalModule unitid modulename)

-- | An original module is a fully-qualified module name (installed package
--   ID plus module name) representing where a module was *originally*
--   defined (i.e., the <a>exposedReexport</a> field of the original
--   ExposedModule entry should be <a>Nothing</a>). Invariant: an
--   OriginalModule never points to a reexport.
data OriginalModule unitid modulename
OriginalModule :: unitid -> modulename -> OriginalModule unitid modulename
[originalPackageId] :: OriginalModule unitid modulename -> unitid
[originalModuleName] :: OriginalModule unitid modulename -> modulename
class BinaryStringRep a
fromStringRep :: BinaryStringRep a => ByteString -> a
toStringRep :: BinaryStringRep a => a -> ByteString
emptyInstalledPackageInfo :: RepInstalledPackageInfo a b c d => InstalledPackageInfo a b c d

-- | Read the part of the package DB that GHC is interested in.
readPackageDbForGhc :: RepInstalledPackageInfo a b c d => FilePath -> IO [InstalledPackageInfo a b c d]

-- | 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.
readPackageDbForGhcPkg :: Binary pkgs => FilePath -> IO pkgs

-- | Write the whole of the package DB, both parts.
writePackageDb :: (Binary pkgs, RepInstalledPackageInfo a b c d) => FilePath -> [InstalledPackageInfo a b c d] -> pkgs -> IO ()
instance (GHC.Show.Show srcpkgid, GHC.Show.Show srcpkgname, GHC.Show.Show unitid, GHC.Show.Show modulename) => GHC.Show.Show (GHC.PackageDb.InstalledPackageInfo srcpkgid srcpkgname unitid modulename)
instance (GHC.Classes.Eq srcpkgid, GHC.Classes.Eq srcpkgname, GHC.Classes.Eq unitid, GHC.Classes.Eq modulename) => GHC.Classes.Eq (GHC.PackageDb.InstalledPackageInfo srcpkgid srcpkgname unitid modulename)
instance (GHC.Show.Show unitid, GHC.Show.Show modulename) => GHC.Show.Show (GHC.PackageDb.ExposedModule unitid modulename)
instance (GHC.Classes.Eq unitid, GHC.Classes.Eq modulename) => GHC.Classes.Eq (GHC.PackageDb.ExposedModule unitid modulename)
instance (GHC.Show.Show unitid, GHC.Show.Show modulename) => GHC.Show.Show (GHC.PackageDb.OriginalModule unitid modulename)
instance (GHC.Classes.Eq unitid, GHC.Classes.Eq modulename) => GHC.Classes.Eq (GHC.PackageDb.OriginalModule unitid modulename)
instance GHC.PackageDb.RepInstalledPackageInfo a b c d => Data.Binary.Class.Binary (GHC.PackageDb.InstalledPackageInfo a b c d)
instance (GHC.PackageDb.BinaryStringRep a, GHC.PackageDb.BinaryStringRep b) => Data.Binary.Class.Binary (GHC.PackageDb.OriginalModule a b)
instance (GHC.PackageDb.BinaryStringRep a, GHC.PackageDb.BinaryStringRep b) => Data.Binary.Class.Binary (GHC.PackageDb.ExposedModule a b)

module GHC.Lexeme

module GHC.LanguageExtensions.Type


-- | 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
