License | GPL-3.0-or-later AND BSD-3-Clause |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data Project uri opt pkg = Project {
- prjPackages :: [pkg]
- prjOptPackages :: [opt]
- prjUriPackages :: [uri]
- prjConstraints :: [String]
- prjAllowNewer :: [String]
- prjReorderGoals :: Bool
- prjMaxBackjumps :: Maybe Int
- prjOptimization :: Optimization
- prjSourceRepos :: [SourceRepositoryPackage Maybe]
- prjOtherFields :: [PrettyField ()]
- triverseProject :: Applicative f => (uri -> f uri') -> (opt -> f opt') -> (pkg -> f pkg') -> Project uri opt pkg -> f (Project uri' opt' pkg')
- emptyProject :: Project c b a
- readProject :: FilePath -> IO (Project URI Void (FilePath, GenericPackageDescription))
- parseProject :: FilePath -> ByteString -> Either (ParseError NonEmpty) (Project Void String String)
- resolveProject :: FilePath -> Project Void String String -> IO (Either ResolveError (Project URI Void FilePath))
- newtype ResolveError = BadPackageLocation String
- renderResolveError :: ResolveError -> String
- readPackagesOfProject :: Project uri opt FilePath -> IO (Either (ParseError NonEmpty) (Project uri opt (FilePath, GenericPackageDescription)))
Project
data Project uri opt pkg Source #
cabal.project
file
Project | |
|
Instances
triverseProject :: Applicative f => (uri -> f uri') -> (opt -> f opt') -> (pkg -> f pkg') -> Project uri opt pkg -> f (Project uri' opt' pkg') Source #
emptyProject :: Project c b a Source #
Empty project.
Parse project
readProject :: FilePath -> IO (Project URI Void (FilePath, GenericPackageDescription)) Source #
High level conviniene function to read and elaborate cabal.project
files
May throw IOException
when file doesn't exist, ParseError
on parse errors, or ResolveError
on package resolution error.
parseProject :: FilePath -> ByteString -> Either (ParseError NonEmpty) (Project Void String String) Source #
Parse project file. Extracts only few fields.
>>>
fmap prjPackages $ parseProject "cabal.project" "packages: foo bar/*.cabal"
Right ["foo","bar/*.cabal"]
Resolve project
:: FilePath | filename of project file |
-> Project Void String String | parsed project file |
-> IO (Either ResolveError (Project URI Void FilePath)) | resolved project |
Resolve project package locations.
Separate URI
packages, glob packages
and optional-packages
into individual fields.
The result prjPackages
FilePath
s will be relative to the
directory of the project file.
newtype ResolveError Source #
A resolveProject
error.
Instances
Show ResolveError Source # | |
Defined in Cabal.Project showsPrec :: Int -> ResolveError -> ShowS # show :: ResolveError -> String # showList :: [ResolveError] -> ShowS # | |
Exception ResolveError Source # | |
Defined in Cabal.Project |
renderResolveError :: ResolveError -> String Source #
Pretty print ResolveError
.
Read packages
readPackagesOfProject :: Project uri opt FilePath -> IO (Either (ParseError NonEmpty) (Project uri opt (FilePath, GenericPackageDescription))) Source #
Read and parse the cabal files of packages in the Project
.
May throw IOException
.