Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Haskell module for compiling metadata into my packages

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.

like image 555
Brent.Longborough Avatar asked Sep 16 '25 07:09

Brent.Longborough


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
like image 85
Li-yao Xia Avatar answered Sep 19 '25 04:09

Li-yao Xia