stack-1.3.0: The Haskell Tool Stack

Safe HaskellNone





checkResolverSpec :: (StackM env m, HasConfig env, HasGHCVariant env) => [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> Resolver -> m BuildPlanCheck Source

Given a bundle of user packages, flag constraints on those packages and a resolver, determine if the resolver fully, partially or fails to satisfy the dependencies of the user packages.

If the package flags are passed as Nothing then flags are chosen automatically.

cabalPackagesCheck :: (StackM env m, HasConfig env, HasGHCVariant env) => [Path Abs File] -> String -> Maybe String -> m (Map PackageName (Path Abs File, GenericPackageDescription), [Path Abs File]) Source

Perform some basic checks on a list of cabal files to be used for creating stack config. It checks for duplicate package names, package name and cabal file name mismatch and reports any issues related to those.

If no error occurs it returns filepath and GenericPackageDescriptions pairs as well as any filenames for duplicate packages not included in the pairs.

findCabalFiles :: (MonadIO m, MonadLogger m) => Bool -> Path Abs Dir -> m [Path Abs File] Source

Finds all files with a .cabal extension under a given directory. If a hpack `package.yaml` file exists, this will be used to generate a cabal file. Subdirectories can be included depending on the recurse parameter.

getResolverConstraints :: (StackM env m, HasConfig env, HasGHCVariant env) => Path Abs File -> Resolver -> m (CompilerVersion, Map PackageName (Version, Map FlagName Bool)) Source

Given a resolver (snpashot, compiler or custom resolver) return the compiler version, package versions and packages flags for that resolver.

mergeConstraints :: Map PackageName v -> Map PackageName (Map p f) -> Map PackageName (v, Map p f) Source

Merge two separate maps, one defining constraints on package versions and the other defining package flagmap, into a single map of version and flagmap tuples.

solveExtraDeps Source


:: (StackM env m, HasEnvConfig env) 
=> Bool

modify stack.yaml?

-> m () 

Verify the combination of resolver, package flags and extra dependencies in an existing stack.yaml and suggest changes in flags or extra dependencies so that the specified packages can be compiled.

solveResolverSpec Source


:: (StackM env m, HasConfig env, HasGHCVariant env) 
=> Path Abs File

stack.yaml file location

-> [Path Abs Dir]

package dirs containing cabal files

-> (Resolver, ConstraintSpec, ConstraintSpec)

( resolver , src package constraints , extra dependency constraints )

-> m (Either [PackageName] (ConstraintSpec, ConstraintSpec))

(Conflicting packages (resulting src package specs, external dependency specs))

Given a resolver, user package constraints (versions and flags) and extra dependency constraints determine what extra dependencies are required outside the resolver snapshot and the specified extra dependencies.

First it tries by using the snapshot and the input extra dependencies as hard constraints, if no solution is arrived at by using hard constraints it then tries using them as soft constraints or preferences.

It returns either conflicting packages when no solution is arrived at or the solution in terms of src package flag settings and extra dependencies.

Internal - for tests