Module CPM.Diff.API

This module contains functions that can compare the API of one version of a package to another.

Summary of exported operations:

getBaseTemp :: IO String  Deterministic 
compareModulesFromPackages :: Config -> Repository -> GlobalCache -> String -> (Int,Int,Int,Maybe String) -> String -> (Int,Int,Int,Maybe String) -> Maybe [String] -> ErrorLogger [(String,(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl]))]  Non-deterministic 
Compares two versions of a package from the global package cache.
compareModulesFromPackageAndDir :: Config -> Repository -> GlobalCache -> String -> String -> (Int,Int,Int,Maybe String) -> Maybe [String] -> ErrorLogger [(String,(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl]))]  Non-deterministic 
Compares a package version from a directory to a package version from the global package cache.
compareModulesInDirs :: Config -> Repository -> GlobalCache -> String -> String -> Maybe [String] -> ErrorLogger [(String,(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl]))]  Non-deterministic 
Compares package versions from two directories.
compareApiModule :: Package -> String -> [Package] -> Package -> String -> [Package] -> String -> IO (Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl])  Non-deterministic 
Compares a single module from two package versions.
showDifferences :: [(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl])] -> (Int,Int,Int,Maybe String) -> (Int,Int,Int,Maybe String) -> String  Deterministic 
Prints a list of differences to the user.

Exported datatypes:


Differences

Differences between two versions of a package. First component is present if the module is missing in one of the package versions. The other components list the differences if the module is present in both versions.

Type synonym: Differences = (Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl])


Difference

A single difference between two versions of a module.

Constructors:

  • Addition :: a -> Difference a
  • Removal :: a -> Difference a
  • Change :: a -> a -> Difference a

Exported operations:

getBaseTemp :: IO String  Deterministic 

compareModulesFromPackages :: Config -> Repository -> GlobalCache -> String -> (Int,Int,Int,Maybe String) -> String -> (Int,Int,Int,Maybe String) -> Maybe [String] -> ErrorLogger [(String,(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl]))]  Non-deterministic 

Compares two versions of a package from the global package cache.

Example call:
(compareModulesFromPackages cfg repo gc nameA verA nameB verB onlyMods)
Parameters:
  • cfg : the CPM configuration
  • repo : the central package index
  • gc : the global package cache
  • nameA : the name of package version A
  • verA : the version of package version A
  • nameB : the name of package version B
  • verB : the version of package version B
  • onlyMods : a list of modules to compare

compareModulesFromPackageAndDir :: Config -> Repository -> GlobalCache -> String -> String -> (Int,Int,Int,Maybe String) -> Maybe [String] -> ErrorLogger [(String,(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl]))]  Non-deterministic 

Compares a package version from a directory to a package version from the global package cache.

Example call:
(compareModulesFromPackageAndDir cfg repo gc dirA nameB verB onlyMods)
Parameters:
  • cfg : the CPM configuration
  • repo : the central package index
  • gc : the global package cache
  • dirA : the directory containing package version A
  • nameB : the name of package version B
  • verB : the version of package version B
  • onlyMods : a list of modules to compare

compareModulesInDirs :: Config -> Repository -> GlobalCache -> String -> String -> Maybe [String] -> ErrorLogger [(String,(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl]))]  Non-deterministic 

Compares package versions from two directories.

Example call:
(compareModulesInDirs cfg repo gc dirA dirB onlyMods)
Parameters:
  • cfg : the CPM configuration
  • repo : the central package index
  • gc : the global package cache
  • dirA : the directory containing package version A
  • dirB : the directory containing package version B
  • onlyMods : a list of modules to compare

compareApiModule :: Package -> String -> [Package] -> Package -> String -> [Package] -> String -> IO (Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl])  Non-deterministic 

Compares a single module from two package versions.

Example call:
(compareApiModule pkgA dirA depsA pkgB dirB depsB mod)
Parameters:
  • pkgA : version A of the package
  • dirA : the directory containing version A of the package
  • depsA : the resolved dependencies of version A of the package
  • pkgB : version B of the package
  • dirB : the directory containing version B of the package
  • depsB : the resolved dependencies of version B of the package
  • mod : the name of the module

showDifferences :: [(Maybe (Difference String),[Difference CFuncDecl],[Difference CTypeDecl],[Difference COpDecl])] -> (Int,Int,Int,Maybe String) -> (Int,Int,Int,Maybe String) -> String  Deterministic 

Prints a list of differences to the user.

Example call:
(showDifferences diffs verA verB)
Parameters:
  • diffs : the list of differences
  • verA : version A of the package
  • verB : version B of the package