Safe Haskell | None |
---|---|
Language | GHC2021 |
Stack.Types.CompCollection
Description
A module providing the type CompCollection
and associated helper
functions.
The corresponding Cabal approach uses lists. See, for example, the
sublibraries
,
foreignLibs
,
executables
,
testSuites
, and
benchmarks
fields.
Cabal removes all the unbuildable components very early (at the cost of slightly worse error messages).
Synopsis
- data CompCollection component
- getBuildableSet :: CompCollection component -> Set StackUnqualCompName
- getBuildableSetText :: CompCollection component -> Set Text
- getBuildableListText :: CompCollection component -> [Text]
- getBuildableListAs :: (StackUnqualCompName -> something) -> CompCollection component -> [something]
- foldAndMakeCollection :: (HasBuildInfo compB, HasName compB, Foldable sourceCollection) => (compA -> compB) -> sourceCollection compA -> CompCollection compB
- hasBuildableComponent :: CompCollection component -> Bool
- collectionLookup :: StackUnqualCompName -> CompCollection component -> Maybe component
- collectionKeyValueList :: CompCollection component -> [(StackUnqualCompName, component)]
- collectionMember :: StackUnqualCompName -> CompCollection component -> Bool
- foldComponentToAnotherCollection :: Monad m => CompCollection component -> (component -> m a -> m a) -> m a -> m a
Documentation
data CompCollection component Source #
A type representing collections of components, distinguishing buildable components and non-buildable components.
Instances
getBuildableSet :: CompCollection component -> Set StackUnqualCompName Source #
Get the names of the buildable components in the given collection, as a
Set
of StackUnqualCompName
.
getBuildableSetText :: CompCollection component -> Set Text Source #
getBuildableListText :: CompCollection component -> [Text] Source #
Get the names of the buildable components in the given collection, as a list of 'Text.
Arguments
:: (StackUnqualCompName -> something) | Function to apply to buildable components. |
-> CompCollection component | Collection of components. |
-> [something] |
Apply the given function to the names of the buildable components in the given collection, yielding a list.
foldAndMakeCollection Source #
Arguments
:: (HasBuildInfo compB, HasName compB, Foldable sourceCollection) | |
=> (compA -> compB) | Function to apply to each element in the data struture. |
-> sourceCollection compA | Given foldable data structure of components of type |
-> CompCollection compB |
For the given function and foldable data structure of components of type
compA
, iterates on the elements of that structure and maps each element to
a component of type compB
while building a CompCollection
.
hasBuildableComponent :: CompCollection component -> Bool Source #
Yields True
if, and only if, the given collection includes at least one
buildable component.
Arguments
:: StackUnqualCompName | Name of the buildable component. |
-> CompCollection component | Collection of components. |
-> Maybe component |
collectionKeyValueList :: CompCollection component -> [(StackUnqualCompName, component)] Source #
For a given collection of components, yields a list of pairs for buildable components of the name of the component and the component.
Arguments
:: StackUnqualCompName | Name of the buildable component. |
-> CompCollection component | Collection of components. |
-> Bool |
Yields True
if, and only if, the given collection of components includes
a buildable component with the given name.
foldComponentToAnotherCollection Source #
Arguments
:: Monad m | |
=> CompCollection component | Collection of components. |
-> (component -> m a -> m a) | Binary operator. |
-> m a | Starting value. |
-> m a |
Reduce the buildable components of the given collection of components by applying the given binary operator to all buildable components, using the given starting value (typically the right-identity of the operator).