-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A Setup.hs helper for running doctests
--   
--   As of now (end of 2021), there isn't <tt>cabal doctest</tt> command.
--   Yet, to properly work, <tt>doctest</tt> needs plenty of configuration.
--   This library provides the common bits for writing a custom
--   <tt>Setup.hs</tt>.
@package cabal-doctest
@version 1.0.10


-- | See cabal-doctest README for full-fledged recipes &amp; caveats.
--   
--   The provided <a>generateBuildModule</a> generates a
--   <tt>Build_{suffix}</tt> module, with caller-chosen <tt>suffix</tt>
--   that is usually <tt>"doctests"</tt> -- module <tt>Build_doctests</tt>.
--   
--   That module exports just enough compiler flags, so that doctest could
--   be simply
--   
--   <pre>
--   module Main where
--   
--   import Build_doctests (flags, pkgs, module_sources)
--   import Test.Doctest (doctest)
--   
--   main :: IO ()
--   main = doctest args
--     where
--       args = flags ++ pkgs ++ module_sources
--   </pre>
--   
--   As this module-generation is done at build-time,
--   <a>generateBuildModule</a> must be invoked from <tt>Setup.hs</tt>,
--   which also necessarily means <tt>build-type: Custom</tt>.
--   
--   <tt>Setup.hs</tt> can use libraries, but they must be declared as
--   dependencies in the <tt>custom-setup</tt> stanza of the user's cabal
--   file. To use <tt>cabal-doctest</tt> then:
--   
--   <pre>
--   custom-setup
--    setup-depends:
--      base &gt;= 4 &amp;&amp; &lt;5,
--      cabal-doctest &gt;= 1 &amp;&amp; &lt;1.1
--   </pre>
--   
--   Finally, simple shortcuts are provided to avoid an explicit dependency
--   on <tt>Cabal</tt> from <tt>setup-depends</tt>:
--   <a>defaultMainWithDoctests</a> and
--   <a>defaultMainAutoconfWithDoctests</a>.
module Distribution.Extra.Doctest

-- | A default <tt>Setup.hs</tt> main with doctests:
--   
--   <pre>
--   import Distribution.Extra.Doctest
--          (defaultMainWithDoctests)
--   
--   main :: IO ()
--   main = defaultMainWithDoctests "doctests"
--   </pre>
defaultMainWithDoctests :: String -> IO ()

-- | Like <a>defaultMainWithDoctests</a>, but for packages with
--   <tt>build-type: Configure</tt>.
defaultMainAutoconfWithDoctests :: String -> IO ()

-- | Compose <a>generateBuildModule</a> into Cabal's <a>UserHooks</a>
--   (prepending the action).
--   
--   This is exported for advanced custom Setup-s.
addDoctestsUserHook :: String -> UserHooks -> UserHooks

-- | <a>simpleUserHooks</a> with <a>generateBuildModule</a> already
--   wired-in.
doctestsUserHooks :: String -> UserHooks

-- | Generate a build module for the test suite.
--   
--   <pre>
--   import Distribution.Simple
--          (defaultMainWithHooks, UserHooks(..), simpleUserHooks)
--   import Distribution.Extra.Doctest
--          (generateBuildModule)
--   
--   main :: IO ()
--   main = defaultMainWithHooks simpleUserHooks
--       { buildHook = pkg lbi hooks flags -&gt; do
--           generateBuildModule "doctests" flags pkg lbi
--           buildHook simpleUserHooks pkg lbi hooks flags
--       }
--   </pre>
generateBuildModule :: String -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO ()
instance GHC.Show.Show Distribution.Extra.Doctest.Name
instance GHC.Classes.Eq Distribution.Extra.Doctest.Name
instance GHC.Show.Show Distribution.Extra.Doctest.Component
