Singular for singleton lists and plural otherwise.
Modulecabal-install-3.18.1.0Haskell2010
Distribution.Client.CmdErrorMessages
Utilities to help format error messages for the various CLI commands.
- 5 types
- 23 values
- Packagecabal-install-3.18.1.0
- Exports28
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCmdErrorMessages.hs
The optional stanza type (test suite or benchmark), if it is one.
Used to render a singular or plural version of something
plural (listPlural theThings) "it is" "they are"Render a list of things in the style foo, bar and baz
Render a list of things in the style blah blah; this that; and the other
renderTargetProblem :: Stringverb
-> (a -> String)how to render custom problems
-> TargetProblem a-> String
Default implementation of renderTargetProblem.
Several commands have a TargetProblemNoTargets problem constructor.
This renders an error message for those cases.
Several commands have a TargetProblemNoneEnabled problem constructor.
This renders an error message for those cases.
Default implementation of reportTargetProblems simply renders one problem per line.
When rendering lists of things it often reads better to group related things, e.g. grouping components by package name
renderListSemiAnd
[ "the package " ++ prettyShow pkgname ++ " components "
++ renderListCommaAnd showComponentName components
| (pkgname, components) <- sortGroupOn packageName allcomponents ]Does the TargetSelector potentially refer to one package or many?
Does the TargetSelector refer to packages or to components?
Instances4Enum, Eq, Ord, Show
Enum ComponentKindDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorEq ComponentKindDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorOrd ComponentKindDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorShow ComponentKindDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelector
Either the component as a whole or detail about a file or module target within a component.
Constructors
WholeComponentThe component as a whole
ModuleTarget ModuleNameA specific module within a component.
FileTarget FilePathA specific file within a component. Note that this does not carry the file extension.
Instances7Eq, Ord, Show, Generic, Binary, Structured, …
Eq SubComponentTargetDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorOrd SubComponentTargetDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorShow SubComponentTargetDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorGeneric SubComponentTargetDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorBinary SubComponentTargetDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorStructured SubComponentTargetDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectortype Rep SubComponentTarget = D1 ('MetaDataDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelector"SubComponentTarget"
"Distribution.Client.TargetSelector"
"cabal-install-3.18.1.0-7ZOq76AEqY2DvdiklqxZ41"
'False) (C1 ('MetaCons"WholeComponent"
'PrefixI 'False) U1 :+: (C1 ('MetaCons"ModuleTarget"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ModuleName)) :+: C1 ('MetaCons"FileTarget"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath))))
A target selector is an expression selecting a set of components (as targets
for actions like build, run, test etc). A target selector
corresponds to the user syntax for referring to targets on the command line.
From the users point of view a target can be many things: packages, dirs, component names, files etc. Internally we consider a target to be a specific component (or module/file within a component), and all the users' notions of targets are just different ways of referring to these component targets.
So target selectors are expressions in the sense that they are interpreted to refer to one or more components. For example a TargetPackage gets interpreted differently by different commands to refer to all or a subset of components within the package.
The syntax has lots of optional parts:
[ package name | package dir | package .cabal file ]
[ [lib:|exe:] component name ]
[ module name | source file ]Constructors
TargetPackage TargetImplicitCwd [PackageId] (Maybe ComponentKindFilter)One (or more) packages as a whole, or all the components of a particular kind within the package(s).
These are always packages that are local to the project. In the case that there is more than one, they all share the same directory location.
TargetPackageNamed PackageName (Maybe ComponentKindFilter)A package specified by name. This may refer to
extra-packagesfrom thecabal.projectfile, or a dependency of a known project package or could refer to a package from a hackage archive. It needs further context to resolve to a specific package.TargetAllPackages (Maybe ComponentKindFilter)All packages, or all components of a particular kind in all packages.
TargetComponent PackageId ComponentName SubComponentTargetA specific component in a package within the project.
TargetComponentUnknown PackageName (Either UnqualComponentName ComponentName) SubComponentTargetA component in a package, but where it cannot be verified that the package has such a component, or because the package is itself not known.
Instances5Eq, Ord, Show, Generic, Rep
Eq TargetSelectorDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorOrd TargetSelectorDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorShow TargetSelectorDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectorGeneric TargetSelectorDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelectortype Rep TargetSelector = D1 ('MetaDataDefined in cabal-install-3.18.1.0 · Distribution.Client.TargetSelector"TargetSelector"
"Distribution.Client.TargetSelector"
"cabal-install-3.18.1.0-7ZOq76AEqY2DvdiklqxZ41"
'False) ((C1 ('MetaCons"TargetPackage"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 TargetImplicitCwd) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [PackageId]) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ComponentKindFilter)))) :+: C1 ('MetaCons"TargetPackageNamed"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ComponentKindFilter)))) :+: (C1 ('MetaCons"TargetAllPackages"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe ComponentKindFilter))) :+: (C1 ('MetaCons"TargetComponent"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageId) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ComponentName) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubComponentTarget))) :+: C1 ('MetaCons"TargetComponentUnknown"
'PrefixI 'False) (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PackageName) :*: (S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Either UnqualComponentName ComponentName)) :*: S1 ('MetaSel 'Nothing 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SubComponentTarget))))))