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 Source #

Component of a package.

Constructors

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

#### Instances

Instances details

Pretty Component Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods pretty :: Component -> Doc Source # prettyVersioned :: CabalSpecVersion -> Component -> Doc Source #
Structured Component Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods structure :: Proxy Component -> Structure Source # structureHash' :: Tagged Component MD5
Binary Component Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods put :: Component -> Put Source # get :: Get Component Source # putList :: [Component] -> Put Source #
Generic Component Source # |

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-5dSETZK2idVHohhzkfJS3u" '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 Source #

to :: Rep Component x -> Component Source #

Show Component Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods showsPrec :: Int -> Component -> ShowS Source # show :: Component -> String Source # showList :: [Component] -> ShowS Source #
Eq Component Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods (==) :: Component -> Component -> Bool Source # (/=) :: Component -> Component -> Bool Source #
Ord Component Source # |

Instance details

Defined in Distribution.Solver.Types.ComponentDeps

Methods

compare :: Component -> Component -> Ordering Source #

(<) :: Component -> Component -> Bool Source #

(<=) :: Component -> Component -> Bool Source #

(>) :: Component -> Component -> Bool Source #

(>=) :: Component -> Component -> Bool Source #

max :: Component -> Component -> Component Source #

min :: Component -> Component -> Component Source #

type Rep Component Source # |

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-5dSETZK2idVHohhzkfJS3u" '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 Source #

type ComponentDep a = (Component, a) Source #

Dependency for a single component.

data ComponentDeps a Source #

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 Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods fmap :: (a -> b) -> ComponentDeps a -> ComponentDeps b Source # (<$) :: a -> ComponentDeps b -> ComponentDeps a Source #
Foldable ComponentDeps Source # |

Instance details

Defined in Distribution.Solver.Types.ComponentDeps

Methods

fold :: Monoid m => ComponentDeps m -> m Source #

foldMap :: Monoid m => (a -> m) -> ComponentDeps a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ComponentDeps a -> m Source #

foldr :: (a -> b -> b) -> b -> ComponentDeps a -> b Source #

foldr' :: (a -> b -> b) -> b -> ComponentDeps a -> b Source #

foldl :: (b -> a -> b) -> b -> ComponentDeps a -> b Source #

foldl' :: (b -> a -> b) -> b -> ComponentDeps a -> b Source #

foldr1 :: (a -> a -> a) -> ComponentDeps a -> a Source #

foldl1 :: (a -> a -> a) -> ComponentDeps a -> a Source #

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

null :: ComponentDeps a -> Bool Source #

length :: ComponentDeps a -> Int Source #

elem :: Eq a => a -> ComponentDeps a -> Bool Source #

maximum :: Ord a => ComponentDeps a -> a Source #

minimum :: Ord a => ComponentDeps a -> a Source #

sum :: Num a => ComponentDeps a -> a Source #

product :: Num a => ComponentDeps a -> a Source #

Traversable ComponentDeps Source # |

Instance details

Defined in Distribution.Solver.Types.ComponentDeps

Methods

traverse :: Applicative f => (a -> f b) -> ComponentDeps a -> f (ComponentDeps b) Source #

sequenceA :: Applicative f => ComponentDeps (f a) -> f (ComponentDeps a) Source #

mapM :: Monad m => (a -> m b) -> ComponentDeps a -> m (ComponentDeps b) Source #

sequence :: Monad m => ComponentDeps (m a) -> m (ComponentDeps a) Source #

Structured a => Structured (ComponentDeps a) Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods structure :: Proxy (ComponentDeps a) -> Structure Source # structureHash' :: Tagged (ComponentDeps a) MD5
Binary a => Binary (ComponentDeps a) Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods put :: ComponentDeps a -> Put Source # get :: Get (ComponentDeps a) Source # putList :: [ComponentDeps a] -> Put Source #
Semigroup a => Monoid (ComponentDeps a) Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods mempty :: ComponentDeps a Source # mappend :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a Source # mconcat :: [ComponentDeps a] -> ComponentDeps a Source #
Semigroup a => Semigroup (ComponentDeps a) Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods (<>) :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a Source # sconcat :: NonEmpty (ComponentDeps a) -> ComponentDeps a Source # stimes :: Integral b => b -> ComponentDeps a -> ComponentDeps a Source #
Generic (ComponentDeps a) Source # |

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-5dSETZK2idVHohhzkfJS3u" '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 Source #

to :: Rep (ComponentDeps a) x -> ComponentDeps a Source #

Show a => Show (ComponentDeps a) Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods showsPrec :: Int -> ComponentDeps a -> ShowS Source # show :: ComponentDeps a -> String Source # showList :: [ComponentDeps a] -> ShowS Source #
Eq a => Eq (ComponentDeps a) Source # |
Instance details Defined in Distribution.Solver.Types.ComponentDeps Methods (==) :: ComponentDeps a -> ComponentDeps a -> Bool Source # (/=) :: ComponentDeps a -> ComponentDeps a -> Bool Source #
Ord a => Ord (ComponentDeps a) Source # |

Instance details

Defined in Distribution.Solver.Types.ComponentDeps

Methods

compare :: ComponentDeps a -> ComponentDeps a -> Ordering Source #

(<) :: ComponentDeps a -> ComponentDeps a -> Bool Source #

(<=) :: ComponentDeps a -> ComponentDeps a -> Bool Source #

(>) :: ComponentDeps a -> ComponentDeps a -> Bool Source #

(>=) :: ComponentDeps a -> ComponentDeps a -> Bool Source #

max :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a Source #

min :: ComponentDeps a -> ComponentDeps a -> ComponentDeps a Source #

type Rep (ComponentDeps a) Source # |
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-5dSETZK2idVHohhzkfJS3u" 'True) (C1 ('MetaCons "ComponentDeps" 'PrefixI 'True) (S1 ('MetaSel ('Just "unComponentDeps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Component a))))

## Constructing ComponentDeps

empty :: ComponentDeps a Source #

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

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

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

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

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 Source #

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

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

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

fromLibraryDeps :: a -> ComponentDeps a Source #

ComponentDeps containing library dependencies only

fromSetupDeps :: a -> ComponentDeps a Source #

ComponentDeps containing setup dependencies only.

fromInstalled :: a -> ComponentDeps a Source #

ComponentDeps for installed packages.

We assume that installed packages only record their library dependencies.

## Deconstructing ComponentDeps

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

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

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 Source #

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 Source #

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

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

Setup dependencies.

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

Select dependencies satisfying a given predicate.

components :: ComponentDeps a -> Set Component Source #

List components