module Development.GitRev
( gitBranch,
gitCommitCount,
gitCommitDate,
gitDescribe,
gitDiff,
gitDirty,
gitDirtyTracked,
gitHash,
gitShortHash,
gitTree,
)
where
import Development.GitRev.Utils qualified as Utils
import Development.GitRev.Utils.Git qualified as Git
import Language.Haskell.TH (ExpQ, Q)
import Language.Haskell.TH.Syntax (Lift (lift))
gitHash :: ExpQ
gitHash :: ExpQ
gitHash = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitHashQ
gitShortHash :: ExpQ
gitShortHash :: ExpQ
gitShortHash = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitShortHashQ
gitBranch :: ExpQ
gitBranch :: ExpQ
gitBranch = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitBranchQ
gitDescribe :: ExpQ
gitDescribe :: ExpQ
gitDescribe = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitDescribeQ
gitDirty :: ExpQ
gitDirty :: ExpQ
gitDirty = Q Bool -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q Bool -> ExpQ) -> Q Bool -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError Bool) -> Q Bool
forall (f :: * -> *) e. Functor f => f (Either e Bool) -> f Bool
Utils.projectFalse Q (Either GitError Bool)
Git.gitDirtyQ
gitDirtyTracked :: ExpQ
gitDirtyTracked :: ExpQ
gitDirtyTracked = Q Bool -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q Bool -> ExpQ) -> Q Bool -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError Bool) -> Q Bool
forall (f :: * -> *) e. Functor f => f (Either e Bool) -> f Bool
Utils.projectFalse Q (Either GitError Bool)
Git.gitDirtyTrackedQ
gitCommitCount :: ExpQ
gitCommitCount :: ExpQ
gitCommitCount = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitCommitCountQ
gitCommitDate :: ExpQ
gitCommitDate :: ExpQ
gitCommitDate = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitCommitDateQ
gitDiff :: ExpQ
gitDiff :: ExpQ
gitDiff = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitDiffQ
gitTree :: ExpQ
gitTree :: ExpQ
gitTree = Q String -> ExpQ
forall a. Lift a => Q a -> ExpQ
qToExp (Q String -> ExpQ) -> Q String -> ExpQ
forall a b. (a -> b) -> a -> b
$ Q (Either GitError String) -> Q String
forall (f :: * -> *) e.
Functor f =>
f (Either e String) -> f String
Utils.projectStringUnknown Q (Either GitError String)
Git.gitTreeQ
qToExp :: forall a. (Lift a) => Q a -> ExpQ
qToExp :: forall a. Lift a => Q a -> ExpQ
qToExp = (Q a -> (a -> ExpQ) -> ExpQ
forall a b. Q a -> (a -> Q b) -> Q b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= a -> ExpQ
forall t (m :: * -> *). (Lift t, Quote m) => t -> m Exp
forall (m :: * -> *). Quote m => a -> m Exp
lift)