stack-1.3.2: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

Stack.Build.Target

Contents

- Types
- Parsers

Description

Parsing command line targets

Synopsis

- type ComponentName = Text
- data UnresolvedComponent
  - = ResolvedComponent !NamedComponent
  - | UnresolvedComponent !ComponentName
- data RawTarget a where
  - RTPackageComponent :: !PackageName -> !UnresolvedComponent -> RawTarget a
  - RTComponent :: !ComponentName -> RawTarget a
  - RTPackage :: !PackageName -> RawTarget a
  - RTPackageIdentifier :: !PackageIdentifier -> RawTarget HasIdents
- data LocalPackageView = LocalPackageView {
  - lpvVersion :: !Version
  - lpvRoot :: !(Path Abs Dir)
  - lpvCabalFP :: !(Path Abs File)
  - lpvComponents :: !(Set NamedComponent)
  - lpvExtraDep :: !TreatLikeExtraDep
  }
- data SimpleTarget
  - = STUnknown
  - | STNonLocal
  - | STLocalComps !(Set NamedComponent)
  - | STLocalAll
- data NeedTargets
  - = NeedTargets
  - | AllowNoTargets
- parseRawTarget :: Text -> Maybe (RawTarget HasIdents)
- parseTargets :: (MonadCatch m, MonadIO m) => NeedTargets -> Bool -> Map PackageName Version -> Map PackageName Version -> Map PackageName LocalPackageView -> Path Abs Dir -> [Text] -> m (Map PackageName Version, Map PackageName SimpleTarget)

# Types

type ComponentName = Text #

The name of a component, which applies to executables, test suites, and benchmarks

data UnresolvedComponent #

Either a fully resolved component, or a component name that could be either an executable, test, or benchmark

Constructors

ResolvedComponent !NamedComponent |
UnresolvedComponent !ComponentName |

Instances

Eq UnresolvedComponent # |
Methods (==) :: UnresolvedComponent -> UnresolvedComponent -> Bool # (/=) :: UnresolvedComponent -> UnresolvedComponent -> Bool #
Ord UnresolvedComponent # |
Methods compare :: UnresolvedComponent -> UnresolvedComponent -> Ordering # (<) :: UnresolvedComponent -> UnresolvedComponent -> Bool # (<=) :: UnresolvedComponent -> UnresolvedComponent -> Bool # (>) :: UnresolvedComponent -> UnresolvedComponent -> Bool # (>=) :: UnresolvedComponent -> UnresolvedComponent -> Bool # max :: UnresolvedComponent -> UnresolvedComponent -> UnresolvedComponent # min :: UnresolvedComponent -> UnresolvedComponent -> UnresolvedComponent #
Show UnresolvedComponent # |
Methods showsPrec :: Int -> UnresolvedComponent -> ShowS # show :: UnresolvedComponent -> String # showList :: [UnresolvedComponent] -> ShowS #

data RawTarget a where #

Raw command line input, without checking against any databases or list of locals. Does not deal with directories

Constructors

RTPackageComponent :: !PackageName -> !UnresolvedComponent -> RawTarget a |
RTComponent :: !ComponentName -> RawTarget a |
RTPackage :: !PackageName -> RawTarget a |
RTPackageIdentifier :: !PackageIdentifier -> RawTarget HasIdents |

Instances

Eq (RawTarget a) # |
Methods (==) :: RawTarget a -> RawTarget a -> Bool # (/=) :: RawTarget a -> RawTarget a -> Bool #
Ord (RawTarget a) # |
Methods compare :: RawTarget a -> RawTarget a -> Ordering # (<) :: RawTarget a -> RawTarget a -> Bool # (<=) :: RawTarget a -> RawTarget a -> Bool # (>) :: RawTarget a -> RawTarget a -> Bool # (>=) :: RawTarget a -> RawTarget a -> Bool # max :: RawTarget a -> RawTarget a -> RawTarget a # min :: RawTarget a -> RawTarget a -> RawTarget a #
Show (RawTarget a) # |
Methods showsPrec :: Int -> RawTarget a -> ShowS # show :: RawTarget a -> String # showList :: [RawTarget a] -> ShowS #

data LocalPackageView #

A view of a local package needed for resolving components

Constructors

LocalPackageView |
Fields lpvVersion :: !Version lpvRoot :: !(Path Abs Dir) lpvCabalFP :: !(Path Abs File) lpvComponents :: !(Set NamedComponent) lpvExtraDep :: !TreatLikeExtraDep

data SimpleTarget #

Constructors

STUnknown |
STNonLocal |
STLocalComps !(Set NamedComponent) |
STLocalAll |

Instances

Eq SimpleTarget # |
Methods (==) :: SimpleTarget -> SimpleTarget -> Bool # (/=) :: SimpleTarget -> SimpleTarget -> Bool #
Ord SimpleTarget # |
Methods compare :: SimpleTarget -> SimpleTarget -> Ordering # (<) :: SimpleTarget -> SimpleTarget -> Bool # (<=) :: SimpleTarget -> SimpleTarget -> Bool # (>) :: SimpleTarget -> SimpleTarget -> Bool # (>=) :: SimpleTarget -> SimpleTarget -> Bool # max :: SimpleTarget -> SimpleTarget -> SimpleTarget # min :: SimpleTarget -> SimpleTarget -> SimpleTarget #
Show SimpleTarget # |
Methods showsPrec :: Int -> SimpleTarget -> ShowS # show :: SimpleTarget -> String # showList :: [SimpleTarget] -> ShowS #

data NeedTargets #

Need targets, e.g. `stack build` or allow none?

Constructors

NeedTargets |
AllowNoTargets |

# Parsers

parseRawTarget :: Text -> Maybe (RawTarget HasIdents) #

If this function returns `Nothing`, the input should be treated as a directory.

parseTargets #

Arguments

:: (MonadCatch m, MonadIO m) |
=> NeedTargets | need at least one target
-> Bool | using implicit global project?
-> Map PackageName Version | snapshot
-> Map PackageName Version | extra deps
-> Map PackageName LocalPackageView |
-> Path Abs Dir | current directory
-> [Text] | command line targets
-> m (Map PackageName Version, Map PackageName SimpleTarget) |