stack-1.6.5: The Haskell Tool Stack

Safe HaskellNone





cabalPackagesCheck :: (HasConfig env, HasGHCVariant env) => [Path Abs Dir] -> String -> Maybe String -> RIO env (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.

findCabalDirs :: (MonadIO m, MonadUnliftIO m, MonadLogger m, HasRunner env, MonadReader env m, HasConfig env) => Bool -> Path Abs Dir -> m (Set (Path Abs Dir)) Source #

Finds all directories with a .cabal file or an hpack package.yaml. Subdirectories can be included depending on the recurse parameter.

getResolverConstraints Source #


:: (HasConfig env, HasGHCVariant env) 
=> Maybe (CompilerVersion CVActual)

actually installed compiler

-> Path Abs File 
-> SnapshotDef 
-> RIO env (CompilerVersion CVActual, Map PackageName (Version, Map FlagName Bool)) 

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 #


:: HasEnvConfig env 
=> Bool

modify stack.yaml?

-> RIO env () 

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 #


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

stack.yaml file location

-> [Path Abs Dir]

package dirs containing cabal files

-> (SnapshotDef, ConstraintSpec, ConstraintSpec)

( resolver , src package constraints , extra dependency constraints )

-> RIO env (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.

checkSnapBuildPlanActual Source #


:: (HasConfig env, HasGHCVariant env) 
=> Path Abs Dir

project root, used for checking out necessary files

-> [GenericPackageDescription] 
-> Maybe (Map PackageName (Map FlagName Bool)) 
-> SnapshotDef 
-> RIO env BuildPlanCheck 

Same as checkSnapBuildPLan, but set up a real GHC if needed.

If we're using a Stackage snapshot, we can use the snapshot hints to determine global library information. This will not be available for custom and GHC resolvers, however. Therefore, we insist that it be installed first. Fortunately, the standard `stack solver` behavior only chooses Stackage snapshots, so the common case will not force the installation of a bunch of GHC versions.

Internal - for tests