{-# LANGUAGE TemplateHaskell, CPP #-}
{-# OPTIONS_GHC -fforce-recomp #-}
-- Recompilation is needed to obtain the correct build time.
module MagicHaskeller.VersionInfo where
import Data.Time
import Language.Haskell.TH
#ifdef CABAL
import Paths_MagicHaskeller(version)
import Data.Version(showVersion)
#endif

versionInfo, mhVersion, ghcVersion, now :: String
versionInfo :: String
versionInfo = String
mhVersion String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" built with GHC-" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
ghcVersion String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" at " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
now
#ifdef CABAL
mhVersion :: String
mhVersion = Version -> String
showVersion Version
version
#else
mhVersion = ""
#endif
ghcVersion :: String
ghcVersion = case __GLASGOW_HASKELL__ `divMod` 100 of (b,s) -> shows b $ '.' : show s

now :: String
now = $(runIO getCurrentTime >>= \t -> return (LitE $ StringL $ show t)) -- This requires the -fforce-recomp flag in order to be correct.