{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ViewPatterns #-}

-----------------------------------------------------------------------------

-- |
-- Module      :  Distribution.Simple.Setup.Haddock
-- Copyright   :  Isaac Jones 2003-2004
--                Duncan Coutts 2007
-- License     :  BSD3
--
-- Maintainer  :  cabal-devel@haskell.org
-- Portability :  portable
--
-- Definition of the haddock command-line options.
-- See: @Distribution.Simple.Setup@
module Distribution.Simple.Setup.Haddock
  ( HaddockTarget (..)
  , HaddockFlags
    ( HaddockCommonFlags
    , haddockVerbosity
    , haddockDistPref
    , haddockCabalFilePath
    , haddockWorkingDir
    , haddockTargets
    , ..
    )
  , emptyHaddockFlags
  , defaultHaddockFlags
  , haddockCommand
  , Visibility (..)
  , HaddockProjectFlags (..)
  , emptyHaddockProjectFlags
  , defaultHaddockProjectFlags
  , haddockProjectCommand
  , haddockOptions
  , haddockProjectOptions
  ) where

import Distribution.Compat.Prelude hiding (get)
import Prelude ()

import qualified Distribution.Compat.CharParsing as P
import Distribution.Parsec
import Distribution.Pretty
import Distribution.Simple.Command hiding (boolOpt, boolOpt')
import Distribution.Simple.Flag
import Distribution.Simple.InstallDirs
import Distribution.Simple.Program
import Distribution.Simple.Setup.Common
import Distribution.Utils.Path
import Distribution.Verbosity

import qualified Text.PrettyPrint as Disp

-- ------------------------------------------------------------

-- * Haddock flags

-- ------------------------------------------------------------

-- | When we build haddock documentation, there are two cases:
--
-- 1. We build haddocks only for the current development version,
--    intended for local use and not for distribution. In this case,
--    we store the generated documentation in @<dist>/doc/html/<package name>@.
--
-- 2. We build haddocks for intended for uploading them to hackage.
--    In this case, we need to follow the layout that hackage expects
--    from documentation tarballs, and we might also want to use different
--    flags than for development builds, so in this case we store the generated
--    documentation in @<dist>/doc/html/<package id>-docs@.
data HaddockTarget = ForHackage | ForDevelopment deriving (HaddockTarget -> HaddockTarget -> Bool
(HaddockTarget -> HaddockTarget -> Bool)
-> (HaddockTarget -> HaddockTarget -> Bool) -> Eq HaddockTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HaddockTarget -> HaddockTarget -> Bool
== :: HaddockTarget -> HaddockTarget -> Bool
$c/= :: HaddockTarget -> HaddockTarget -> Bool
/= :: HaddockTarget -> HaddockTarget -> Bool
Eq, Int -> HaddockTarget -> ShowS
[HaddockTarget] -> ShowS
HaddockTarget -> String
(Int -> HaddockTarget -> ShowS)
-> (HaddockTarget -> String)
-> ([HaddockTarget] -> ShowS)
-> Show HaddockTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HaddockTarget -> ShowS
showsPrec :: Int -> HaddockTarget -> ShowS
$cshow :: HaddockTarget -> String
show :: HaddockTarget -> String
$cshowList :: [HaddockTarget] -> ShowS
showList :: [HaddockTarget] -> ShowS
Show, (forall x. HaddockTarget -> Rep HaddockTarget x)
-> (forall x. Rep HaddockTarget x -> HaddockTarget)
-> Generic HaddockTarget
forall x. Rep HaddockTarget x -> HaddockTarget
forall x. HaddockTarget -> Rep HaddockTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HaddockTarget -> Rep HaddockTarget x
from :: forall x. HaddockTarget -> Rep HaddockTarget x
$cto :: forall x. Rep HaddockTarget x -> HaddockTarget
to :: forall x. Rep HaddockTarget x -> HaddockTarget
Generic, Typeable)

instance Binary HaddockTarget
instance Structured HaddockTarget

instance Pretty HaddockTarget where
  pretty :: HaddockTarget -> Doc
pretty HaddockTarget
ForHackage = String -> Doc
Disp.text String
"for-hackage"
  pretty HaddockTarget
ForDevelopment = String -> Doc
Disp.text String
"for-development"

instance Parsec HaddockTarget where
  parsec :: forall (m :: * -> *). CabalParsing m => m HaddockTarget
parsec =
    [m HaddockTarget] -> m HaddockTarget
forall (m :: * -> *) a. Alternative m => [m a] -> m a
P.choice
      [ m HaddockTarget -> m HaddockTarget
forall a. m a -> m a
forall (m :: * -> *) a. Parsing m => m a -> m a
P.try (m HaddockTarget -> m HaddockTarget)
-> m HaddockTarget -> m HaddockTarget
forall a b. (a -> b) -> a -> b
$ String -> m String
forall (m :: * -> *). CharParsing m => String -> m String
P.string String
"for-hackage" m String -> m HaddockTarget -> m HaddockTarget
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> HaddockTarget -> m HaddockTarget
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return HaddockTarget
ForHackage
      , String -> m String
forall (m :: * -> *). CharParsing m => String -> m String
P.string String
"for-development" m String -> m HaddockTarget -> m HaddockTarget
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> HaddockTarget -> m HaddockTarget
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return HaddockTarget
ForDevelopment
      ]

data HaddockFlags = HaddockFlags
  { HaddockFlags -> CommonSetupFlags
haddockCommonFlags :: !CommonSetupFlags
  , HaddockFlags -> [(String, String)]
haddockProgramPaths :: [(String, FilePath)]
  , HaddockFlags -> [(String, [String])]
haddockProgramArgs :: [(String, [String])]
  , HaddockFlags -> Flag Bool
haddockHoogle :: Flag Bool
  , HaddockFlags -> Flag Bool
haddockHtml :: Flag Bool
  , HaddockFlags -> Flag String
haddockHtmlLocation :: Flag String
  , HaddockFlags -> Flag HaddockTarget
haddockForHackage :: Flag HaddockTarget
  , HaddockFlags -> Flag Bool
haddockExecutables :: Flag Bool
  , HaddockFlags -> Flag Bool
haddockTestSuites :: Flag Bool
  , HaddockFlags -> Flag Bool
haddockBenchmarks :: Flag Bool
  , HaddockFlags -> Flag Bool
haddockForeignLibs :: Flag Bool
  , HaddockFlags -> Flag Bool
haddockInternal :: Flag Bool
  , HaddockFlags -> Flag String
haddockCss :: Flag FilePath
  , HaddockFlags -> Flag Bool
haddockLinkedSource :: Flag Bool
  , HaddockFlags -> Flag Bool
haddockQuickJump :: Flag Bool
  , HaddockFlags -> Flag String
haddockHscolourCss :: Flag FilePath
  , HaddockFlags -> Flag PathTemplate
haddockContents :: Flag PathTemplate
  , HaddockFlags -> Flag PathTemplate
haddockIndex :: Flag PathTemplate
  , HaddockFlags -> Flag Bool
haddockKeepTempFiles :: Flag Bool
  , HaddockFlags -> Flag String
haddockBaseUrl :: Flag String
  , HaddockFlags -> Flag String
haddockResourcesDir :: Flag String
  , HaddockFlags -> Flag String
haddockOutputDir :: Flag FilePath
  , HaddockFlags -> Flag Bool
haddockUseUnicode :: Flag Bool
  }
  deriving (Int -> HaddockFlags -> ShowS
[HaddockFlags] -> ShowS
HaddockFlags -> String
(Int -> HaddockFlags -> ShowS)
-> (HaddockFlags -> String)
-> ([HaddockFlags] -> ShowS)
-> Show HaddockFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HaddockFlags -> ShowS
showsPrec :: Int -> HaddockFlags -> ShowS
$cshow :: HaddockFlags -> String
show :: HaddockFlags -> String
$cshowList :: [HaddockFlags] -> ShowS
showList :: [HaddockFlags] -> ShowS
Show, (forall x. HaddockFlags -> Rep HaddockFlags x)
-> (forall x. Rep HaddockFlags x -> HaddockFlags)
-> Generic HaddockFlags
forall x. Rep HaddockFlags x -> HaddockFlags
forall x. HaddockFlags -> Rep HaddockFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HaddockFlags -> Rep HaddockFlags x
from :: forall x. HaddockFlags -> Rep HaddockFlags x
$cto :: forall x. Rep HaddockFlags x -> HaddockFlags
to :: forall x. Rep HaddockFlags x -> HaddockFlags
Generic, Typeable)

pattern HaddockCommonFlags
  :: Flag Verbosity
  -> Flag (SymbolicPath Pkg (Dir Dist))
  -> Flag (SymbolicPath CWD (Dir Pkg))
  -> Flag (SymbolicPath Pkg File)
  -> [String]
  -> HaddockFlags
pattern $mHaddockCommonFlags :: forall {r}.
HaddockFlags
-> (Flag Verbosity
    -> Flag (SymbolicPath Pkg ('Dir Dist))
    -> Flag (SymbolicPath CWD ('Dir Pkg))
    -> Flag (SymbolicPath Pkg 'File)
    -> [String]
    -> r)
-> ((# #) -> r)
-> r
HaddockCommonFlags
  { HaddockFlags -> Flag Verbosity
haddockVerbosity
  , HaddockFlags -> Flag (SymbolicPath Pkg ('Dir Dist))
haddockDistPref
  , HaddockFlags -> Flag (SymbolicPath CWD ('Dir Pkg))
haddockWorkingDir
  , HaddockFlags -> Flag (SymbolicPath Pkg 'File)
haddockCabalFilePath
  , HaddockFlags -> [String]
haddockTargets
  } <-
  ( haddockCommonFlags ->
      CommonSetupFlags
        { setupVerbosity = haddockVerbosity
        , setupDistPref = haddockDistPref
        , setupWorkingDir = haddockWorkingDir
        , setupCabalFilePath = haddockCabalFilePath
        , setupTargets = haddockTargets
        }
    )

instance Binary HaddockFlags
instance Structured HaddockFlags

defaultHaddockFlags :: HaddockFlags
defaultHaddockFlags :: HaddockFlags
defaultHaddockFlags =
  HaddockFlags
    { haddockCommonFlags :: CommonSetupFlags
haddockCommonFlags = CommonSetupFlags
defaultCommonSetupFlags
    , haddockProgramPaths :: [(String, String)]
haddockProgramPaths = [(String, String)]
forall a. Monoid a => a
mempty
    , haddockProgramArgs :: [(String, [String])]
haddockProgramArgs = []
    , haddockHoogle :: Flag Bool
haddockHoogle = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockHtml :: Flag Bool
haddockHtml = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockHtmlLocation :: Flag String
haddockHtmlLocation = Flag String
forall a. Flag a
NoFlag
    , haddockForHackage :: Flag HaddockTarget
haddockForHackage = Flag HaddockTarget
forall a. Flag a
NoFlag
    , haddockExecutables :: Flag Bool
haddockExecutables = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockTestSuites :: Flag Bool
haddockTestSuites = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockBenchmarks :: Flag Bool
haddockBenchmarks = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockForeignLibs :: Flag Bool
haddockForeignLibs = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockInternal :: Flag Bool
haddockInternal = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockCss :: Flag String
haddockCss = Flag String
forall a. Flag a
NoFlag
    , haddockLinkedSource :: Flag Bool
haddockLinkedSource = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockQuickJump :: Flag Bool
haddockQuickJump = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockHscolourCss :: Flag String
haddockHscolourCss = Flag String
forall a. Flag a
NoFlag
    , haddockContents :: Flag PathTemplate
haddockContents = Flag PathTemplate
forall a. Flag a
NoFlag
    , haddockKeepTempFiles :: Flag Bool
haddockKeepTempFiles = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockIndex :: Flag PathTemplate
haddockIndex = Flag PathTemplate
forall a. Flag a
NoFlag
    , haddockBaseUrl :: Flag String
haddockBaseUrl = Flag String
forall a. Flag a
NoFlag
    , haddockResourcesDir :: Flag String
haddockResourcesDir = Flag String
forall a. Flag a
NoFlag
    , haddockOutputDir :: Flag String
haddockOutputDir = Flag String
forall a. Flag a
NoFlag
    , haddockUseUnicode :: Flag Bool
haddockUseUnicode = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    }

haddockCommand :: CommandUI HaddockFlags
haddockCommand :: CommandUI HaddockFlags
haddockCommand =
  CommandUI
    { commandName :: String
commandName = String
"haddock"
    , commandSynopsis :: String
commandSynopsis = String
"Generate Haddock HTML documentation."
    , commandDescription :: Maybe ShowS
commandDescription = ShowS -> Maybe ShowS
forall a. a -> Maybe a
Just (ShowS -> Maybe ShowS) -> ShowS -> Maybe ShowS
forall a b. (a -> b) -> a -> b
$ \String
_ ->
        String
"Requires the program haddock, version 2.x.\n"
    , commandNotes :: Maybe ShowS
commandNotes = Maybe ShowS
forall a. Maybe a
Nothing
    , commandUsage :: ShowS
commandUsage =
        String -> [String] -> ShowS
usageAlternatives String
"haddock" ([String] -> ShowS) -> [String] -> ShowS
forall a b. (a -> b) -> a -> b
$
          [ String
"[FLAGS]"
          , String
"COMPONENTS [FLAGS]"
          ]
    , commandDefaultFlags :: HaddockFlags
commandDefaultFlags = HaddockFlags
defaultHaddockFlags
    , commandOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
        ShowOrParseArgs -> [OptionField HaddockFlags]
haddockOptions ShowOrParseArgs
showOrParseArgs
          [OptionField HaddockFlags]
-> [OptionField HaddockFlags] -> [OptionField HaddockFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockFlags -> [(String, String)])
-> ([(String, String)] -> HaddockFlags -> HaddockFlags)
-> [OptionField HaddockFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths
            ProgramDb
progDb
            ShowOrParseArgs
ParseArgs
            HaddockFlags -> [(String, String)]
haddockProgramPaths
            (\[(String, String)]
v HaddockFlags
flags -> HaddockFlags
flags{haddockProgramPaths = v})
          [OptionField HaddockFlags]
-> [OptionField HaddockFlags] -> [OptionField HaddockFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockFlags -> [(String, [String])])
-> ([(String, [String])] -> HaddockFlags -> HaddockFlags)
-> [OptionField HaddockFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption
            ProgramDb
progDb
            ShowOrParseArgs
showOrParseArgs
            HaddockFlags -> [(String, [String])]
haddockProgramArgs
            (\[(String, [String])]
v HaddockFlags
fs -> HaddockFlags
fs{haddockProgramArgs = v})
          [OptionField HaddockFlags]
-> [OptionField HaddockFlags] -> [OptionField HaddockFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockFlags -> [(String, [String])])
-> ([(String, [String])] -> HaddockFlags -> HaddockFlags)
-> [OptionField HaddockFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions
            ProgramDb
progDb
            ShowOrParseArgs
ParseArgs
            HaddockFlags -> [(String, [String])]
haddockProgramArgs
            (\[(String, [String])]
v HaddockFlags
flags -> HaddockFlags
flags{haddockProgramArgs = v})
    }
  where
    progDb :: ProgramDb
progDb =
      Program -> ProgramDb -> ProgramDb
addKnownProgram Program
haddockProgram (ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$
        Program -> ProgramDb -> ProgramDb
addKnownProgram Program
ghcProgram (ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$
          ProgramDb
emptyProgramDb

haddockOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
haddockOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
haddockOptions ShowOrParseArgs
showOrParseArgs =
  (HaddockFlags -> CommonSetupFlags)
-> (CommonSetupFlags -> HaddockFlags -> HaddockFlags)
-> ShowOrParseArgs
-> [OptionField HaddockFlags]
-> [OptionField HaddockFlags]
forall flags.
(flags -> CommonSetupFlags)
-> (CommonSetupFlags -> flags -> flags)
-> ShowOrParseArgs
-> [OptionField flags]
-> [OptionField flags]
withCommonSetupOptions
    HaddockFlags -> CommonSetupFlags
haddockCommonFlags
    (\CommonSetupFlags
c HaddockFlags
f -> HaddockFlags
f{haddockCommonFlags = c})
    ShowOrParseArgs
showOrParseArgs
    [ String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"keep-temp-files"]
        String
"Keep temporary files"
        HaddockFlags -> Flag Bool
haddockKeepTempFiles
        (\Flag Bool
b HaddockFlags
flags -> HaddockFlags
flags{haddockKeepTempFiles = b})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"hoogle"]
        String
"Generate a hoogle database"
        HaddockFlags -> Flag Bool
haddockHoogle
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockHoogle = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"html"]
        String
"Generate HTML documentation (the default)"
        HaddockFlags -> Flag Bool
haddockHtml
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockHtml = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"html-location"]
        String
"Location of HTML documentation for pre-requisite packages"
        HaddockFlags -> Flag String
haddockHtmlLocation
        (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags{haddockHtmlLocation = v})
        (String
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"URL")
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag HaddockTarget)
-> (Flag HaddockTarget -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag HaddockTarget)
     (Flag HaddockTarget -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"for-hackage"]
        String
"Collection of flags to generate documentation suitable for upload to hackage"
        HaddockFlags -> Flag HaddockTarget
haddockForHackage
        (\Flag HaddockTarget
v HaddockFlags
flags -> HaddockFlags
flags{haddockForHackage = v})
        (Flag HaddockTarget
-> MkOptDescr
     (HaddockFlags -> Flag HaddockTarget)
     (Flag HaddockTarget -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b a. Eq b => b -> MkOptDescr (a -> b) (b -> a -> a) a
noArg (HaddockTarget -> Flag HaddockTarget
forall a. a -> Flag a
Flag HaddockTarget
ForHackage))
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"executables"]
        String
"Run haddock for Executables targets"
        HaddockFlags -> Flag Bool
haddockExecutables
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockExecutables = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"tests"]
        String
"Run haddock for Test Suite targets"
        HaddockFlags -> Flag Bool
haddockTestSuites
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockTestSuites = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"benchmarks"]
        String
"Run haddock for Benchmark targets"
        HaddockFlags -> Flag Bool
haddockBenchmarks
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockBenchmarks = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"foreign-libraries"]
        String
"Run haddock for Foreign Library targets"
        HaddockFlags -> Flag Bool
haddockForeignLibs
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockForeignLibs = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"all"]
        String
"Run haddock for all targets"
        ( \HaddockFlags
f ->
            [Flag Bool] -> Flag Bool
allFlags
              [ HaddockFlags -> Flag Bool
haddockExecutables HaddockFlags
f
              , HaddockFlags -> Flag Bool
haddockTestSuites HaddockFlags
f
              , HaddockFlags -> Flag Bool
haddockBenchmarks HaddockFlags
f
              , HaddockFlags -> Flag Bool
haddockForeignLibs HaddockFlags
f
              ]
        )
        ( \Flag Bool
v HaddockFlags
flags ->
            HaddockFlags
flags
              { haddockExecutables = v
              , haddockTestSuites = v
              , haddockBenchmarks = v
              , haddockForeignLibs = v
              }
        )
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"internal"]
        String
"Run haddock for internal modules and include all symbols"
        HaddockFlags -> Flag Bool
haddockInternal
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockInternal = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"css"]
        String
"Use PATH as the haddock stylesheet"
        HaddockFlags -> Flag String
haddockCss
        (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags{haddockCss = v})
        (String
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"hyperlink-source", String
"hyperlink-sources", String
"hyperlinked-source"]
        String
"Hyperlink the documentation to the source code"
        HaddockFlags -> Flag Bool
haddockLinkedSource
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockLinkedSource = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"quickjump"]
        String
"Generate an index for interactive documentation navigation"
        HaddockFlags -> Flag Bool
haddockQuickJump
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockQuickJump = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"hscolour-css"]
        String
"Use PATH as the HsColour stylesheet"
        HaddockFlags -> Flag String
haddockHscolourCss
        (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags{haddockHscolourCss = v})
        (String
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag PathTemplate)
     (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"contents-location"]
        String
"Bake URL in as the location for the contents page"
        HaddockFlags -> Flag PathTemplate
haddockContents
        (\Flag PathTemplate
v HaddockFlags
flags -> HaddockFlags
flags{haddockContents = v})
        ( String
-> (String -> Flag PathTemplate)
-> (Flag PathTemplate -> [String])
-> MkOptDescr
     (HaddockFlags -> Flag PathTemplate)
     (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg'
            String
"URL"
            (PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> (String -> PathTemplate) -> String -> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> PathTemplate
toPathTemplate)
            (Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag PathTemplate -> Flag String)
-> Flag PathTemplate
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate)
        )
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag PathTemplate)
     (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"index-location"]
        String
"Use a separately-generated HTML index"
        HaddockFlags -> Flag PathTemplate
haddockIndex
        (\Flag PathTemplate
v HaddockFlags
flags -> HaddockFlags
flags{haddockIndex = v})
        ( String
-> (String -> Flag PathTemplate)
-> (Flag PathTemplate -> [String])
-> MkOptDescr
     (HaddockFlags -> Flag PathTemplate)
     (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg'
            String
"URL"
            (PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> (String -> PathTemplate) -> String -> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> PathTemplate
toPathTemplate)
            (Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag PathTemplate -> Flag String)
-> Flag PathTemplate
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate)
        )
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"base-url"]
        String
"Base URL for static files."
        HaddockFlags -> Flag String
haddockBaseUrl
        (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags{haddockBaseUrl = v})
        (String
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"URL")
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"resources-dir"]
        String
"location of Haddocks static / auxiliary files"
        HaddockFlags -> Flag String
haddockResourcesDir
        (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags{haddockResourcesDir = v})
        (String
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"output-dir"]
        String
"Generate haddock documentation into this directory. This flag is provided as a technology preview and is subject to change in the next releases."
        HaddockFlags -> Flag String
haddockOutputDir
        (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags{haddockOutputDir = v})
        (String
-> MkOptDescr
     (HaddockFlags -> Flag String)
     (Flag String -> HaddockFlags -> HaddockFlags)
     HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
    , String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
     (HaddockFlags -> Flag Bool)
     (Flag Bool -> HaddockFlags -> HaddockFlags)
     HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
        String
""
        [String
"use-unicode"]
        String
"Pass --use-unicode option to haddock"
        HaddockFlags -> Flag Bool
haddockUseUnicode
        (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags{haddockUseUnicode = v})
        MkOptDescr
  (HaddockFlags -> Flag Bool)
  (Flag Bool -> HaddockFlags -> HaddockFlags)
  HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
    ]

emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags = HaddockFlags
forall a. Monoid a => a
mempty

instance Monoid HaddockFlags where
  mempty :: HaddockFlags
mempty = HaddockFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
  mappend :: HaddockFlags -> HaddockFlags -> HaddockFlags
mappend = HaddockFlags -> HaddockFlags -> HaddockFlags
forall a. Semigroup a => a -> a -> a
(<>)

instance Semigroup HaddockFlags where
  <> :: HaddockFlags -> HaddockFlags -> HaddockFlags
(<>) = HaddockFlags -> HaddockFlags -> HaddockFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend

-- ------------------------------------------------------------

-- * HaddocksFlags flags

-- ------------------------------------------------------------

-- | Governs whether modules from a given interface should be visible or
-- hidden in the Haddock generated content page.  We don't expose this
-- functionality to the user, but simply use 'Visible' for only local packages.
-- Visibility of modules is available since @haddock-2.26.1@.
data Visibility = Visible | Hidden
  deriving (Visibility -> Visibility -> Bool
(Visibility -> Visibility -> Bool)
-> (Visibility -> Visibility -> Bool) -> Eq Visibility
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Visibility -> Visibility -> Bool
== :: Visibility -> Visibility -> Bool
$c/= :: Visibility -> Visibility -> Bool
/= :: Visibility -> Visibility -> Bool
Eq, Int -> Visibility -> ShowS
[Visibility] -> ShowS
Visibility -> String
(Int -> Visibility -> ShowS)
-> (Visibility -> String)
-> ([Visibility] -> ShowS)
-> Show Visibility
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Visibility -> ShowS
showsPrec :: Int -> Visibility -> ShowS
$cshow :: Visibility -> String
show :: Visibility -> String
$cshowList :: [Visibility] -> ShowS
showList :: [Visibility] -> ShowS
Show)

data HaddockProjectFlags = HaddockProjectFlags
  { HaddockProjectFlags -> Flag Bool
haddockProjectHackage :: Flag Bool
  -- ^ a shortcut option which builds documentation linked to hackage.  It implies:
  -- * `--html-location='https://hackage.haskell.org/package/$prg-$version/docs'
  -- * `--quickjump`
  -- * `--gen-index`
  -- * `--gen-contents`
  -- * `--hyperlinked-source`
  , -- options passed to @haddock@ via 'createHaddockIndex'
    HaddockProjectFlags -> Flag String
haddockProjectDir :: Flag String
  -- ^ output directory of combined haddocks, the default is './haddocks'
  , HaddockProjectFlags -> Flag String
haddockProjectPrologue :: Flag String
  , HaddockProjectFlags
-> Flag [(String, Maybe String, Maybe String, Visibility)]
haddockProjectInterfaces :: Flag [(FilePath, Maybe FilePath, Maybe FilePath, Visibility)]
  -- ^ 'haddocksInterfaces' is inferred by the 'haddocksAction'; currently not
  -- exposed to the user.
  , -- options passed to @haddock@ via 'HaddockFlags' when building
    -- documentation

    HaddockProjectFlags -> [(String, String)]
haddockProjectProgramPaths :: [(String, FilePath)]
  , HaddockProjectFlags -> [(String, [String])]
haddockProjectProgramArgs :: [(String, [String])]
  , HaddockProjectFlags -> Flag Bool
haddockProjectHoogle :: Flag Bool
  , -- haddockHtml is not supported
    HaddockProjectFlags -> Flag String
haddockProjectHtmlLocation :: Flag String
  , -- haddockForHackage is not supported
    HaddockProjectFlags -> Flag Bool
haddockProjectExecutables :: Flag Bool
  , HaddockProjectFlags -> Flag Bool
haddockProjectTestSuites :: Flag Bool
  , HaddockProjectFlags -> Flag Bool
haddockProjectBenchmarks :: Flag Bool
  , HaddockProjectFlags -> Flag Bool
haddockProjectForeignLibs :: Flag Bool
  , HaddockProjectFlags -> Flag Bool
haddockProjectInternal :: Flag Bool
  , HaddockProjectFlags -> Flag String
haddockProjectCss :: Flag FilePath
  , HaddockProjectFlags -> Flag String
haddockProjectHscolourCss :: Flag FilePath
  , -- haddockContent is not supported, a fixed value is provided
    -- haddockIndex is not supported, a fixed value is provided
    -- haddockDistPerf is not supported, note: it changes location of the haddocks
    HaddockProjectFlags -> Flag Bool
haddockProjectKeepTempFiles :: Flag Bool
  , HaddockProjectFlags -> Flag Verbosity
haddockProjectVerbosity :: Flag Verbosity
  , -- haddockBaseUrl is not supported, a fixed value is provided
    HaddockProjectFlags -> Flag String
haddockProjectResourcesDir :: Flag String
  , HaddockProjectFlags -> Flag Bool
haddockProjectUseUnicode :: Flag Bool
  }
  deriving (Int -> HaddockProjectFlags -> ShowS
[HaddockProjectFlags] -> ShowS
HaddockProjectFlags -> String
(Int -> HaddockProjectFlags -> ShowS)
-> (HaddockProjectFlags -> String)
-> ([HaddockProjectFlags] -> ShowS)
-> Show HaddockProjectFlags
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HaddockProjectFlags -> ShowS
showsPrec :: Int -> HaddockProjectFlags -> ShowS
$cshow :: HaddockProjectFlags -> String
show :: HaddockProjectFlags -> String
$cshowList :: [HaddockProjectFlags] -> ShowS
showList :: [HaddockProjectFlags] -> ShowS
Show, (forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x)
-> (forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags)
-> Generic HaddockProjectFlags
forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags
forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x
from :: forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x
$cto :: forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags
to :: forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags
Generic, Typeable)

defaultHaddockProjectFlags :: HaddockProjectFlags
defaultHaddockProjectFlags :: HaddockProjectFlags
defaultHaddockProjectFlags =
  HaddockProjectFlags
    { haddockProjectHackage :: Flag Bool
haddockProjectHackage = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectDir :: Flag String
haddockProjectDir = String -> Flag String
forall a. a -> Flag a
Flag String
"./haddocks"
    , haddockProjectPrologue :: Flag String
haddockProjectPrologue = Flag String
forall a. Flag a
NoFlag
    , haddockProjectTestSuites :: Flag Bool
haddockProjectTestSuites = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectProgramPaths :: [(String, String)]
haddockProjectProgramPaths = [(String, String)]
forall a. Monoid a => a
mempty
    , haddockProjectProgramArgs :: [(String, [String])]
haddockProjectProgramArgs = [(String, [String])]
forall a. Monoid a => a
mempty
    , haddockProjectHoogle :: Flag Bool
haddockProjectHoogle = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectHtmlLocation :: Flag String
haddockProjectHtmlLocation = Flag String
forall a. Flag a
NoFlag
    , haddockProjectExecutables :: Flag Bool
haddockProjectExecutables = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectBenchmarks :: Flag Bool
haddockProjectBenchmarks = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectForeignLibs :: Flag Bool
haddockProjectForeignLibs = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectInternal :: Flag Bool
haddockProjectInternal = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectCss :: Flag String
haddockProjectCss = Flag String
forall a. Flag a
NoFlag
    , haddockProjectHscolourCss :: Flag String
haddockProjectHscolourCss = Flag String
forall a. Flag a
NoFlag
    , haddockProjectKeepTempFiles :: Flag Bool
haddockProjectKeepTempFiles = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
    , haddockProjectVerbosity :: Flag Verbosity
haddockProjectVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal
    , haddockProjectResourcesDir :: Flag String
haddockProjectResourcesDir = Flag String
forall a. Flag a
NoFlag
    , haddockProjectInterfaces :: Flag [(String, Maybe String, Maybe String, Visibility)]
haddockProjectInterfaces = Flag [(String, Maybe String, Maybe String, Visibility)]
forall a. Flag a
NoFlag
    , haddockProjectUseUnicode :: Flag Bool
haddockProjectUseUnicode = Flag Bool
forall a. Flag a
NoFlag
    }

haddockProjectCommand :: CommandUI HaddockProjectFlags
haddockProjectCommand :: CommandUI HaddockProjectFlags
haddockProjectCommand =
  CommandUI
    { commandName :: String
commandName = String
"v2-haddock-project"
    , commandSynopsis :: String
commandSynopsis = String
"Generate Haddocks HTML documentation for the cabal project."
    , commandDescription :: Maybe ShowS
commandDescription = ShowS -> Maybe ShowS
forall a. a -> Maybe a
Just (ShowS -> Maybe ShowS) -> ShowS -> Maybe ShowS
forall a b. (a -> b) -> a -> b
$ \String
_ ->
        String
"Requires the program haddock, version 2.26.\n"
    , commandNotes :: Maybe ShowS
commandNotes = Maybe ShowS
forall a. Maybe a
Nothing
    , commandUsage :: ShowS
commandUsage =
        String -> [String] -> ShowS
usageAlternatives String
"haddock-project" ([String] -> ShowS) -> [String] -> ShowS
forall a b. (a -> b) -> a -> b
$
          [ String
"[FLAGS]"
          , String
"COMPONENTS [FLAGS]"
          ]
    , commandDefaultFlags :: HaddockProjectFlags
commandDefaultFlags = HaddockProjectFlags
defaultHaddockProjectFlags
    , commandOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
        ShowOrParseArgs -> [OptionField HaddockProjectFlags]
haddockProjectOptions ShowOrParseArgs
showOrParseArgs
          [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockProjectFlags -> [(String, String)])
-> ([(String, String)]
    -> HaddockProjectFlags -> HaddockProjectFlags)
-> [OptionField HaddockProjectFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths
            ProgramDb
progDb
            ShowOrParseArgs
ParseArgs
            HaddockProjectFlags -> [(String, String)]
haddockProjectProgramPaths
            (\[(String, String)]
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectProgramPaths = v})
          [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockProjectFlags -> [(String, [String])])
-> ([(String, [String])]
    -> HaddockProjectFlags -> HaddockProjectFlags)
-> [OptionField HaddockProjectFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption
            ProgramDb
progDb
            ShowOrParseArgs
showOrParseArgs
            HaddockProjectFlags -> [(String, [String])]
haddockProjectProgramArgs
            (\[(String, [String])]
v HaddockProjectFlags
fs -> HaddockProjectFlags
fs{haddockProjectProgramArgs = v})
          [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockProjectFlags -> [(String, [String])])
-> ([(String, [String])]
    -> HaddockProjectFlags -> HaddockProjectFlags)
-> [OptionField HaddockProjectFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions
            ProgramDb
progDb
            ShowOrParseArgs
ParseArgs
            HaddockProjectFlags -> [(String, [String])]
haddockProjectProgramArgs
            (\[(String, [String])]
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectProgramArgs = v})
    }
  where
    progDb :: ProgramDb
progDb =
      Program -> ProgramDb -> ProgramDb
addKnownProgram Program
haddockProgram (ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$
        Program -> ProgramDb -> ProgramDb
addKnownProgram Program
ghcProgram (ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$
          ProgramDb
emptyProgramDb

haddockProjectOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags]
haddockProjectOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags]
haddockProjectOptions ShowOrParseArgs
_showOrParseArgs =
  [ String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"hackage"]
      ( [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
          [ String
"A short-cut option to build documentation linked to hackage."
          ]
      )
      HaddockProjectFlags -> Flag Bool
haddockProjectHackage
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectHackage = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"output"]
      String
"Output directory"
      HaddockProjectFlags -> Flag String
haddockProjectDir
      (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectDir = v})
      (String
-> (Maybe String -> Flag String)
-> (Flag String -> [Maybe String])
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"DIRECTORY" Maybe String -> Flag String
forall a. Maybe a -> Flag a
maybeToFlag ((String -> Maybe String) -> [String] -> [Maybe String]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Maybe String
forall a. a -> Maybe a
Just ([String] -> [Maybe String])
-> (Flag String -> [String]) -> Flag String -> [Maybe String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag String -> [String]
forall a. Flag a -> [a]
flagToList))
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"prologue"]
      String
"File path to a prologue file in haddock format"
      HaddockProjectFlags -> Flag String
haddockProjectPrologue
      (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectPrologue = v})
      (String
-> (Maybe String -> Flag String)
-> (Flag String -> [Maybe String])
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"PATH" Maybe String -> Flag String
forall a. Maybe a -> Flag a
maybeToFlag ((String -> Maybe String) -> [String] -> [Maybe String]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Maybe String
forall a. a -> Maybe a
Just ([String] -> [Maybe String])
-> (Flag String -> [String]) -> Flag String -> [Maybe String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag String -> [String]
forall a. Flag a -> [a]
flagToList))
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"hoogle"]
      String
"Generate a hoogle database"
      HaddockProjectFlags -> Flag Bool
haddockProjectHoogle
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectHoogle = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"html-location"]
      String
"Location of HTML documentation for pre-requisite packages"
      HaddockProjectFlags -> Flag String
haddockProjectHtmlLocation
      (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectHtmlLocation = v})
      (String
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"URL")
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"executables"]
      String
"Run haddock for Executables targets"
      HaddockProjectFlags -> Flag Bool
haddockProjectExecutables
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectExecutables = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"tests"]
      String
"Run haddock for Test Suite targets"
      HaddockProjectFlags -> Flag Bool
haddockProjectTestSuites
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectTestSuites = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"benchmarks"]
      String
"Run haddock for Benchmark targets"
      HaddockProjectFlags -> Flag Bool
haddockProjectBenchmarks
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectBenchmarks = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"foreign-libraries"]
      String
"Run haddock for Foreign Library targets"
      HaddockProjectFlags -> Flag Bool
haddockProjectForeignLibs
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectForeignLibs = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"all", String
"haddock-all"]
      String
"Run haddock for all targets"
      ( \HaddockProjectFlags
f ->
          [Flag Bool] -> Flag Bool
allFlags
            [ HaddockProjectFlags -> Flag Bool
haddockProjectExecutables HaddockProjectFlags
f
            , HaddockProjectFlags -> Flag Bool
haddockProjectTestSuites HaddockProjectFlags
f
            , HaddockProjectFlags -> Flag Bool
haddockProjectBenchmarks HaddockProjectFlags
f
            , HaddockProjectFlags -> Flag Bool
haddockProjectForeignLibs HaddockProjectFlags
f
            ]
      )
      ( \Flag Bool
v HaddockProjectFlags
flags ->
          HaddockProjectFlags
flags
            { haddockProjectExecutables = v
            , haddockProjectTestSuites = v
            , haddockProjectBenchmarks = v
            , haddockProjectForeignLibs = v
            }
      )
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"internal"]
      String
"Run haddock for internal modules and include all symbols"
      HaddockProjectFlags -> Flag Bool
haddockProjectInternal
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectInternal = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"css"]
      String
"Use PATH as the haddock stylesheet"
      HaddockProjectFlags -> Flag String
haddockProjectCss
      (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectCss = v})
      (String
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"hscolour-css"]
      String
"Use PATH as the HsColour stylesheet"
      HaddockProjectFlags -> Flag String
haddockProjectHscolourCss
      (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectHscolourCss = v})
      (String
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"keep-temp-files"]
      String
"Keep temporary files"
      HaddockProjectFlags -> Flag Bool
haddockProjectKeepTempFiles
      (\Flag Bool
b HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectKeepTempFiles = b})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  , (HaddockProjectFlags -> Flag Verbosity)
-> (Flag Verbosity -> HaddockProjectFlags -> HaddockProjectFlags)
-> OptionField HaddockProjectFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity
      HaddockProjectFlags -> Flag Verbosity
haddockProjectVerbosity
      (\Flag Verbosity
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectVerbosity = v})
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"resources-dir"]
      String
"location of Haddocks static / auxiliary files"
      HaddockProjectFlags -> Flag String
haddockProjectResourcesDir
      (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectResourcesDir = v})
      (String
-> MkOptDescr
     (HaddockProjectFlags -> Flag String)
     (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
  , String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
     (HaddockProjectFlags -> Flag Bool)
     (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
     HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option
      String
""
      [String
"use-unicode"]
      String
"Pass --use-unicode option to haddock"
      HaddockProjectFlags -> Flag Bool
haddockProjectUseUnicode
      (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags{haddockProjectUseUnicode = v})
      MkOptDescr
  (HaddockProjectFlags -> Flag Bool)
  (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
  HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
  ]

emptyHaddockProjectFlags :: HaddockProjectFlags
emptyHaddockProjectFlags :: HaddockProjectFlags
emptyHaddockProjectFlags = HaddockProjectFlags
forall a. Monoid a => a
mempty

instance Monoid HaddockProjectFlags where
  mempty :: HaddockProjectFlags
mempty = HaddockProjectFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
  mappend :: HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
mappend = HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
forall a. Semigroup a => a -> a -> a
(<>)

instance Semigroup HaddockProjectFlags where
  <> :: HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
(<>) = HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend