-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | dynamic-cabal
--
-- dynamic-cabal
@package dynamic-cabal
@version 0.3.2
-- | Functions for building queries on cabal's setup-config an evaluating
-- them.
module Distribution.Client.Dynamic.Query
-- | A selector is a generator for a function of type i -> o.
data Selector i o
-- | Build a selector. The expression the selector generates can depend on
-- the cabal version.
selector :: (Version -> ExpG (i -> o)) -> Selector i o
-- | A query is like a Selector, but it cannot be composed any futher using
-- a Category instance. It can have a Functor and Applicative instance
-- though. To execute a query, you only need to run GHC once.
data Query s a
-- | Build a query from a selector.
query :: Typeable a => Selector s a -> Query s a
-- | This is just a dummy type representing a LocalBuildInfo. You don't
-- have to use this type, it is just used to tag queries and make them
-- more type-safe.
data LocalBuildInfo
-- | A Selector to get something out of a Maybe if you supply a default
-- value.
maybeDefault :: (GenExpType a ~ a, GenExp a) => a -> Selector (Maybe a) a
-- | The same as (=<<<), but flipped.
(>>>=) :: Monad m => Selector a (m b) -> Selector b (m c) -> Selector a (m c)
-- | Compose two selectors, monadically.
(=<<<) :: Monad m => Selector b (m c) -> Selector a (m b) -> Selector a (m c)
-- | Lift a selector to work on functorial inputs and outputs.
fmapS :: Functor m => Selector a b -> Selector (m a) (m b)
-- | Lift a query to work over functors.
fmapQ :: (Functor f, Typeable1 f) => Query s a -> Query (f s) (f a)
-- | Use a selector to run a query in a bigger environment than it was
-- defined in.
on :: Selector i o -> Query o r -> Query i r
-- | Run a query. This will generate the source code for the query and then
-- invoke GHC to run it.
runQuery :: Query LocalBuildInfo a -> FilePath -> IO a
-- | Run a raw query, getting the full source from the first parameter the
-- module must be DynamicCabalQuery and it must have a result declaration
runRawQuery :: Typeable a => String -> FilePath -> IO a
getCabalVersion :: FilePath -> IO Version
instance [overlap ok] Typeable LocalBuildInfo
instance [overlap ok] Typeable1 LeftoverTempDir
instance [overlap ok] Read LocalBuildInfo
instance [overlap ok] Exception e => Exception (LeftoverTempDir e)
instance [overlap ok] Show e => Show (LeftoverTempDir e)
instance [overlap ok] Applicative (Query s)
instance [overlap ok] Functor (Query s)
instance [overlap ok] Category Selector
-- | This module contains queries that operate on a PackageDescription. It
-- provides a function to extract all targets along with their
-- dependencies.
module Distribution.Client.Dynamic.PackageDescription
-- | A target is a single Library, an Executable, a TestSuite or a
-- Benchmark.
data Target
Target :: TargetInfo -> [(String, Maybe Version)] -> [FilePath] -> [FilePath] -> [String] -> [String] -> [String] -> Bool -> [String] -> [String] -> Bool -> Target
-- | The specific info of the target
info :: Target -> TargetInfo
-- | All dependencies of the target, with their versions. If the version is
-- not resolved yet, it'll be Nothing. That only happens when the target
-- is not enabled, though.
dependencies :: Target -> [(String, Maybe Version)]
-- | Directories where to look for source files.
sourceDirs :: Target -> [FilePath]
-- | Directories where to look for header files.
includeDirs :: Target -> [FilePath]
-- | Additional options to pass to GHC when compiling source files.
ghcOptions :: Target -> [String]
-- | Additional options to pass to CPP preprocessor when compiling source
-- files.
cppOptions :: Target -> [String]
-- | The extensions to enable/disable. The elements are like GHC's -X
-- flags, a disabled extension is represented as the extension name
-- prefixed by No.
--
-- Example value: extensions = [ScopedTypeVariables,
-- NoMultiParamTypeClasses]
extensions :: Target -> [String]
-- | The buildable field in the package description.
buildable :: Target -> Bool
-- | other modules included in the target
otherModules :: Target -> [String]
-- | The 'c-sources' field in the package description.
cSources :: Target -> [String]
-- | Whether this target was enabled or not. This only matters for
-- Benchmarks or Tests, Executables and Libraries are always enabled.
enabled :: Target -> Bool
-- | The specific information on a target, depending on the target type.
-- Libraries don't have a name, they are always named after the package,
-- but other types do
data TargetInfo
-- | contains the names of exposed modules
Library :: [String] -> TargetInfo
-- | contains the name of the executable and the path to the Main module
Executable :: String -> FilePath -> TargetInfo
-- | contains the name of the test suite and the path to the Main module,
-- for stdio tests
TestSuite :: String -> (Maybe FilePath) -> TargetInfo
-- | contains the name of the benchmark and the path to the Main module,
-- for stdio benchmarks
BenchSuite :: String -> (Maybe FilePath) -> TargetInfo
-- | A package description type. This type has no constructors, and is only
-- used for type-safety purposes.
data PackageDescription
-- | Query the available targets. This will return all targets, even
-- disabled ones. If a package is disabled or not buildable, it's
-- possible that not all dependencies have versions, some can be Nothing.
targets :: Query PackageDescription [Target]
-- | return the target name, or the empty string for the library target
targetName :: Target -> String
-- | is the target the library?
isLibrary :: Target -> Bool
-- | is the target an executable?
isExecutable :: Target -> Bool
-- | is the target a test suite?
isTest :: Target -> Bool
-- | is the target a benchmark?
isBench :: Target -> Bool
-- | Traverse the name of a target, if available (libraries don't have
-- names).
_name :: Applicative f => (String -> f String) -> TargetInfo -> f TargetInfo
-- | Traverse the path of the main module, if available.
_mainModule :: Applicative f => (FilePath -> f FilePath) -> TargetInfo -> f TargetInfo
_info :: Functor f => (TargetInfo -> f TargetInfo) -> Target -> f Target
_dependencies :: Functor f => ([(String, Maybe Version)] -> f [(String, Maybe Version)]) -> Target -> f Target
_sourceDirs :: Functor f => ([FilePath] -> f [FilePath]) -> Target -> f Target
_includeDirs :: Functor f => ([FilePath] -> f [FilePath]) -> Target -> f Target
_ghcOptions :: Functor f => ([String] -> f [String]) -> Target -> f Target
_cppOptions :: Functor f => ([String] -> f [String]) -> Target -> f Target
_extensions :: Functor f => ([String] -> f [String]) -> Target -> f Target
_buildable :: Functor f => (Bool -> f Bool) -> Target -> f Target
_otherModules :: Functor f => ([String] -> f [String]) -> Target -> f Target
_enabled :: Functor f => (Bool -> f Bool) -> Target -> f Target
instance Show TargetInfo
instance Eq TargetInfo
instance Read TargetInfo
instance Ord TargetInfo
instance Show Target
instance Eq Target
instance Read Target
instance Default Target
instance Default TargetInfo
instance Eq CompilerFlavor
module Distribution.Client.Dynamic.LocalBuildInfo
-- | A package db is either the user package db (often at
-- ~.ghcghc-....), the global package or a specific file
-- or directory.
data PackageDB
UserDB :: PackageDB
GlobalDB :: PackageDB
SpecificDB :: FilePath -> PackageDB
-- | Get the package dbs that ghc will use when compiling this package.
packageDBs :: Query LocalBuildInfo [PackageDB]
-- | Returns the builddir of a LocalBuildInfo. Often, this will just be
-- dist.
buildDir :: Selector LocalBuildInfo String
-- | Returns the package description included in a local build info.
localPkgDesc :: Selector LocalBuildInfo PackageDescription
instance Eq PackageDB
instance Ord PackageDB
instance Show PackageDB
instance Read PackageDB
module Distribution.Client.Dynamic