summaryrefslogtreecommitdiff
path: root/src/Version.hs
blob: c0f7edf9b9c08979786d952223e381eac33aaca5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE TemplateHaskell #-}


module Version ( version ) where

import           Control.Monad.Trans (liftIO)
import qualified Language.Haskell.TH as TH
import           System.Process      (readProcess)
import GHC.IO (catchAny)

version :: String
version = "walint rc3 2021 (" <>
    $(do
        hash <- liftIO $ catchAny (readProcess "git" ["rev-parse", "HEAD"] "")
                         (\_ -> pure "[unknown]")
        pure . TH.LitE . TH.StringL $ take 40 hash) ++
    ")"