{-# LANGUAGE TemplateHaskell #-}
module Language.Haskell.Liquid.UX.SimpleVersion (simpleVersion) where
import Data.Version (Version, showVersion)
import GitHash (GitInfo, giDirty, giHash, tGitInfoCwdTry)
import Language.Haskell.TH (Exp, Q)
import qualified Language.Haskell.TH.Syntax as TH.Syntax
import qualified Language.Haskell.TH.Syntax.Compat as TH.Syntax.Compat
simpleVersion :: Version -> Q Exp
simpleVersion :: Version -> Q Exp
simpleVersion Version
version =
[|
concat
( [ "Version ",
$(TH.Syntax.lift $ showVersion version)
]
++ case $(TH.Syntax.Compat.unTypeSplice tGitInfoCwdTry) :: Either String GitInfo of
Left _ -> []
Right gi ->
[ ", Git revision ",
giHash gi,
if giDirty gi then " (dirty)" else ""
]
)
|]