Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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.
Instances
filterSkippedActiveRepos :: ActiveRepos -> ActiveRepos Source #
Note, this does nothing if ActiveRepoRest
is present.
data ActiveRepoEntry Source #
ActiveRepoRest CombineStrategy | rest repositories, i.e. not explicitly listed as |
ActiveRepo RepoName CombineStrategy | explicit repository name |
Instances
data CombineStrategy Source #
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 "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.