stack-3.3.1: The Haskell Tool Stack
Safe HaskellNone
LanguageGHC2021

Stack.Types.SourceMap

Description

A source map maps a package name to how it should be built, including source code, flags and options. This module exports types used in various stages of source map construction. See build_overview.md for details on these stages.

Synopsis

Source map types

data SMWanted Source #

A source map with information on the wanted (but not actual) compiler. This is derived by parsing the stack.yaml file for packages, extra-deps, their configuration (e.g., flags and options), and parsing the snapshot it refers to. It does not include global packages or any information from the command line.

Invariant: a PackageName appears in either smwProject or smwDeps, but not both.

Constructors

SMWanted 

data SMActual global Source #

A source map with information on the actual compiler, including the contents of its global package database. It does not include any information from the command line.

Invariant: a PackageName appears in only one of the Maps.

data Target Source #

A type representing how a package is intended to be built.

Constructors

TargetAll !PackageType

Build all of the default components.

TargetComps !(Set NamedComponent)

Only build specific components

data PackageType Source #

Constructors

PTProject 
PTDependency 

Instances

Instances details
Show PackageType Source # 
Instance details

Defined in Stack.Types.SourceMap

Methods

showsPrec :: Int -> PackageType -> ShowS #

show :: PackageType -> String #

showList :: [PackageType] -> ShowS #

Eq PackageType Source # 
Instance details

Defined in Stack.Types.SourceMap

data SMTargets Source #

Builds on an SMActual by resolving the targets specified on the command line, potentially adding in new dependency packages in the process.

data SourceMap Source #

The final source map, taking an SMTargets and applying all command line flags and GHC options.

One source map value is distinguished from another by a hash of the parts of the value that are immutable.

Constructors

SourceMap 

Fields

  • targets :: !SMTargets

    Doesn't need to be included in the hash, does not affect the source map.

  • compiler :: !ActualCompiler

    Need to hash the compiler version _and_ its installation path. Ideally there would be some kind of output from GHC telling us some unique ID for the compiler itself.

  • project :: !(Map PackageName ProjectPackage)

    Doesn't need to be included in hash, doesn't affect any of the packages that get stored in the snapshot database.

  • deps :: !(Map PackageName DepPackage)

    Need to hash all of the immutable dependencies, can ignore the mutable dependencies.

  • globalPkgs :: !(Map PackageName GlobalPackage)

    Doesn't actually need to be hashed, implicitly captured by smCompiler. Can be broken if someone installs new global packages. We can document that as not supported, _or_ we could actually include all of this in the hash and make Stack more resilient.

Helper types

data FromSnapshot Source #

Flag showing if package comes from a snapshot. Used to ignore dependency bounds between such packages.

Instances

Instances details
Show FromSnapshot Source # 
Instance details

Defined in Stack.Types.SourceMap

Methods

showsPrec :: Int -> FromSnapshot -> ShowS #

show :: FromSnapshot -> String #

showList :: [FromSnapshot] -> ShowS #

data DepPackage Source #

A view of a dependency package, specified in stack.yaml

Constructors

DepPackage 

Fields

data ProjectPackage Source #

A view of a project package. Used to resolve components.

ppComponents :: MonadIO m => ProjectPackage -> m (Set NamedComponent) Source #

All components available in the given ProjectPackage

ppGPD :: MonadIO m => ProjectPackage -> m GenericPackageDescription Source #

ppRoot :: ProjectPackage -> Path Abs Dir Source #

Root directory for the given ProjectPackage

ppVersion :: MonadIO m => ProjectPackage -> m Version Source #

Version for the given 'ProjectPackage

data CommonPackage Source #

Settings common to dependency packages (DepPackage) and project packages (ProjectPackage).

Constructors

CommonPackage 

Fields

newtype GlobalPackageVersion Source #

A type representing versions of packages in the global package database.

data GlobalPackage Source #

A view of a package installed in the global package database or a marker for a replaced global package. A global package could be replaced because of a replaced dependency.

Instances

Instances details
Eq GlobalPackage Source # 
Instance details

Defined in Stack.Types.SourceMap

newtype SourceMapHash Source #

A unique hash for the immutable portions of a SourceMap.

Constructors

SourceMapHash SHA256 

smRelDir :: MonadThrow m => SourceMapHash -> m (Path Rel Dir) Source #

Returns relative directory name with source map's hash