stack-1.0.4.1: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.Package

Description

Dealing with Cabal.

Synopsis

Documentation

readPackage :: (MonadLogger m, MonadIO m, MonadThrow m, MonadCatch m) => PackageConfig -> Path Abs File -> m ([PWarning], Package) Source

Reads and exposes the package information

readPackageBS :: MonadThrow m => PackageConfig -> ByteString -> m ([PWarning], Package) Source

Reads and exposes the package information, from a ByteString

readPackageUnresolved :: (MonadIO m, MonadThrow m) => Path Abs File -> m ([PWarning], GenericPackageDescription) Source

Read the raw, unresolved package information.

readPackageUnresolvedBS :: MonadThrow m => Maybe (Path Abs File) -> ByteString -> m ([PWarning], GenericPackageDescription) Source

Read the raw, unresolved package information from a ByteString.

resolvePackage :: PackageConfig -> GenericPackageDescription -> Package Source

Resolve a parsed cabal file into a Package.

findOrGenerateCabalFile Source

Arguments

:: (MonadThrow m, MonadIO m) 
=> Path Abs Dir

package directory

-> m (Path Abs File) 

Get the filename for the cabal file in the given directory.

If no .cabal file is present, or more than one is present, an exception is thrown via throwM.

If the directory contains a file named package.yaml, hpack is used to generate a .cabal file from it.

data Package Source

Some package info.

Constructors

Package 

Fields

packageName :: !PackageName

Name of the package.

packageVersion :: !Version

Version of the package

packageFiles :: !GetPackageFiles

Get all files of the package.

packageDeps :: !(Map PackageName VersionRange)

Packages that the package depends on.

packageTools :: ![Dependency]

A build tool name.

packageAllDeps :: !(Set PackageName)

Original dependencies (not sieved).

packageFlags :: !(Map FlagName Bool)

Flags used on package.

packageHasLibrary :: !Bool

does the package have a buildable library stanza?

packageTests :: !(Map Text TestSuiteInterface)

names and interfaces of test suites

packageBenchmarks :: !(Set Text)

names of benchmarks

packageExes :: !(Set Text)

names of executables

packageOpts :: !GetPackageOpts

Args to pass to GHC.

packageHasExposedModules :: !Bool

Does the package have exposed modules?

packageSimpleType :: !Bool

Does the package of build-type: Simple

packageDefinedFlags :: !(Set FlagName)

All flags defined in the .cabal file

Instances

Eq Package Source

Compares the package name.

Ord Package Source

Compares the package name.

Show Package Source 

newtype GetPackageFiles Source

Files that the package depends on, relative to package directory. Argument is the location of the .cabal file

newtype GetPackageOpts Source

Files that the package depends on, relative to package directory. Argument is the location of the .cabal file

data PackageConfig Source

Package build configuration

Constructors

PackageConfig 

Fields

packageConfigEnableTests :: !Bool

Are tests enabled?

packageConfigEnableBenchmarks :: !Bool

Are benchmarks enabled?

packageConfigFlags :: !(Map FlagName Bool)

Package config flags.

packageConfigCompilerVersion :: !CompilerVersion

GHC version

packageConfigPlatform :: !Platform

host platform

buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File) Source

Path for the package's build log.

resolvePackageDescription :: PackageConfig -> GenericPackageDescription -> PackageDescription Source

Get all dependencies of a package, including library, executables, tests, benchmarks.

packageToolDependencies :: PackageDescription -> Map Text VersionRange Source

Get all build tool dependencies of the package (buildable targets only).

packageDependencies :: PackageDescription -> Map PackageName VersionRange Source

Get all dependencies of the package (buildable targets only).

autogenDir :: Path Abs Dir -> Path Abs Dir Source

Make the autogen dir.

checkCabalFileName :: MonadThrow m => PackageName -> Path Abs File -> m () Source

Check if the given name in the Package matches the name of the .cabal file

printCabalFileWarning :: MonadLogger m => Path Abs File -> PWarning -> m () Source

Print cabal file warnings.

cabalFilePackageId :: (Applicative m, MonadIO m, MonadThrow m) => Path Abs File -> m PackageIdentifier Source

Extract the PackageIdentifier given an exploded haskell package path.