-- | Auto-detects the current version, used by `hawk --version`.
module System.Console.Hawk.Version (versionString) where

import Data.List (intercalate)
import Data.Version (versionBranch)

-- magic self-referential module created by cabal
import Paths_haskell_awk (version)


-- | Something like "1.0"
versionString :: String
versionString :: String
versionString = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
"."
              ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Int -> String) -> [Int] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Int -> String
forall a. Show a => a -> String
show
              ([Int] -> [String]) -> [Int] -> [String]
forall a b. (a -> b) -> a -> b
$ Version -> [Int]
versionBranch Version
version