Is there a Haskell module for compiling metadata into my packages

Viewed 59

I've successfully used the GitHash module to bake things like the branch name and commit hash into programs.

Are there any other, similar, modules for extracting data from package.yaml in a similar way? (I guess TemplateHaskell is involved?) Specifically, for the moment, I'm interested in the version string, but a wider-reaching solution would be potentially very useful.

1 Answers

There is a special module that contains a packages own version, among other things: Paths_*pkgname* (link to the relevant section of Cabal's documentation).

The Paths_pkgname module also includes some other useful functions and values, which record the version of the package and some other directories which the package has been configured to be installed into (e.g. data files live in getDataDir):

version :: Version

getBinDir :: IO FilePath
getLibDir :: IO FilePath
getDynLibDir :: IO FilePath
getDataDir :: IO FilePath
getLibexecDir :: IO FilePath
getSysconfDir :: IO FilePath
Related