stack-1.3.2: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

Stack.Config

Description

The general Stack configuration that starts everything off. This should be smart to falback if there is no stack.yaml, instead relying on whatever files are available.

If there is no stack.yaml, and there is a cabal.config, we read in those constraints, and if there's a cabal.sandbox.config, we read any constraints from there and also find the package database from there, etc. And if there's nothing, we should probably default to behaving like cabal, possibly with spitting out a warning that "you should run `stk init` to make things better".

Synopsis

- data MiniConfig
- loadConfig :: StackM env m => ConfigMonoid -> Maybe AbstractResolver -> Maybe (Path Abs File) -> m (LoadConfig m)
- loadConfigMaybeProject :: StackM env m => ConfigMonoid -> Maybe AbstractResolver -> Maybe (Project, Path Abs File, ConfigMonoid) -> m (LoadConfig m)
- loadMiniConfig :: MonadIO m => Config -> m MiniConfig
- packagesParser :: Parser [String]
- getLocalPackages :: (StackMiniM env m, HasEnvConfig env) => m (Map (Path Abs Dir) TreatLikeExtraDep)
- resolvePackageEntry :: (StackMiniM env m, HasConfig env) => EnvOverride -> Path Abs Dir -> PackageEntry -> m [(Path Abs Dir, TreatLikeExtraDep)]
- getImplicitGlobalProjectDir :: (MonadIO m, MonadLogger m) => Config -> m (Path Abs Dir)
- getStackYaml :: (StackMiniM env m, HasConfig env) => m (Path Abs File)
- getSnapshots :: (StackMiniM env m, HasConfig env) => m Snapshots
- makeConcreteResolver :: (StackMiniM env m, HasConfig env) => AbstractResolver -> m Resolver
- checkOwnership :: (MonadIO m, MonadCatch m) => Path Abs Dir -> m ()
- getInContainer :: MonadIO m => m Bool
- getInNixShell :: MonadIO m => m Bool
- defaultConfigYaml :: ByteString

# Documentation

data MiniConfig #

An environment with a subset of BuildConfig used for setup.

Instances

HasConfig MiniConfig # |
Methods getConfig :: MiniConfig -> Config #
HasGHCVariant MiniConfig # |
Methods getGHCVariant :: MiniConfig -> GHCVariant #
HasPlatform MiniConfig # |
Methods getPlatform :: MiniConfig -> Platform # getPlatformVariant :: MiniConfig -> PlatformVariant #
HasStackRoot MiniConfig # |
Methods getStackRoot :: MiniConfig -> Path Abs Dir #

loadConfig #

Arguments

:: StackM env m |
=> ConfigMonoid | Config monoid from parsed command-line arguments
-> Maybe AbstractResolver | Override resolver
-> Maybe (Path Abs File) | Override stack.yaml
-> m (LoadConfig m) |

Load the configuration, using current directory, environment variables, and defaults as necessary. The passed `Maybe (Path Abs File)` is an override for the location of the project's stack.yaml.

loadConfigMaybeProject #

Arguments

:: StackM env m |
=> ConfigMonoid | Config monoid from parsed command-line arguments
-> Maybe AbstractResolver | Override resolver
-> Maybe (Project, Path Abs File, ConfigMonoid) | Project config to use, if any
-> m (LoadConfig m) |

loadMiniConfig :: MonadIO m => Config -> m MiniConfig #

Load the `MiniConfig`.

packagesParser :: Parser [String] #

getLocalPackages :: (StackMiniM env m, HasEnvConfig env) => m (Map (Path Abs Dir) TreatLikeExtraDep) #

Get packages from EnvConfig, downloading and cloning as necessary. If the packages have already been downloaded, this uses a cached value (

resolvePackageEntry #

Arguments

:: (StackMiniM env m, HasConfig env) |
=> EnvOverride |
-> Path Abs Dir | project root
-> PackageEntry |
-> m [(Path Abs Dir, TreatLikeExtraDep)] |

Resolve a PackageEntry into a list of paths, downloading and cloning as necessary.

getImplicitGlobalProjectDir :: (MonadIO m, MonadLogger m) => Config -> m (Path Abs Dir) #

Get the location of the implicit global project directory. If the directory already exists at the deprecated location, its location is returned. Otherwise, the new location is returned.

getStackYaml :: (StackMiniM env m, HasConfig env) => m (Path Abs File) #

This is slightly more expensive than ``asks` (`bcStackYaml` `.` `getBuildConfig`)` and should only be used when no `BuildConfig` is at hand.

getSnapshots :: (StackMiniM env m, HasConfig env) => m Snapshots #

Download the `Snapshots` value from stackage.org.

makeConcreteResolver :: (StackMiniM env m, HasConfig env) => AbstractResolver -> m Resolver #

Turn an `AbstractResolver` into a `Resolver`.

checkOwnership :: (MonadIO m, MonadCatch m) => Path Abs Dir -> m () #

``checkOwnership` dir` throws `UserDoesn'tOwnDirectory` if `dir` isn't owned by the current user.

If `dir` doesn't exist, its parent directory is checked instead. If the parent directory doesn't exist either, ``NoSuchDirectory` (`parent` dir)` is thrown.

getInContainer :: MonadIO m => m Bool #

`True` if we are currently running inside a Docker container.

getInNixShell :: MonadIO m => m Bool #

`True` if we are currently running inside a Nix.

defaultConfigYaml :: ByteString #