module Agda.Version
  ( version
  , package
  , docsUrl
  ) where

import GHC.Generics ( Generic, Rep, packageName )
import Data.List ( intercalate )
import Data.Version ( Version(versionBranch) )

import qualified Paths_Agda as PA

-- | The version of Agda.

version :: String
version :: [Char]
version = forall a. [a] -> [[a]] -> [a]
intercalate [Char]
"." forall a b. (a -> b) -> a -> b
$ forall a b. (a -> b) -> [a] -> [b]
map forall a. Show a => a -> [Char]
show forall a b. (a -> b) -> a -> b
$
            Version -> [Int]
versionBranch Version
PA.version

-- | This package name.
-- This is mainly intended for use in the test suites to filter ephemeral
-- hash-fingerprinted package names like @Agda-2.6.2-5ceeWeguf1QFMaHLput4zw@.

package :: String
package :: [Char]
package = forall {k} (d :: k) k1 (t :: k -> (k1 -> *) -> k1 -> *)
       (f :: k1 -> *) (a :: k1).
Datatype d =>
t d f a -> [Char]
packageName (forall a. HasCallStack => a
undefined :: Rep AnArbitrarySymbolInThisPackage p)

-- | Returns a URL corresponding to the given section in the documentation for
-- the current version.
docsUrl :: String -> String
docsUrl :: [Char] -> [Char]
docsUrl [Char]
section = [Char]
"https://agda.readthedocs.io/en/v" forall a. [a] -> [a] -> [a]
++ [Char]
version forall a. [a] -> [a] -> [a]
++ [Char]
"/" forall a. [a] -> [a] -> [a]
++ [Char]
section

data AnArbitrarySymbolInThisPackage deriving forall x.
Rep AnArbitrarySymbolInThisPackage x
-> AnArbitrarySymbolInThisPackage
forall x.
AnArbitrarySymbolInThisPackage
-> Rep AnArbitrarySymbolInThisPackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AnArbitrarySymbolInThisPackage x
-> AnArbitrarySymbolInThisPackage
$cfrom :: forall x.
AnArbitrarySymbolInThisPackage
-> Rep AnArbitrarySymbolInThisPackage x
Generic