{-# OPTIONS_GHC -Wunused-imports #-}

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 = [Char] -> [[Char]] -> [Char]
forall a. [a] -> [[a]] -> [a]
intercalate [Char]
"." ([[Char]] -> [Char]) -> [[Char]] -> [Char]
forall a b. (a -> b) -> a -> b
$ (Int -> [Char]) -> [Int] -> [[Char]]
forall a b. (a -> b) -> [a] -> [b]
map Int -> [Char]
forall a. Show a => a -> [Char]
show ([Int] -> [[Char]]) -> [Int] -> [[Char]]
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 = M1
  D
  ('MetaData
     "AnArbitrarySymbolInThisPackage"
     "Agda.Version"
     "Agda-2.6.4-inplace"
     'False)
  V1
  Any
-> [Char]
forall {k} (d :: k) k1 (t :: k -> (k1 -> *) -> k1 -> *)
       (f :: k1 -> *) (a :: k1).
Datatype d =>
t d f a -> [Char]
forall k1 (t :: Meta -> (k1 -> *) -> k1 -> *) (f :: k1 -> *)
       (a :: k1).
t ('MetaData
     "AnArbitrarySymbolInThisPackage"
     "Agda.Version"
     "Agda-2.6.4-inplace"
     'False)
  f
  a
-> [Char]
packageName (M1
  D
  ('MetaData
     "AnArbitrarySymbolInThisPackage"
     "Agda.Version"
     "Agda-2.6.4-inplace"
     'False)
  V1
  p
Rep AnArbitrarySymbolInThisPackage p
forall {p}. Rep AnArbitrarySymbolInThisPackage p
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" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
version [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
"/" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
section

data AnArbitrarySymbolInThisPackage deriving (forall x.
 AnArbitrarySymbolInThisPackage
 -> Rep AnArbitrarySymbolInThisPackage x)
-> (forall x.
    Rep AnArbitrarySymbolInThisPackage x
    -> AnArbitrarySymbolInThisPackage)
-> Generic AnArbitrarySymbolInThisPackage
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
$cfrom :: forall x.
AnArbitrarySymbolInThisPackage
-> Rep AnArbitrarySymbolInThisPackage x
from :: forall x.
AnArbitrarySymbolInThisPackage
-> Rep AnArbitrarySymbolInThisPackage x
$cto :: forall x.
Rep AnArbitrarySymbolInThisPackage x
-> AnArbitrarySymbolInThisPackage
to :: forall x.
Rep AnArbitrarySymbolInThisPackage x
-> AnArbitrarySymbolInThisPackage
Generic