{-# LANGUAGE DeriveGeneric #-}

module Distribution.Simple.Build.PackageInfoModule.Z (render, Z (..)) where

import Distribution.ZinzaPrelude (Generic, execWriter, tell)

data Z = Z
  { Z -> [Char]
zPackageName :: String
  , Z -> [Char]
zVersionDigits :: String
  , Z -> [Char]
zSynopsis :: String
  , Z -> [Char]
zCopyright :: String
  , Z -> [Char]
zHomepage :: String
  }
  deriving ((forall x. Z -> Rep Z x) -> (forall x. Rep Z x -> Z) -> Generic Z
forall x. Rep Z x -> Z
forall x. Z -> Rep Z x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Z -> Rep Z x
from :: forall x. Z -> Rep Z x
$cto :: forall x. Rep Z x -> Z
to :: forall x. Rep Z x -> Z
Generic)

render :: Z -> String
render :: Z -> [Char]
render Z
z_root = Writer () -> [Char]
forall a. Writer a -> [Char]
execWriter (Writer () -> [Char]) -> Writer () -> [Char]
forall a b. (a -> b) -> a -> b
$ do
  [Char] -> Writer ()
tell [Char]
"{-# LANGUAGE NoRebindableSyntax #-}\n"
  [Char] -> Writer ()
tell [Char]
"{-# OPTIONS_GHC -w #-}\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"{-|\n"
  [Char] -> Writer ()
tell [Char]
"Module      : PackageInfo_"
  [Char] -> Writer ()
tell (Z -> [Char]
zPackageName Z
z_root)
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"Description : Contents of some of the package's Cabal file's fields.\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"WARNING: This module was generated by Cabal. Any modifications will be\n"
  [Char] -> Writer ()
tell [Char]
"overwritten if the module is regenerated.\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"This module exports values that record information from some of the fields of\n"
  [Char] -> Writer ()
tell [Char]
"the package's Cabal package description file (Cabal file).\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"For further information about the fields in a Cabal file, see the Cabal User\n"
  [Char] -> Writer ()
tell [Char]
"Guide.\n"
  [Char] -> Writer ()
tell [Char]
"-}\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"module PackageInfo_"
  [Char] -> Writer ()
tell (Z -> [Char]
zPackageName Z
z_root)
  [Char] -> Writer ()
tell [Char]
" (\n"
  [Char] -> Writer ()
tell [Char]
"    name,\n"
  [Char] -> Writer ()
tell [Char]
"    version,\n"
  [Char] -> Writer ()
tell [Char]
"    synopsis,\n"
  [Char] -> Writer ()
tell [Char]
"    copyright,\n"
  [Char] -> Writer ()
tell [Char]
"    homepage,\n"
  [Char] -> Writer ()
tell [Char]
"  ) where\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"import Data.Version (Version(..))\n"
  [Char] -> Writer ()
tell [Char]
"import Prelude\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"-- |The content of the @name@ field of the package's Cabal file, but with any\n"
  [Char] -> Writer ()
tell [Char]
"-- hyphen characters replaced by underscore characters.\n"
  [Char] -> Writer ()
tell [Char]
"name :: String\n"
  [Char] -> Writer ()
tell [Char]
"name = "
  [Char] -> Writer ()
tell ([Char] -> [Char]
forall a. Show a => a -> [Char]
show ([Char] -> [Char]) -> [Char] -> [Char]
forall a b. (a -> b) -> a -> b
$ Z -> [Char]
zPackageName Z
z_root)
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"-- |The content of the @version@ field of the package's Cabal file.\n"
  [Char] -> Writer ()
tell [Char]
"version :: Version\n"
  [Char] -> Writer ()
tell [Char]
"version = Version "
  [Char] -> Writer ()
tell (Z -> [Char]
zVersionDigits Z
z_root)
  [Char] -> Writer ()
tell [Char]
" []\n"
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"-- |The content of the @synopsis@ field of the package's Cabal file.\n"
  [Char] -> Writer ()
tell [Char]
"synopsis :: String\n"
  [Char] -> Writer ()
tell [Char]
"synopsis = "
  [Char] -> Writer ()
tell ([Char] -> [Char]
forall a. Show a => a -> [Char]
show ([Char] -> [Char]) -> [Char] -> [Char]
forall a b. (a -> b) -> a -> b
$ Z -> [Char]
zSynopsis Z
z_root)
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"-- |The content of the @copyright@ field of the package's Cabal file.\n"
  [Char] -> Writer ()
tell [Char]
"copyright :: String\n"
  [Char] -> Writer ()
tell [Char]
"copyright = "
  [Char] -> Writer ()
tell ([Char] -> [Char]
forall a. Show a => a -> [Char]
show ([Char] -> [Char]) -> [Char] -> [Char]
forall a b. (a -> b) -> a -> b
$ Z -> [Char]
zCopyright Z
z_root)
  [Char] -> Writer ()
tell [Char]
"\n"
  [Char] -> Writer ()
tell [Char]
"-- |The content of the @homepage@ field of the package's Cabal file.\n"
  [Char] -> Writer ()
tell [Char]
"homepage :: String\n"
  [Char] -> Writer ()
tell [Char]
"homepage = "
  [Char] -> Writer ()
tell ([Char] -> [Char]
forall a. Show a => a -> [Char]
show ([Char] -> [Char]) -> [Char] -> [Char]
forall a b. (a -> b) -> a -> b
$ Z -> [Char]
zHomepage Z
z_root)
  [Char] -> Writer ()
tell [Char]
"\n"