Safe Haskell | None |
---|---|
Language | Haskell98 |
Distribution.PackageDescription.TH
Description
Utility functions for reading cabal file fields through template haskell.
Synopsis
- packageVariable :: Pretty a => (PackageDescription -> a) -> Q Exp
- packageVariableFrom :: Pretty 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 :: !ShortText
- maintainer :: !ShortText
- author :: !ShortText
- stability :: !ShortText
- testedWith :: [(CompilerFlavor, VersionRange)]
- homepage :: !ShortText
- pkgUrl :: !ShortText
- bugReports :: !ShortText
- sourceRepos :: [SourceRepo]
- synopsis :: !ShortText
- description :: !ShortText
- category :: !ShortText
- 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
Template Haskell functions
packageVariable :: Pretty 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 :: Pretty 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 Pretty 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 :: forall r r'. (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 | |
Structured PackageDescription | |
Defined in Distribution.Types.PackageDescription Methods structure :: Proxy PackageDescription -> Structure structureHash' :: Tagged PackageDescription MD5 | |
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-3.2.1.0" '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 'SourceStrict 'DecidedUnpack) (Rec0 ShortText)) :*: (S1 ('MetaSel ('Just "maintainer") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "author") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText)))) :*: (((S1 ('MetaSel ('Just "stability") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "testedWith") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(CompilerFlavor, VersionRange)])) :*: (S1 ('MetaSel ('Just "homepage") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "pkgUrl") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText))) :*: ((S1 ('MetaSel ('Just "bugReports") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "sourceRepos") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [SourceRepo])) :*: (S1 ('MetaSel ('Just "synopsis") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText) :*: S1 ('MetaSel ('Just "description") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText))))) :*: (((S1 ('MetaSel ('Just "category") 'NoSourceUnpackedness 'SourceStrict 'DecidedUnpack) (Rec0 ShortText) :*: (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 :: forall r r'. (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 | |
Pretty PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods pretty :: PackageIdentifier -> Doc prettyVersioned :: CabalSpecVersion -> PackageIdentifier -> Doc | |
Binary PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods put :: PackageIdentifier -> Put get :: Get PackageIdentifier putList :: [PackageIdentifier] -> Put | |
Structured PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods structure :: Proxy PackageIdentifier -> Structure structureHash' :: Tagged PackageIdentifier MD5 | |
NFData PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods rnf :: PackageIdentifier -> () | |
Parsec PackageIdentifier | |
Defined in Distribution.Types.PackageId Methods parsec :: CabalParsing m => m PackageIdentifier | |
type Rep PackageIdentifier | |
Defined in Distribution.Types.PackageId type Rep PackageIdentifier = D1 ('MetaData "PackageIdentifier" "Distribution.Types.PackageId" "Cabal-3.2.1.0" 'False) (C1 ('MetaCons "PackageIdentifier" 'PrefixI 'True) (S1 ('MetaSel ('Just "pkgName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: S1 ('MetaSel ('Just "pkgVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version))) |