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

Safe Haskell | None
Language | Haskell2010

Distribution.Client.IndexUtils.ActiveRepos

Synopsis

- newtype ActiveRepos = ActiveRepos [ActiveRepoEntry]
- defaultActiveRepos :: ActiveRepos
- filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos
- data ActiveRepoEntry
  - = ActiveRepoRest CombineStrategy
  - | ActiveRepo RepoName CombineStrategy
- data CombineStrategy
  - = CombineStrategySkip
  - | CombineStrategyMerge
  - | CombineStrategyOverride
- organizeByRepos :: ActiveRepos -> (a -> RepoName) -> [a] -> Either String [(a, CombineStrategy)]

# Documentation

newtype ActiveRepos #

Ordered list of active repositories.

Constructors

ActiveRepos [ActiveRepoEntry] |

#### Instances

Instances details

Parsec ActiveRepos #

Note: empty string is not valid `ActiveRepos`.

    >>> simpleParsec "" :: Maybe ActiveRepos
    Nothing

    >>> simpleParsec ":none" :: Maybe ActiveRepos
    Just (ActiveRepos [])

    >>> simpleParsec ":rest" :: Maybe ActiveRepos
    Just (ActiveRepos [ActiveRepoRest CombineStrategyMerge])

    >>> simpleParsec "hackage.haskell.org, :rest, head.hackage:override" :: Maybe ActiveRepos
    Just (ActiveRepos [ActiveRepo (RepoName "hackage.haskell.org") CombineStrategyMerge,ActiveRepoRest CombineStrategyMerge,ActiveRepo (RepoName "head.hackage") CombineStrategyOverride])

Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m ActiveRepos #
Pretty ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods pretty :: ActiveRepos -> Doc # prettyVersioned :: CabalSpecVersion -> ActiveRepos -> Doc #
Structured ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods structure :: Proxy ActiveRepos -> Structure # structureHash' :: Tagged ActiveRepos MD5
Generic ActiveRepos # |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

Associated Types

type Rep ActiveRepos |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos type Rep ActiveRepos = D1 ('MetaData "ActiveRepos" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.10.2.1-EH6AEtqwlbKE3rh89dIk81" 'True) (C1 ('MetaCons "ActiveRepos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ActiveRepoEntry])))

Methods

from :: ActiveRepos -> Rep ActiveRepos x #

to :: Rep ActiveRepos x -> ActiveRepos #

Show ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods showsPrec :: Int -> ActiveRepos -> ShowS # show :: ActiveRepos -> String # showList :: [ActiveRepos] -> ShowS #
Binary ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods put :: ActiveRepos -> Put # get :: Get ActiveRepos # putList :: [ActiveRepos] -> Put #
NFData ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods rnf :: ActiveRepos -> () #
Eq ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods (==) :: ActiveRepos -> ActiveRepos -> Bool # (/=) :: ActiveRepos -> ActiveRepos -> Bool #
type Rep ActiveRepos # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos type Rep ActiveRepos = D1 ('MetaData "ActiveRepos" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.10.2.1-EH6AEtqwlbKE3rh89dIk81" 'True) (C1 ('MetaCons "ActiveRepos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ActiveRepoEntry])))

defaultActiveRepos :: ActiveRepos #

filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos #

Note, this does nothing if `ActiveRepoRest` is present.

data ActiveRepoEntry #

Constructors

ActiveRepoRest CombineStrategy | rest repositories, i.e. not explicitly listed as `ActiveRepo`
ActiveRepo RepoName CombineStrategy | explicit repository name

#### Instances

Instances details

Parsec ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m ActiveRepoEntry #
Pretty ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods pretty :: ActiveRepoEntry -> Doc # prettyVersioned :: CabalSpecVersion -> ActiveRepoEntry -> Doc #
Structured ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods structure :: Proxy ActiveRepoEntry -> Structure # structureHash' :: Tagged ActiveRepoEntry MD5
Generic ActiveRepoEntry # |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

Associated Types

type Rep ActiveRepoEntry |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

type Rep ActiveRepoEntry = D1 ('MetaData "ActiveRepoEntry" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.10.2.1-EH6AEtqwlbKE3rh89dIk81" 'False) (C1 ('MetaCons "ActiveRepoRest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CombineStrategy)) :+: C1 ('MetaCons "ActiveRepo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CombineStrategy)))

Methods

from :: ActiveRepoEntry -> Rep ActiveRepoEntry x #

to :: Rep ActiveRepoEntry x -> ActiveRepoEntry #

Show ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods showsPrec :: Int -> ActiveRepoEntry -> ShowS # show :: ActiveRepoEntry -> String # showList :: [ActiveRepoEntry] -> ShowS #
Binary ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods put :: ActiveRepoEntry -> Put # get :: Get ActiveRepoEntry # putList :: [ActiveRepoEntry] -> Put #
NFData ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods rnf :: ActiveRepoEntry -> () #
Eq ActiveRepoEntry # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods (==) :: ActiveRepoEntry -> ActiveRepoEntry -> Bool # (/=) :: ActiveRepoEntry -> ActiveRepoEntry -> Bool #
type Rep ActiveRepoEntry # |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

type Rep ActiveRepoEntry = D1 ('MetaData "ActiveRepoEntry" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.10.2.1-EH6AEtqwlbKE3rh89dIk81" 'False) (C1 ('MetaCons "ActiveRepoRest" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CombineStrategy)) :+: C1 ('MetaCons "ActiveRepo" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RepoName) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CombineStrategy)))

data CombineStrategy #

Constructors

CombineStrategySkip | skip this repository
CombineStrategyMerge | merge existing versions
CombineStrategyOverride | if later repository specifies a package, all package versions are replaced

#### Instances

Instances details

Parsec CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m CombineStrategy #
Pretty CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods pretty :: CombineStrategy -> Doc # prettyVersioned :: CabalSpecVersion -> CombineStrategy -> Doc #
Structured CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods structure :: Proxy CombineStrategy -> Structure # structureHash' :: Tagged CombineStrategy MD5
Bounded CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods minBound :: CombineStrategy # maxBound :: CombineStrategy #
Enum CombineStrategy # |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

Methods

succ :: CombineStrategy -> CombineStrategy #

pred :: CombineStrategy -> CombineStrategy #

toEnum :: Int -> CombineStrategy #

fromEnum :: CombineStrategy -> Int #

enumFrom :: CombineStrategy -> [CombineStrategy] #

enumFromThen :: CombineStrategy -> CombineStrategy -> [CombineStrategy] #

enumFromTo :: CombineStrategy -> CombineStrategy -> [CombineStrategy] #

enumFromThenTo :: CombineStrategy -> CombineStrategy -> CombineStrategy -> [CombineStrategy] #

Generic CombineStrategy # |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

Associated Types

type Rep CombineStrategy |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

type Rep CombineStrategy = D1 ('MetaData "CombineStrategy" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.10.2.1-EH6AEtqwlbKE3rh89dIk81" 'False) (C1 ('MetaCons "CombineStrategySkip" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CombineStrategyMerge" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CombineStrategyOverride" 'PrefixI 'False) (U1 :: Type -> Type)))

Methods

from :: CombineStrategy -> Rep CombineStrategy x #

to :: Rep CombineStrategy x -> CombineStrategy #

Show CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods showsPrec :: Int -> CombineStrategy -> ShowS # show :: CombineStrategy -> String # showList :: [CombineStrategy] -> ShowS #
Binary CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods put :: CombineStrategy -> Put # get :: Get CombineStrategy # putList :: [CombineStrategy] -> Put #
NFData CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods rnf :: CombineStrategy -> () #
Eq CombineStrategy # |
Instance details Defined in Distribution.Client.IndexUtils.ActiveRepos Methods (==) :: CombineStrategy -> CombineStrategy -> Bool # (/=) :: CombineStrategy -> CombineStrategy -> Bool #
type Rep CombineStrategy # |

Instance details

Defined in Distribution.Client.IndexUtils.ActiveRepos

type Rep CombineStrategy = D1 ('MetaData "CombineStrategy" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.10.2.1-EH6AEtqwlbKE3rh89dIk81" 'False) (C1 ('MetaCons "CombineStrategySkip" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CombineStrategyMerge" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CombineStrategyOverride" 'PrefixI 'False) (U1 :: Type -> Type)))

organizeByRepos :: ActiveRepos -> (a -> RepoName) -> [a] -> Either String [(a, CombineStrategy)] #

Sort values `RepoName` according to `ActiveRepos` list.

    >>> let repos = [RepoName "a", RepoName "b", RepoName "c"]
    >>> organizeByRepos (ActiveRepos [ActiveRepoRest CombineStrategyMerge]) id repos
    Right [(RepoName "a",CombineStrategyMerge),(RepoName "b",CombineStrategyMerge),(RepoName "c",CombineStrategyMerge)]

    >>> organizeByRepos (ActiveRepos [ActiveRepo (RepoName "b") CombineStrategyOverride, ActiveRepoRest CombineStrategyMerge]) id repos
    Right [(RepoName "b",CombineStrategyOverride),(RepoName "a",CombineStrategyMerge),(RepoName "c",CombineStrategyMerge)]

    >>> organizeByRepos (ActiveRepos [ActiveRepoRest CombineStrategyMerge, ActiveRepo (RepoName "b") CombineStrategyOverride]) id repos
    Right [(RepoName "a",CombineStrategyMerge),(RepoName "c",CombineStrategyMerge),(RepoName "b",CombineStrategyOverride)]

    >>> organizeByRepos (ActiveRepos [ActiveRepoRest CombineStrategyMerge, ActiveRepo (RepoName "d") CombineStrategyOverride]) id repos
    Left "no repository provided d"

Note: currently if `ActiveRepoRest` is provided more than once, rest-repositories will be multiple times in the output.