Safe Haskell | None |
---|---|
Language | GHC2021 |
Stack.Config
Description
The general Stack configuration that starts everything off. This should be smart to fallback 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
- loadConfig :: (HasRunner env, HasTerm env) => (Config -> RIO env a) -> RIO env a
- loadConfigYaml :: HasLogFunc env => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> RIO env a
- packagesParser :: Parser [String]
- getImplicitGlobalProjectDir :: HasConfig env => RIO env (Path Abs Dir)
- getSnapshots :: HasConfig env => RIO env Snapshots
- makeConcreteSnapshot :: HasConfig env => AbstractSnapshot -> RIO env RawSnapshotLocation
- getRawSnapshot :: HasConfig env => RIO env (Maybe RawSnapshot)
- checkOwnership :: MonadIO m => Path Abs Dir -> m ()
- getInContainer :: MonadIO m => m Bool
- getInNixShell :: MonadIO m => m Bool
- defaultConfigYaml :: (IsString s, Semigroup s) => s
- getProjectConfig :: HasTerm env => StackYamlLoc -> RIO env (ProjectConfig (Path Abs File))
- withBuildConfig :: RIO BuildConfig a -> RIO Config a
- withNewLogFunc :: MonadUnliftIO m => GlobalOpts -> Bool -> StylesUpdate -> (LogFunc -> m a) -> m a
- determineStackRootAndOwnership :: MonadIO m => ConfigMonoid -> m (Path Abs Dir, Path Abs Dir, Bool)
Documentation
loadConfig :: (HasRunner env, HasTerm env) => (Config -> RIO env a) -> RIO env a Source #
Load the configuration, using current directory, environment variables, and defaults as necessary.
loadConfigYaml :: HasLogFunc env => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> RIO env a Source #
Load and parse YAML from the given config file. Throws
ParseConfigFileException
when there's a decoding error.
packagesParser :: Parser [String] Source #
getImplicitGlobalProjectDir :: HasConfig env => RIO env (Path Abs Dir) Source #
Get the location of the implicit global project directory.
getSnapshots :: HasConfig env => RIO env Snapshots Source #
Download the Snapshots
value from stackage.org.
makeConcreteSnapshot :: HasConfig env => AbstractSnapshot -> RIO env RawSnapshotLocation Source #
Turn an AbstractSnapshot
into a RawSnapshotLocation
.
getRawSnapshot :: HasConfig env => RIO env (Maybe RawSnapshot) Source #
Get the raw snapshot from the global options.
checkOwnership :: MonadIO m => Path Abs Dir -> m () Source #
throws checkOwnership
dirUserDoesn'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,
is thrown.NoSuchDirectory
(parent
dir)
getInContainer :: MonadIO m => m Bool Source #
True
if we are currently running inside a Docker container.
defaultConfigYaml :: (IsString s, Semigroup s) => s Source #
Arguments
:: HasTerm env | |
=> StackYamlLoc | Override stack.yaml |
-> RIO env (ProjectConfig (Path Abs File)) |
Get the location of the project config file, if it exists.
withBuildConfig :: RIO BuildConfig a -> RIO Config a Source #
Load the build configuration, adds build-specific values to config loaded
by loadConfig
. values.
Arguments
:: MonadUnliftIO m | |
=> GlobalOpts | |
-> Bool | Use color |
-> StylesUpdate | |
-> (LogFunc -> m a) | |
-> m a |
Runs the provided action with a new LogFunc
, given a StylesUpdate
.