Distribution.Solver.Types.ComponentDeps

cabal-install-solver-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Solver.Types.ComponentDeps

Contents

- Fine-grained package dependencies
  - Constructing ComponentDeps
  - Deconstructing ComponentDeps

Description

Fine-grained package dependencies

Like many others, this module is meant to be "double-imported":

    import Distribution.Solver.Types.ComponentDeps (
        Component
      , ComponentDep
      , ComponentDeps
      )
    import qualified Distribution.Solver.Types.ComponentDeps as CD

Synopsis

- data Component
  - = ComponentLib
  - | ComponentSubLib UnqualComponentName
  - | ComponentFLib UnqualComponentName
  - | ComponentExe UnqualComponentName
  - | ComponentTest UnqualComponentName
  - | ComponentBench UnqualComponentName
  - | ComponentSetup
- componentNameToComponent :: ComponentName -> Component
- type ComponentDep a = (Component, a)
- data ComponentDeps a
- empty :: ComponentDeps a
- fromList :: Monoid a => [ComponentDep a] -> ComponentDeps a
- singleton :: Component -> a -> ComponentDeps a
- insert :: Monoid a => Component -> a -> ComponentDeps a -> ComponentDeps a
- zip :: (Monoid a, Monoid b) => ComponentDeps a -> ComponentDeps b -> ComponentDeps (a, b)
- filterDeps :: (Component -> a -> Bool) -> ComponentDeps a -> ComponentDeps a
- mapDeps :: (Component -> a -> b) -> ComponentDeps a -> ComponentDeps b
- fromLibraryDeps :: a -> ComponentDeps a
- fromSetupDeps :: a -> ComponentDeps a
- fromInstalled :: a -> ComponentDeps a
- toList :: ComponentDeps a -> [ComponentDep a]
- flatDeps :: Monoid a => ComponentDeps a -> a
- nonSetupDeps :: Monoid a => ComponentDeps a -> a
- libraryDeps :: Monoid a => ComponentDeps a -> a
- setupDeps :: Monoid a => ComponentDeps a -> a
- select :: Monoid a => (Component -> Bool) -> ComponentDeps a -> a
- components :: ComponentDeps a -> Set Component

# Fine-grained package dependencies

data Component #

Component of a package.

Constructors

ComponentLib |
ComponentSubLib UnqualComponentName |
ComponentFLib UnqualComponentName |
ComponentExe UnqualComponentName |
ComponentTest UnqualComponentName |
ComponentBench UnqualComponentName |
ComponentSetup |

#### Instances

Instances details

Pretty Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods pretty :: Component -> Doc # prettyVersioned :: CabalSpecVersion -> Component -> Doc #
Structured Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods structure :: Proxy Component -> Structure # structureHash' :: Tagged Component MD5
Binary Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods put :: Component -> Put # get :: Get Component # putList :: [Component] -> Put #
Generic Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Associated Types
type Rep Component |
Instance details Defined in Distribution.Solver.Types.ComponentDeps type Rep Component = D1 ('MetaData "Component" "Distribution.Solver.Types.ComponentDeps" "cabal-install-solver-3.12.1.0-BcLJX5rVQuejx1qrKAH5j" 'False) ((C1 ('MetaCons "ComponentLib" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ComponentSubLib" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)) :+: C1 ('MetaCons "ComponentFLib" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)))) :+: ((C1 ('MetaCons "ComponentExe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)) :+: C1 ('MetaCons "ComponentTest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName))) :+: (C1 ('MetaCons "ComponentBench" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)) :+: C1 ('MetaCons "ComponentSetup" 'PrefixI 'False) (U1 :: Type -> Type))))
Methods from :: Component -> Rep Component x # to :: Rep Component x -> Component #
Show Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods showsPrec :: Int -> Component -> ShowS # show :: Component -> String # showList :: [Component] -> ShowS #
Eq Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods (==) :: Component -> Component -> Bool # (/=) :: Component -> Component -> Bool #
Ord Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods compare :: Component -> Component -> Ordering # (<) :: Component -> Component -> Bool # (<=) :: Component -> Component -> Bool # (>) :: Component -> Component -> Bool # (>=) :: Component -> Component -> Bool # max :: Component -> Component -> Component # min :: Component -> Component -> Component #
type Rep Component # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps type Rep Component = D1 ('MetaData "Component" "Distribution.Solver.Types.ComponentDeps" "cabal-install-solver-3.12.1.0-BcLJX5rVQuejx1qrKAH5j" 'False) ((C1 ('MetaCons "ComponentLib" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ComponentSubLib" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)) :+: C1 ('MetaCons "ComponentFLib" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)))) :+: ((C1 ('MetaCons "ComponentExe" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)) :+: C1 ('MetaCons "ComponentTest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName))) :+: (C1 ('MetaCons "ComponentBench" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 UnqualComponentName)) :+: C1 ('MetaCons "ComponentSetup" 'PrefixI 'False) (U1 :: Type -> Type))))

componentNameToComponent :: ComponentName -> Component #

type ComponentDep a = (Component, a) #

Dependency for a single component.

data ComponentDeps a #

Fine-grained dependencies for a package.

Typically used as `ComponentDeps [Dependency]`, to represent the list of dependencies for each named component within a package.

#### Instances

Instances details

Functor ComponentDeps # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods fmap :: (a -> b) -> ComponentDeps a -> ComponentDeps b # (<$) :: a -> ComponentDeps b -> ComponentDeps a #
Foldable ComponentDeps # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods fold :: Monoid m => ComponentDeps m -> m # foldMap :: Monoid m => (a -> m) -> ComponentDeps a -> m # foldMap' :: Monoid m => (a -> m) -> ComponentDeps a -> m # foldr :: (a -> b -> b) -> b -> ComponentDeps a -> b # foldr' :: (a -> b -> b) -> b -> ComponentDeps a -> b # foldl :: (b -> a -> b) -> b -> ComponentDeps a -> b # foldl' :: (b -> a -> b) -> b -> ComponentDeps a -> b # foldr1 :: (a -> a -> a) -> ComponentDeps a -> a # foldl1 :: (a -> a -> a) -> ComponentDeps a -> a # toList :: ComponentDeps a -> [a] # null :: ComponentDeps a -> Bool # length :: ComponentDeps a -> Int # elem :: Eq a => a -> ComponentDeps a -> Bool # maximum :: Ord a => ComponentDeps a -> a # minimum :: Ord a => ComponentDeps a -> a # sum :: Num a => ComponentDeps a -> a # product :: Num a => ComponentDeps a -> a #
Traversable ComponentDeps # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods traverse :: Applicative f => (a -> f b) -> ComponentDeps a -> f (ComponentDeps b) # sequenceA :: Applicative f => ComponentDeps (f a) -> f (ComponentDeps a) # mapM :: Monad m => (a -> m b) -> ComponentDeps a -> m (ComponentDeps b) # sequence :: Monad m => ComponentDeps (m a) -> m (ComponentDeps a) #
Structured a => Structured (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods structure :: Proxy (ComponentDeps a) -> Structure # structureHash' :: Tagged (ComponentDeps a) MD5
Binary a => Binary (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods put :: ComponentDeps a -> Put # get :: Get (ComponentDeps a) # putList :: [ComponentDeps a] -> Put #
Semigroup a => Monoid (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods mempty :: ComponentDeps a # mappend :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a # mconcat :: [ComponentDeps a] -> ComponentDeps a #
Semigroup a => Semigroup (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods (<>) :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a # sconcat :: NonEmpty (ComponentDeps a) -> ComponentDeps a # stimes :: Integral b => b -> ComponentDeps a -> ComponentDeps a #
Generic (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Associated Types
type Rep (ComponentDeps a) |
Instance details Defined in Distribution.Solver.Types.ComponentDeps type Rep (ComponentDeps a) = D1 ('MetaData "ComponentDeps" "Distribution.Solver.Types.ComponentDeps" "cabal-install-solver-3.12.1.0-BcLJX5rVQuejx1qrKAH5j" 'True) (C1 ('MetaCons "ComponentDeps" 'PrefixI 'True) (S1 ('MetaSel ('Just "unComponentDeps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Component a))))
Methods from :: ComponentDeps a -> Rep (ComponentDeps a) x # to :: Rep (ComponentDeps a) x -> ComponentDeps a #
Show a => Show (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods showsPrec :: Int -> ComponentDeps a -> ShowS # show :: ComponentDeps a -> String # showList :: [ComponentDeps a] -> ShowS #
Eq a => Eq (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods (==) :: ComponentDeps a -> ComponentDeps a -> Bool # (/=) :: ComponentDeps a -> ComponentDeps a -> Bool #
Ord a => Ord (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods compare :: ComponentDeps a -> ComponentDeps a -> Ordering # (<) :: ComponentDeps a -> ComponentDeps a -> Bool # (<=) :: ComponentDeps a -> ComponentDeps a -> Bool # (>) :: ComponentDeps a -> ComponentDeps a -> Bool # (>=) :: ComponentDeps a -> ComponentDeps a -> Bool # max :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a # min :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a #
type Rep (ComponentDeps a) # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps type Rep (ComponentDeps a) = D1 ('MetaData "ComponentDeps" "Distribution.Solver.Types.ComponentDeps" "cabal-install-solver-3.12.1.0-BcLJX5rVQuejx1qrKAH5j" 'True) (C1 ('MetaCons "ComponentDeps" 'PrefixI 'True) (S1 ('MetaSel ('Just "unComponentDeps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Component a))))

## Constructing ComponentDeps

empty :: ComponentDeps a #

fromList :: Monoid a => [ComponentDep a] -> ComponentDeps a #

singleton :: Component -> a -> ComponentDeps a #

insert :: Monoid a => Component -> a -> ComponentDeps a -> ComponentDeps a #

zip :: (Monoid a, Monoid b) => ComponentDeps a -> ComponentDeps b -> ComponentDeps (a, b) #

Zip two `ComponentDeps` together by `Component`, using `mempty` as the neutral element when a `Component` is present only in one.

filterDeps :: (Component -> a -> Bool) -> ComponentDeps a -> ComponentDeps a #

Keep only selected components (and their associated deps info).

mapDeps :: (Component -> a -> b) -> ComponentDeps a -> ComponentDeps b #

Keep only selected components (and their associated deps info).

fromLibraryDeps :: a -> ComponentDeps a #

ComponentDeps containing library dependencies only

fromSetupDeps :: a -> ComponentDeps a #

ComponentDeps containing setup dependencies only.

fromInstalled :: a -> ComponentDeps a #

ComponentDeps for installed packages.

We assume that installed packages only record their library dependencies.

## Deconstructing ComponentDeps

toList :: ComponentDeps a -> [ComponentDep a] #

flatDeps :: Monoid a => ComponentDeps a -> a #

All dependencies of a package.

This is just a synonym for `fold`, but perhaps a use of `flatDeps` is more obvious than a use of `fold`, and moreover this avoids introducing lots of `#ifdef`s for 7.10 just for the use of `fold`.

nonSetupDeps :: Monoid a => ComponentDeps a -> a #

All dependencies except the setup dependencies.

Prior to the introduction of setup dependencies in version 1.24 this would have been _all_ dependencies.

libraryDeps :: Monoid a => ComponentDeps a -> a #

Library dependencies proper only. (Includes dependencies of internal libraries.)

setupDeps :: Monoid a => ComponentDeps a -> a #

Setup dependencies.

select :: Monoid a => (Component -> Bool) -> ComponentDeps a -> a #

Select dependencies satisfying a given predicate.

components :: ComponentDeps a -> Set Component #

List components