
Eugene Kirpichov
It can be used like this:
{-# LANGUAGE TemplateHaskell #-} import Distribution.VcsRevision.Git import Language.Haskell.TH.Syntax
showMyGitVersion :: String showMyGitVersion = $(do v <- qRunIO getRevision lift $ case v of Nothing -> "<none>" Just (hash,True) -> hash ++ " (with local modifications)" Just (hash,False) -> hash)
Btw, I'm wondering (haven't tried myself), when using TH to generate the version string, does GHC's and/or cabal's dependency tracking a) reliably refresh the generated hash so that you can be sure it's the git-commit id compiled into the binary is reliable, and b) avoid re-generating the TH file and redundant recompilation if the git commit-id hasn't changed? hvr --