Copyright | (c) 2020-2021 berberman |
---|---|
License | MIT |
Maintainer | berberman <berberman@yandex.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Miscellaneous functions used crossing modules.
Synopsis
- findCabalFile :: FilePath -> IO FilePath
- getPkgName :: PackageDescription -> PackageName
- getPkgName' :: GenericPackageDescription -> PackageName
- getPkgVersion :: PackageDescription -> Version
- dependencyTypeToKind :: DependencyType -> DependencyKind
- unExe :: ExeDependency -> PackageName
- unExeV :: ExeDependency -> (PackageName, VersionRange)
- unLegacyExeV :: LegacyExeDependency -> (PackageName, VersionRange)
- unBuildTools :: ([LegacyExeDependency], [ExeDependency]) -> [(PackageName, VersionRange)]
- unSystemDependency :: ([PkgconfigDependency], [String]) -> [SystemDependency]
- unDepV :: Dependency -> (PackageName, VersionRange)
- getUrl :: PackageDescription -> String
- getTwo :: Getting b s b -> s -> s -> (b, b)
- buildDependsIfBuild :: BuildInfo -> [Dependency]
- buildToolsAndbuildToolDependsIfBuild :: BuildInfo -> ([LegacyExeDependency], [ExeDependency])
- pkgconfigDependsAndExtraLibsIfBuild :: BuildInfo -> ([PkgconfigDependency], [String])
- traceCallStack :: (HasCallStack, MemberWithError Trace r) => Sem r ()
- trace' :: MemberWithError Trace r => String -> Sem r ()
- depNotInGHCLib :: SolvedDependency -> Bool
- depNotMyself :: PackageName -> SolvedDependency -> Bool
- depIsKind :: DependencyKind -> SolvedDependency -> Bool
- extractFromEVR :: String -> ArchLinuxVersion
- isProvided :: SolvedPackage -> Bool
- filterFirstDiff :: [Diff a] -> [Diff a]
- filterFirstAndBothDiff :: [Diff a] -> [Diff a]
- filterSecondDiff :: [Diff a] -> [Diff a]
- filterSecondAndBothDiff :: [Diff a] -> [Diff a]
- noDiff :: [Diff a] -> Bool
- mapDiff :: (a -> b) -> Diff a -> Diff b
- unDiff :: Diff a -> a
- archHsVersion :: String
Documentation
findCabalFile :: FilePath -> IO FilePath Source #
Find a cabal file in dir
,
throws error if nothing or more than one files are found
getPkgName :: PackageDescription -> PackageName Source #
Extract the package name from PackageDescription
.
getPkgName' :: GenericPackageDescription -> PackageName Source #
Extract the package name from GenericPackageDescription
.
getPkgVersion :: PackageDescription -> Version Source #
Extract the package version from PackageDescription
.
dependencyTypeToKind :: DependencyType -> DependencyKind Source #
Map DependencyType
with its data constructor tag DependencyKind
.
unExe :: ExeDependency -> PackageName Source #
Extract the package name from a ExeDependency
.
unExeV :: ExeDependency -> (PackageName, VersionRange) Source #
Extract the package name and the version range from a ExeDependency
.
unLegacyExeV :: LegacyExeDependency -> (PackageName, VersionRange) Source #
Extract the package name and the version range from a LegacyExeDependency
.
unBuildTools :: ([LegacyExeDependency], [ExeDependency]) -> [(PackageName, VersionRange)] Source #
Extract and join package names and version ranges of '[LegacyExeDependency]' and '[ExeDependency]'.
unSystemDependency :: ([PkgconfigDependency], [String]) -> [SystemDependency] Source #
Extract dependency names from '[PkgconfigDependency]' and '[SystemDependency]'. >>> (PkgconfigDependency "foo" _ver) --> (SystemDependency "foo.pc") >>> "foo" --> (SystemDependency "libfoo.so")
unDepV :: Dependency -> (PackageName, VersionRange) Source #
Extract the PackageName
and VersionRange
of a Dependency
.
getUrl :: PackageDescription -> String Source #
Extract the url from PackageDescription
.
It tries homepage
, the head of sourceRepos
, and finally fallback into hackage website.
getTwo :: Getting b s b -> s -> s -> (b, b) Source #
Apply a Getting
to two values respectively, and get the result as a pair.
buildDependsIfBuild :: BuildInfo -> [Dependency] Source #
Same as targetBuildDepends
, but check if this is buildable
.
buildToolsAndbuildToolDependsIfBuild :: BuildInfo -> ([LegacyExeDependency], [ExeDependency]) Source #
buildToolDepends
combined with buildTools
, and check if this is buildable
.
Actually, we should avoid accessing these two fields directly, in in favor of getAllToolDependencies
pkgconfigDependsAndExtraLibsIfBuild :: BuildInfo -> ([PkgconfigDependency], [String]) Source #
pkgconfigDepends
combined with extraLibs
, and check if this is buildable
.
traceCallStack :: (HasCallStack, MemberWithError Trace r) => Sem r () Source #
Trace CallStack
.
depNotInGHCLib :: SolvedDependency -> Bool Source #
SolvedDependency
x
' is not provided by ghc.
depNotMyself :: PackageName -> SolvedDependency -> Bool Source #
SolvedDependency
x
's name is not equal to name
.
depIsKind :: DependencyKind -> SolvedDependency -> Bool Source #
SolvedDependency
x
' has DependencyKind
k
.
extractFromEVR :: String -> ArchLinuxVersion Source #
Extract package version from epoch-version-release.
>>>
extractFromEVR "8.10.2-1"
"8.10.2">>>
extractFromEVR "3:2.4.11-19"
"2.4.11"
isProvided :: SolvedPackage -> Bool Source #
Whether a SolvedPackage
is provided
archHsVersion :: String Source #
The version of arch-hs