Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Distribution.Client.IndexUtils.ActiveRepos
Synopsis
- newtype ActiveRepos = ActiveRepos [ActiveRepoEntry]
- defaultActiveRepos :: ActiveRepos
- filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos
- data ActiveRepoEntry
- data CombineStrategy
- organizeByRepos :: forall a. ActiveRepos -> (a -> RepoName) -> [a] -> Either String [(a, CombineStrategy)]
Documentation
newtype ActiveRepos Source #
Ordered list of active repositories.
Constructors
ActiveRepos [ActiveRepoEntry] |
Instances
Parsec ActiveRepos Source # | Note: empty string is not valid
|
Defined in Distribution.Client.IndexUtils.ActiveRepos Methods parsec :: CabalParsing m => m ActiveRepos # | |
Pretty ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos | |
Structured ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos | |
Generic ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos Associated Types type Rep ActiveRepos :: Type -> Type # | |
Show ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos Methods showsPrec :: Int -> ActiveRepos -> ShowS # show :: ActiveRepos -> String # showList :: [ActiveRepos] -> ShowS # | |
Binary ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos | |
NFData ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos Methods rnf :: ActiveRepos -> () # | |
Eq ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos | |
type Rep ActiveRepos Source # | |
Defined in Distribution.Client.IndexUtils.ActiveRepos type Rep ActiveRepos = D1 ('MetaData "ActiveRepos" "Distribution.Client.IndexUtils.ActiveRepos" "cabal-install-3.12.1.0-9NqWFHLEtw1EbVuShkL8UM" 'True) (C1 ('MetaCons "ActiveRepos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [ActiveRepoEntry]))) |
filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos Source #
Note, this does nothing if ActiveRepoRest
is present.
data ActiveRepoEntry Source #
Constructors
ActiveRepoRest CombineStrategy | rest repositories, i.e. not explicitly listed as |
ActiveRepo RepoName CombineStrategy | explicit repository name |
Instances
data CombineStrategy Source #
Constructors
CombineStrategySkip | skip this repository |
CombineStrategyMerge | merge existing versions |
CombineStrategyOverride | if later repository specifies a package, all package versions are replaced |
Instances
organizeByRepos :: forall a. ActiveRepos -> (a -> RepoName) -> [a] -> Either String [(a, CombineStrategy)] Source #
Sort values RepoName
according to ActiveRepos
list.
>>>
let repos = [RepoName "a", RepoName "b", RepoName "c"]
>>>
organizeByRepos (ActiveRepos [ActiveRepoRest CombineStrategyMerge]) id repos
Right [(RepoName {unRepoName = "a"},CombineStrategyMerge),(RepoName {unRepoName = "b"},CombineStrategyMerge),(RepoName {unRepoName = "c"},CombineStrategyMerge)]
>>>
organizeByRepos (ActiveRepos [ActiveRepo (RepoName "b") CombineStrategyOverride, ActiveRepoRest CombineStrategyMerge]) id repos
Right [(RepoName {unRepoName = "b"},CombineStrategyOverride),(RepoName {unRepoName = "a"},CombineStrategyMerge),(RepoName {unRepoName = "c"},CombineStrategyMerge)]
>>>
organizeByRepos (ActiveRepos [ActiveRepoRest CombineStrategyMerge, ActiveRepo (RepoName "b") CombineStrategyOverride]) id repos
Right [(RepoName {unRepoName = "a"},CombineStrategyMerge),(RepoName {unRepoName = "c"},CombineStrategyMerge),(RepoName {unRepoName = "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.