Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- makeGhcVersionChecker :: IO FilePath -> TExpQ GhcVersionChecker
- type GhcVersionChecker = String -> IO InstallationCheck
- data InstallationCheck
- = InstallationChecked { }
- | InstallationMismatch {
- libdir :: !String
- compileTime, runTime :: !Version
- | InstallationNotFound { }
- data PackageCheckResult
- data PackageCheck
- = VersionMismatch {
- compileTime, runTime :: !Version
- | AbiMismatch {
- compileTimeAbi, runTimeAbi :: !String
- compileTime :: !Version
- | VersionMatch { }
- = VersionMismatch {
- guessCompatibility :: PackageCheckResult -> CompatibilityGuess
- data CompatibilityGuess
- = ProbablyCompatible { }
- | NotCompatible { }
- data NotCompatibleReason
- = PackageVersionMismatch {
- compileTime :: !Version
- runTime :: !Version
- packageName :: !String
- | BasePackageAbiMismatch {
- compileTimeAbi :: !String
- runTimeAbi :: !String
- compileTime :: !Version
- = PackageVersionMismatch {
- checkGhcVersion :: [(String, PackageVersion)] -> GhcVersionChecker
GHC version check
makeGhcVersionChecker :: IO FilePath -> TExpQ GhcVersionChecker Source #
makeGhcVersionChecker libdir
returns a function to check the run-time
version of GHC against the compile-time version. It performs two checks:
- It checks the version of the GHC installation given the run-time libdir In some platforms, like Nix, the libdir is not fixed at compile-time
- It compares the version of the
ghc
package, if found at run-time. If not, it compares the abi of thebase
package.
ghcChecker :: IO(Ghc (String -> PackageCheck)) ghcChecker = $$(makeGhcVersionChecker (pure $ Just GHC.Paths.libdir)) checkGhcVersion :: IO () checkGhcVersion = do InstallationChecked packageCheck <- ghcChecker runTimeLibdir res <- runGhc (Just runTimeLibdir) $ do setupGhcApi result <- packageCheck case guessCompatibility result of ...
type GhcVersionChecker = String -> IO InstallationCheck Source #
Given a run-time libdir, checks the ghc installation and returns
a Ghc
action to check the package database
data InstallationCheck Source #
InstallationChecked | The GHC installation looks fine. Further checks are needed for the package libraries. |
| |
InstallationMismatch | The libdir points to a different GHC version |
| |
InstallationNotFound | The libdir does not exist |
data PackageCheckResult Source #
PackageCheckSuccess !(NonEmpty (String, PackageCheck)) | All the compile time packages tested match |
PackageCheckFailure !(NonEmpty (String, PackageCheck)) | Found package mismatches |
PackageCheckInconclusive ![String] | None of the compile time packages could be found |
PackageCheckError !SomeException | An exception arised during the package check |
data PackageCheck Source #
VersionMismatch | Different versions |
| |
AbiMismatch | Same version but different abi |
| |
VersionMatch | Same version and abi |
Instances
Eq PackageCheck Source # | |
Defined in GHC.Check (==) :: PackageCheck -> PackageCheck -> Bool # (/=) :: PackageCheck -> PackageCheck -> Bool # | |
Show PackageCheck Source # | |
Defined in GHC.Check showsPrec :: Int -> PackageCheck -> ShowS # show :: PackageCheck -> String # showList :: [PackageCheck] -> ShowS # |
Interpreting the results
guessCompatibility :: PackageCheckResult -> CompatibilityGuess Source #
Interpret a PackageCheckResult
into a yes/no GHC compatibility answer
data CompatibilityGuess Source #
The result of interpreting a PackageCheckResult
Instances
Eq CompatibilityGuess Source # | |
Defined in GHC.Check (==) :: CompatibilityGuess -> CompatibilityGuess -> Bool # (/=) :: CompatibilityGuess -> CompatibilityGuess -> Bool # | |
Show CompatibilityGuess Source # | |
Defined in GHC.Check showsPrec :: Int -> CompatibilityGuess -> ShowS # show :: CompatibilityGuess -> String # showList :: [CompatibilityGuess] -> ShowS # |
data NotCompatibleReason Source #
PackageVersionMismatch | |
| |
BasePackageAbiMismatch | |
|
Instances
Eq NotCompatibleReason Source # | |
Defined in GHC.Check (==) :: NotCompatibleReason -> NotCompatibleReason -> Bool # (/=) :: NotCompatibleReason -> NotCompatibleReason -> Bool # | |
Show NotCompatibleReason Source # | |
Defined in GHC.Check showsPrec :: Int -> NotCompatibleReason -> ShowS # show :: NotCompatibleReason -> String # showList :: [NotCompatibleReason] -> ShowS # |
Exports for TH
checkGhcVersion :: [(String, PackageVersion)] -> GhcVersionChecker Source #
Checks if the run-time version of the ghc
package matches the given version.