Safe Haskell | None |
---|---|
Language | Haskell98 |
Distribution.PackageDescription.TH
Description
Utility functions for reading cabal file fields through template haskell.
Synopsis
- packageVariable :: Text a => (PackageDescription -> a) -> Q Exp
- packageVariableFrom :: Text a => FilePath -> (PackageDescription -> a) -> Q Exp
- packageString :: String -> DocString
- data PackageDescription = PackageDescription {
- specVersionRaw :: Either Version VersionRange
- package :: PackageIdentifier
- licenseRaw :: Either License License
- licenseFiles :: [FilePath]
- copyright :: String
- maintainer :: String
- author :: String
- stability :: String
- testedWith :: [(CompilerFlavor, VersionRange)]
- homepage :: String
- pkgUrl :: String
- bugReports :: String
- sourceRepos :: [SourceRepo]
- synopsis :: String
- description :: String
- category :: String
- customFieldsPD :: [(String, String)]
- buildTypeRaw :: Maybe BuildType
- setupBuildInfo :: Maybe SetupBuildInfo
- library :: Maybe Library
- subLibraries :: [Library]
- executables :: [Executable]
- foreignLibs :: [ForeignLib]
- testSuites :: [TestSuite]
- benchmarks :: [Benchmark]
- dataFiles :: [FilePath]
- dataDir :: FilePath
- extraSrcFiles :: [FilePath]
- extraTmpFiles :: [FilePath]
- extraDocFiles :: [FilePath]
- data PackageIdentifier = PackageIdentifier {
- pkgName :: PackageName
- pkgVersion :: Version
- data Version
Template Haskell functions
packageVariable :: Text a => (PackageDescription -> a) -> Q Exp Source #
Renders the package variable specified by the function. The cabal file interrogated is the first one that is found in the current working directory.
packageVariableFrom :: Text a => FilePath -> (PackageDescription -> a) -> Q Exp Source #
Renders the package variable specified by the function, from a cabal file and the given path.
packageString :: String -> DocString Source #
Provides a Text instance for String, allowing text fields to be used
in packageVariable
. Use it composed with an accessor, eg.
packageVariable (packageString . copyright)
Cabal file data structures
The data structures for the cabal file are re-exported here for ease of use.
data PackageDescription #
Constructors
PackageDescription | |
Fields
|
Instances
Eq PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods (==) :: PackageDescription -> PackageDescription -> Bool (/=) :: PackageDescription -> PackageDescription -> Bool | |
Data PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PackageDescription -> c PackageDescription gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PackageDescription toConstr :: PackageDescription -> Constr dataTypeOf :: PackageDescription -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PackageDescription) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PackageDescription) gmapT :: (forall b. Data b => b -> b) -> PackageDescription -> PackageDescription gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PackageDescription -> r gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PackageDescription -> r gmapQ :: (forall d. Data d => d -> u) -> PackageDescription -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> PackageDescription -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> PackageDescription -> m PackageDescription gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PackageDescription -> m PackageDescription gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PackageDescription -> m PackageDescription | |
Read PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods readsPrec :: Int -> ReadS PackageDescription readList :: ReadS [PackageDescription] readPrec :: ReadPrec PackageDescription readListPrec :: ReadPrec [PackageDescription] | |
Show PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods showsPrec :: Int -> PackageDescription -> ShowS show :: PackageDescription -> String showList :: [PackageDescription] -> ShowS | |
Generic PackageDescription | |
Defined in Distribution.Types.PackageDescription Associated Types type Rep PackageDescription :: Type -> Type Methods from :: PackageDescription -> Rep PackageDescription x to :: Rep PackageDescription x -> PackageDescription | |
Package PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods | |
Binary PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods put :: PackageDescription -> Put get :: Get PackageDescription putList :: [PackageDescription] -> Put | |
NFData PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods rnf :: PackageDescription -> () | |
HasBuildInfos PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods traverseBuildInfos :: Traversal' PackageDescription BuildInfo | |
type Rep PackageDescription | |
Defined in Distribution.Types.PackageDescription type Rep PackageDescription = D1 (MetaData "PackageDescription" "Distribution.Types.PackageDescription" "Cabal-2.4.0.1" False) (C1 (MetaCons "PackageDescription" PrefixI True) ((((S1 (MetaSel (Just "specVersionRaw") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Either Version VersionRange)) :*: (S1 (MetaSel (Just "package") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageIdentifier) :*: S1 (MetaSel (Just "licenseRaw") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Either License License)))) :*: ((S1 (MetaSel (Just "licenseFiles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath]) :*: S1 (MetaSel (Just "copyright") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)) :*: (S1 (MetaSel (Just "maintainer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "author") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String)))) :*: (((S1 (MetaSel (Just "stability") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "testedWith") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(CompilerFlavor, VersionRange)])) :*: (S1 (MetaSel (Just "homepage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "pkgUrl") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) :*: ((S1 (MetaSel (Just "bugReports") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "sourceRepos") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [SourceRepo])) :*: (S1 (MetaSel (Just "synopsis") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: S1 (MetaSel (Just "description") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))))) :*: (((S1 (MetaSel (Just "category") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String) :*: (S1 (MetaSel (Just "customFieldsPD") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(String, String)]) :*: S1 (MetaSel (Just "buildTypeRaw") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe BuildType)))) :*: ((S1 (MetaSel (Just "setupBuildInfo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe SetupBuildInfo)) :*: S1 (MetaSel (Just "library") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Library))) :*: (S1 (MetaSel (Just "subLibraries") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Library]) :*: S1 (MetaSel (Just "executables") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Executable])))) :*: (((S1 (MetaSel (Just "foreignLibs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [ForeignLib]) :*: S1 (MetaSel (Just "testSuites") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [TestSuite])) :*: (S1 (MetaSel (Just "benchmarks") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Benchmark]) :*: S1 (MetaSel (Just "dataFiles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath]))) :*: ((S1 (MetaSel (Just "dataDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FilePath) :*: S1 (MetaSel (Just "extraSrcFiles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])) :*: (S1 (MetaSel (Just "extraTmpFiles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath]) :*: S1 (MetaSel (Just "extraDocFiles") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath]))))))) |
data PackageIdentifier #
Constructors
PackageIdentifier | |
Fields
|
Instances
Eq PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods (==) :: PackageIdentifier -> PackageIdentifier -> Bool (/=) :: PackageIdentifier -> PackageIdentifier -> Bool | |
Data PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PackageIdentifier -> c PackageIdentifier gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PackageIdentifier toConstr :: PackageIdentifier -> Constr dataTypeOf :: PackageIdentifier -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PackageIdentifier) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PackageIdentifier) gmapT :: (forall b. Data b => b -> b) -> PackageIdentifier -> PackageIdentifier gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PackageIdentifier -> r gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PackageIdentifier -> r gmapQ :: (forall d. Data d => d -> u) -> PackageIdentifier -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> PackageIdentifier -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> PackageIdentifier -> m PackageIdentifier gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PackageIdentifier -> m PackageIdentifier gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PackageIdentifier -> m PackageIdentifier | |
Ord PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods compare :: PackageIdentifier -> PackageIdentifier -> Ordering (<) :: PackageIdentifier -> PackageIdentifier -> Bool (<=) :: PackageIdentifier -> PackageIdentifier -> Bool (>) :: PackageIdentifier -> PackageIdentifier -> Bool (>=) :: PackageIdentifier -> PackageIdentifier -> Bool max :: PackageIdentifier -> PackageIdentifier -> PackageIdentifier min :: PackageIdentifier -> PackageIdentifier -> PackageIdentifier | |
Read PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods readsPrec :: Int -> ReadS PackageIdentifier readList :: ReadS [PackageIdentifier] readPrec :: ReadPrec PackageIdentifier readListPrec :: ReadPrec [PackageIdentifier] | |
Show PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods showsPrec :: Int -> PackageIdentifier -> ShowS show :: PackageIdentifier -> String showList :: [PackageIdentifier] -> ShowS | |
Generic PackageIdentifier | |
Defined in Distribution.Types.PackageId Associated Types type Rep PackageIdentifier :: Type -> Type Methods from :: PackageIdentifier -> Rep PackageIdentifier x to :: Rep PackageIdentifier x -> PackageIdentifier | |
Package PackageIdentifier | |
Defined in Distribution.Package Methods | |
Text PackageIdentifier | |
Defined in Distribution.Types.PackageId | |
Pretty PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods pretty :: PackageIdentifier -> Doc | |
Parsec PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods parsec :: CabalParsing m => m PackageIdentifier | |
Binary PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods put :: PackageIdentifier -> Put get :: Get PackageIdentifier putList :: [PackageIdentifier] -> Put | |
NFData PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods rnf :: PackageIdentifier -> () | |
type Rep PackageIdentifier | |
Defined in Distribution.Types.PackageId type Rep PackageIdentifier = D1 (MetaData "PackageIdentifier" "Distribution.Types.PackageId" "Cabal-2.4.0.1" False) (C1 (MetaCons "PackageIdentifier" PrefixI True) (S1 (MetaSel (Just "pkgName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 PackageName) :*: S1 (MetaSel (Just "pkgVersion") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Version))) |
Instances
Eq Version | |
Data Version | |
Defined in Distribution.Types.Version Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Version -> c Version gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Version dataTypeOf :: Version -> DataType dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Version) dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Version) gmapT :: (forall b. Data b => b -> b) -> Version -> Version gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r gmapQ :: (forall d. Data d => d -> u) -> Version -> [u] gmapQi :: Int -> (forall d. Data d => d -> u) -> Version -> u gmapM :: Monad m => (forall d. Data d => d -> m d) -> Version -> m Version gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version | |
Ord Version | |
Read Version | |
Defined in Distribution.Types.Version | |
Show Version | |
Generic Version | |
Text Version | |
Defined in Distribution.Types.Version | |
Pretty Version | |
Defined in Distribution.Types.Version | |
Parsec Version | |
Defined in Distribution.Types.Version | |
Binary Version | |
NFData Version | |
Defined in Distribution.Types.Version | |
type Rep Version | |
Defined in Distribution.Types.Version type Rep Version = D1 (MetaData "Version" "Distribution.Types.Version" "Cabal-2.4.0.1" False) (C1 (MetaCons "PV0" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) SourceUnpack SourceStrict DecidedUnpack) (Rec0 Word64)) :+: C1 (MetaCons "PV1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Int]))) |