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


-- | The Haskell Tool Stack
--   
--   Please see the README.md for usage information, and the wiki on Github
--   for more details. Also, note that the API for the library is not
--   currently stable, and may change significantly, even between minor
--   releases. It is currently only intended for use by the executable.
@package stack
@version 1.9.3


-- | Wrapper functions of <a>Simple</a> and <a>Client</a> to add the
--   'User-Agent' HTTP request header to each request.
module Network.HTTP.StackClient
httpJSON :: (MonadIO m, FromJSON a) => Request -> m (Response a)
httpLbs :: MonadIO m => Request -> m (Response ByteString)
httpLBS :: MonadIO m => Request -> m (Response ByteString)
httpNoBody :: MonadIO m => Request -> m (Response ())
httpSink :: MonadUnliftIO m => Request -> (Response () -> ConduitM ByteString Void m a) -> m a
setUserAgent :: Request -> Request
withResponse :: (MonadUnliftIO m, MonadIO n) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a
withResponseByManager :: MonadUnliftIO m => Request -> Manager -> (Response BodyReader -> m a) -> m a

-- | Set the request method
setRequestMethod :: ByteString -> Request -> Request

-- | Set the given request header to the given list of values. Removes any
--   previously set header values with the same name.
setRequestHeader :: HeaderName -> [ByteString] -> Request -> Request

-- | Add a request header name/value combination
addRequestHeader :: HeaderName -> ByteString -> Request -> Request

-- | Set the request body to the given <a>RequestBody</a>. You may want to
--   consider using one of the convenience functions in the modules, e.g.
--   <tt>requestBodyJSON</tt>.
--   
--   <i>Note</i>: This will not modify the request method. For that, please
--   use <tt>requestMethod</tt>. You likely don't want the default of
--   <tt>GET</tt>.
setRequestBody :: RequestBody -> Request -> Request

-- | Instead of using the default global <a>Manager</a>, use the supplied
--   <tt>Manager</tt>.
setRequestManager :: Manager -> Request -> Request

-- | Get all response headers
getResponseHeaders :: () => Response a -> [(HeaderName, ByteString)]

-- | Get the response body
getResponseBody :: () => Response a -> a

-- | Get the integral status code of the response
getResponseStatusCode :: () => Response a -> Int

-- | Response headers sent by the server.
--   
--   Since 0.1.0
responseHeaders :: Response body -> ResponseHeaders

-- | Status code of the response.
--   
--   Since 0.1.0
responseStatus :: Response body -> Status

-- | Response body sent by the server.
--   
--   Since 0.1.0
responseBody :: Response body -> body

-- | Convert a URL into a <a>Request</a>.
--   
--   This function defaults some of the values in <a>Request</a>, such as
--   setting <a>method</a> to <tt><a>GET</a></tt> and <a>requestHeaders</a>
--   to <tt>[]</tt>.
--   
--   Since this function uses <a>MonadThrow</a>, the return monad can be
--   anything that is an instance of <a>MonadThrow</a>, such as <a>IO</a>
--   or <a>Maybe</a>.
--   
--   You can place the request method at the beginning of the URL separated
--   by a space, e.g.:
--   
--   @@<tt> parseRequest "POST <a>http://httpbin.org/post"</a> </tt>@@
--   
--   Note that the request method must be provided as all capital letters.
--   
--   A <a>Request</a> created by this function won't cause exceptions on
--   non-2XX response status codes.
--   
--   To create a request which throws on non-2XX status codes, see
--   <a>parseUrlThrow</a>
parseRequest :: MonadThrow m => String -> m Request

-- | Same as <a>parseRequest</a>, but parse errors cause an impure
--   exception. Mostly useful for static strings which are known to be
--   correctly formatted.
parseRequest_ :: String -> Request

-- | A default request value, a GET request of localhost/:80, with an empty
--   request body.
--   
--   Note that the default <a>checkResponse</a> does nothing.
defaultRequest :: Request

-- | Validate a <a>URI</a>, then add it to the request.
setUri :: MonadThrow m => Request -> URI -> m Request

-- | Extract a <a>URI</a> from the request.
--   
--   Since 0.1.0
getUri :: Request -> URI

-- | Everything from the host to the query string.
--   
--   Since 0.1.0
path :: Request -> ByteString

-- | Check the response immediately after receiving the status and headers.
--   This can be useful for throwing exceptions on non-success status
--   codes.
--   
--   In previous versions of http-client, this went under the name
--   <tt>checkStatus</tt>, but was renamed to avoid confusion about the new
--   default behavior (doing nothing).
checkResponse :: Request -> Request -> Response BodyReader -> IO ()

-- | Same as <a>parseRequest</a>, except will throw an <a>HttpException</a>
--   in the event of a non-2XX response. This uses
--   <a>throwErrorStatusCodes</a> to implement <a>checkResponse</a>.
parseUrlThrow :: MonadThrow m => String -> m Request

-- | Custom HTTP request headers
--   
--   The Content-Length and Transfer-Encoding headers are set automatically
--   by this module, and shall not be added to <tt>requestHeaders</tt>.
--   
--   If not provided by the user, <tt>Host</tt> will automatically be set
--   based on the <tt>host</tt> and <tt>port</tt> fields.
--   
--   Moreover, the Accept-Encoding header is set implicitly to gzip for
--   convenience by default. This behaviour can be overridden if needed, by
--   setting the header explicitly to a different value. In order to omit
--   the Accept-Header altogether, set it to the empty string "". If you
--   need an empty Accept-Header (i.e. requesting the identity encoding),
--   set it to a non-empty white-space string, e.g. " ". See RFC 2616
--   section 14.3 for details about the semantics of the Accept-Header
--   field. If you request a content-encoding not supported by this module,
--   you will have to decode it yourself (see also the <a>decompress</a>
--   field).
--   
--   Note: Multiple header fields with the same field-name will result in
--   multiple header fields being sent and therefore it's the
--   responsibility of the client code to ensure that the rules from RFC
--   2616 section 4.2 are honoured.
--   
--   Since 0.1.0
requestHeaders :: Request -> RequestHeaders

-- | Get the current global <a>Manager</a>
getGlobalManager :: IO Manager

-- | Apply digest authentication to this request.
--   
--   Note that this function will need to make an HTTP request to the
--   server in order to get the nonce, thus the need for a <tt>Manager</tt>
--   and to live in <tt>IO</tt>. This also means that the request body will
--   be sent to the server. If the request body in the supplied
--   <tt>Request</tt> can only be read once, you should replace it with a
--   dummy value.
--   
--   In the event of successfully generating a digest, this will return a
--   <tt>Just</tt> value. If there is any problem with generating the
--   digest, it will return <tt>Nothing</tt>.
applyDigestAuth :: (MonadIO m, MonadThrow n) => ByteString -> ByteString -> Request -> Manager -> m (n Request)

-- | User friendly display of a <a>DigestAuthException</a>
displayDigestAuthException :: DigestAuthException -> String

-- | All information on how to connect to a host and what should be sent in
--   the HTTP request.
--   
--   If you simply wish to download from a URL, see <tt>parseRequest</tt>.
--   
--   The constructor for this data type is not exposed. Instead, you should
--   use either the <tt>defaultRequest</tt> value, or <tt>parseRequest</tt>
--   to construct from a URL, and then use the records below to make
--   modifications. This approach allows http-client to add configuration
--   options without breaking backwards compatibility.
--   
--   For example, to construct a POST request, you could do something like:
--   
--   <pre>
--   initReq &lt;- parseRequest "http://www.example.com/path"
--   let req = initReq
--               { method = "POST"
--               }
--   </pre>
--   
--   For more information, please see
--   <a>http://www.yesodweb.com/book/settings-types</a>.
--   
--   Since 0.1.0
data Request

-- | When using one of the <a>RequestBodyStream</a> /
--   <a>RequestBodyStreamChunked</a> constructors, you must ensure that the
--   <a>GivesPopper</a> can be called multiple times. Usually this is not a
--   problem.
--   
--   The <a>RequestBodyStreamChunked</a> will send a chunked request body.
--   Note that not all servers support this. Only use
--   <a>RequestBodyStreamChunked</a> if you know the server you're sending
--   to supports chunked request bodies.
--   
--   Since 0.1.0
data RequestBody
RequestBodyLBS :: ByteString -> RequestBody
RequestBodyBS :: ByteString -> RequestBody

-- | A simple representation of the HTTP response.
--   
--   Since 0.1.0
data Response body

-- | Keeps track of open connections for keep-alive.
--   
--   If possible, you should share a single <a>Manager</a> between multiple
--   threads and requests.
--   
--   Since 0.1.0
data Manager

-- | Header
type Header = (HeaderName, ByteString)

-- | Header name
type HeaderName = CI ByteString

-- | An exception which may be generated by this library
data HttpException

-- | Most exceptions are specific to a <a>Request</a>. Inspect the
--   <a>HttpExceptionContent</a> value for details on what occurred.
HttpExceptionRequest :: Request -> HttpExceptionContent -> HttpException
data HttpExceptionContent

-- | Generated by the <tt>parseUrlThrow</tt> function when the server
--   returns a non-2XX response status code.
--   
--   May include the beginning of the response body.
StatusCodeException :: Response () -> ByteString -> HttpExceptionContent

-- | HTTP Header names according to
--   <a>http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a>
hAccept :: HeaderName

-- | HTTP Header names according to
--   <a>http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a>
hContentLength :: HeaderName

-- | HTTP Header names according to
--   <a>http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a>
hContentMD5 :: HeaderName

-- | HTTP Header names according to
--   <a>http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a>
hCacheControl :: HeaderName

-- | HTTP Header names according to
--   <a>http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a>
hRange :: HeaderName

-- | HTTP Method constants.
methodPut :: Method

-- | OK 200
ok200 :: Status

-- | Partial Content 206
partialContent206 :: Status

-- | Define a HTTP proxy, consisting of a hostname and port number.
data Proxy

-- | Use the given proxy settings, regardless of the proxy value in the
--   <tt>Request</tt>.
--   
--   Since 0.4.7
useProxy :: Proxy -> ProxyOverride

-- | Never connect using a proxy, regardless of the proxy value in the
--   <tt>Request</tt>.
--   
--   Since 0.4.7
noProxy :: ProxyOverride

-- | Get the proxy settings from the default environment variable
--   (<tt>http_proxy</tt> for insecure, <tt>https_proxy</tt> for secure).
--   If no variable is set, then fall back to the given value.
--   <tt>Nothing</tt> is equivalent to <a>noProxy</a>, <tt>Just</tt> is
--   equivalent to <a>useProxy</a>.
--   
--   Since 0.4.7
proxyEnvironment :: Maybe Proxy -> ProxyOverride

-- | Set the proxy override value, for both HTTP (insecure) and HTTPS
--   (insecure) connections.
--   
--   Since 0.4.7
managerSetProxy :: ProxyOverride -> ManagerSettings -> ManagerSettings

-- | Add form data to the <a>Request</a>.
--   
--   This sets a new <a>requestBody</a>, adds a content-type request header
--   and changes the method to POST.
formDataBody :: MonadIO m => [Part] -> Request -> m Request

-- | Construct a <a>Part</a> from form name, filepath and a
--   <a>RequestBody</a>
--   
--   <pre>
--   partFileRequestBody "who_calls" "caller.json" $ RequestBodyBS "{\"caller\":\"Jason J Jason\"}"
--   </pre>
--   
--   <pre>
--   -- empty upload form
--   partFileRequestBody "file" mempty mempty
--   </pre>
--   
--   The <a>Part</a> does not have a content type associated with it.
partFileRequestBody :: Applicative m => Text -> FilePath -> RequestBody -> PartM m

-- | Make a <a>Part</a> whose content is a strict <a>ByteString</a>.
--   
--   The <a>Part</a> does not have a file name or content type associated
--   with it.
partBS :: Applicative m => Text -> ByteString -> PartM m

-- | Make a <a>Part</a> whose content is a lazy <a>ByteString</a>.
--   
--   The <a>Part</a> does not have a file name or content type associated
--   with it.
partLBS :: Applicative m => Text -> ByteString -> PartM m


-- | Extra Path utilities.
module Path.Extra

-- | Convert to FilePath but don't add a trailing slash.
toFilePathNoTrailingSep :: Path loc Dir -> FilePath

-- | Drop the root (either <tt>/</tt> on POSIX or <tt>C:\</tt>,
--   <tt>D:\</tt>, etc. on Windows).
dropRoot :: Path Abs t -> Path Rel t

-- | Collapse intermediate "." and ".." directories from path, then parse
--   it with <a>parseAbsDir</a>. (probably should be moved to the Path
--   module)
parseCollapsedAbsDir :: MonadThrow m => FilePath -> m (Path Abs Dir)

-- | Collapse intermediate "." and ".." directories from path, then parse
--   it with <a>parseAbsFile</a>. (probably should be moved to the Path
--   module)
parseCollapsedAbsFile :: MonadThrow m => FilePath -> m (Path Abs File)

-- | Add a relative FilePath to the end of a Path We can't parse the
--   FilePath first because we need to account for ".." in the FilePath
--   (#2895)
concatAndColapseAbsDir :: MonadThrow m => Path Abs Dir -> FilePath -> m (Path Abs Dir)

-- | If given file in <a>Maybe</a> does not exist, ensure we have
--   <a>Nothing</a>. This is to be used in conjunction with
--   <a>forgivingAbsence</a> and <a>resolveFile</a>.
--   
--   Previously the idiom <tt>forgivingAbsence (relsoveFile …)</tt> alone
--   was used, which relied on <a>canonicalizePath</a> throwing
--   <a>isDoesNotExistError</a> when path does not exist. As it turns out,
--   this behavior is actually not intentional and unreliable, see
--   <a>https://github.com/haskell/directory/issues/44</a>. This was
--   “fixed” in version <tt>1.2.3.0</tt> of <tt>directory</tt> package (now
--   it never throws). To make it work with all versions, we need to use
--   the following idiom:
--   
--   <pre>
--   forgivingAbsence (resolveFile …) &gt;&gt;= rejectMissingFile
--   </pre>
rejectMissingFile :: MonadIO m => Maybe (Path Abs File) -> m (Maybe (Path Abs File))

-- | See <a>rejectMissingFile</a>.
rejectMissingDir :: MonadIO m => Maybe (Path Abs Dir) -> m (Maybe (Path Abs Dir))

-- | Convert to a ByteString using toFilePath and UTF8.
pathToByteString :: Path b t -> ByteString

-- | Convert to a lazy ByteString using toFilePath and UTF8.
pathToLazyByteString :: Path b t -> ByteString
pathToText :: Path b t -> Text
tryGetModificationTime :: MonadIO m => Path Abs File -> m (Either () UTCTime)

module Paths_stack
version :: Version
getBinDir :: IO FilePath
getLibDir :: IO FilePath
getDynLibDir :: IO FilePath
getDataDir :: IO FilePath
getLibexecDir :: IO FilePath
getDataFileName :: FilePath -> IO FilePath
getSysconfDir :: IO FilePath

module Stack.Prelude

-- | Get a source for a file. Unlike <tt>sourceFile</tt>, doesn't require
--   <tt>ResourceT</tt>. Unlike explicit <tt>withBinaryFile</tt> and
--   <tt>sourceHandle</tt> usage, you can't accidentally use
--   <tt>WriteMode</tt> instead of <tt>ReadMode</tt>.
withSourceFile :: MonadUnliftIO m => FilePath -> (ConduitM i ByteString m () -> m a) -> m a

-- | Same idea as <a>withSourceFile</a>, see comments there.
withSinkFile :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a

-- | Like <a>withSinkFile</a>, but ensures that the file is atomically
--   moved after all contents are written.
withSinkFileCautious :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a

-- | Path version
withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a

-- | Like <a>withSystemTempDir</a>, but the temporary directory is not
--   deleted.
withKeepSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a

-- | Consume the stdout and stderr of a process feeding strict
--   <a>ByteString</a>s to the consumers.
--   
--   Throws a <tt>ReadProcessException</tt> if unsuccessful in launching,
--   or <tt>ProcessExitedUnsuccessfully</tt> if the process itself fails.
sinkProcessStderrStdout :: forall e o env. (HasProcessContext env, HasLogFunc env, HasCallStack) => String -> [String] -> ConduitM ByteString Void (RIO env) e -> ConduitM ByteString Void (RIO env) o -> RIO env (e, o)

-- | Consume the stdout of a process feeding strict <a>ByteString</a>s to a
--   consumer. If the process fails, spits out stdout and stderr as error
--   log level. Should not be used for long-running processes or ones with
--   lots of output; for that use <a>sinkProcessStderrStdout</a>.
--   
--   Throws a <tt>ReadProcessException</tt> if unsuccessful.
sinkProcessStdout :: (HasProcessContext env, HasLogFunc env, HasCallStack) => String -> [String] -> ConduitM ByteString Void (RIO env) a -> RIO env a
logProcessStderrStdout :: (HasCallStack, HasProcessContext env, HasLogFunc env) => ProcessConfig stdin stdoutIgnored stderrIgnored -> RIO env ()

-- | Read from the process, ignoring any output.
--   
--   Throws a <tt>ReadProcessException</tt> exception if the process fails.
readProcessNull :: (HasProcessContext env, HasLogFunc env, HasCallStack) => String -> [String] -> RIO env ()

-- | Use the new <a>ProcessContext</a>, but retain the working directory
--   from the parent environment.
withProcessContext :: HasProcessContext env => ProcessContext -> RIO env a -> RIO env a

-- | Remove a trailing carriage return if present
stripCR :: Text -> Text

-- | hIsTerminaDevice does not recognise handles to mintty terminals as
--   terminal devices, but isMinTTYHandle does.
hIsTerminalDeviceOrMinTTY :: MonadIO m => Handle -> m Bool

-- | Prompt the user by sending text to stdout, and taking a line of input
--   from stdin.
prompt :: MonadIO m => Text -> m Text

-- | Prompt the user by sending text to stdout, and collecting a line of
--   input from stdin. While taking input from stdin, input echoing is
--   disabled, to hide passwords.
--   
--   Based on code from cabal-install, Distribution.Client.Upload
promptPassword :: MonadIO m => Text -> m Text

-- | Prompt the user by sending text to stdout, and collecting a line of
--   input from stdin. If something other than "y" or "n" is entered, then
--   print a message indicating that "y" or "n" is expected, and ask again.
promptBool :: MonadIO m => Text -> m Bool

-- | Append two lists, i.e.,
--   
--   <pre>
--   [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
--   [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
--   </pre>
--   
--   If the first list is not finite, the result is the first list.
(++) :: () => [a] -> [a] -> [a]
infixr 5 ++

-- | The value of <tt>seq a b</tt> is bottom if <tt>a</tt> is bottom, and
--   otherwise equal to <tt>b</tt>. In other words, it evaluates the first
--   argument <tt>a</tt> to weak head normal form (WHNF). <tt>seq</tt> is
--   usually introduced to improve performance by avoiding unneeded
--   laziness.
--   
--   A note on evaluation order: the expression <tt>seq a b</tt> does
--   <i>not</i> guarantee that <tt>a</tt> will be evaluated before
--   <tt>b</tt>. The only guarantee given by <tt>seq</tt> is that the both
--   <tt>a</tt> and <tt>b</tt> will be evaluated before <tt>seq</tt>
--   returns a value. In particular, this means that <tt>b</tt> may be
--   evaluated before <tt>a</tt>. If you need to guarantee a specific order
--   of evaluation, you must use the function <tt>pseq</tt> from the
--   "parallel" package.
seq :: () => a -> b -> b

-- | <a>filter</a>, applied to a predicate and a list, returns the list of
--   those elements that satisfy the predicate; i.e.,
--   
--   <pre>
--   filter p xs = [ x | x &lt;- xs, p x]
--   </pre>
filter :: () => (a -> Bool) -> [a] -> [a]

-- | <a>zip</a> takes two lists and returns a list of corresponding pairs.
--   
--   <pre>
--   zip [1, 2] ['a', 'b'] = [(1, 'a'), (2, 'b')]
--   </pre>
--   
--   If one input list is short, excess elements of the longer list are
--   discarded:
--   
--   <pre>
--   zip [1] ['a', 'b'] = [(1, 'a')]
--   zip [1, 2] ['a'] = [(1, 'a')]
--   </pre>
--   
--   <a>zip</a> is right-lazy:
--   
--   <pre>
--   zip [] _|_ = []
--   zip _|_ [] = _|_
--   </pre>
zip :: () => [a] -> [b] -> [(a, b)]

-- | Extract the first component of a pair.
fst :: () => (a, b) -> a

-- | Extract the second component of a pair.
snd :: () => (a, b) -> b

-- | <a>otherwise</a> is defined as the value <a>True</a>. It helps to make
--   guards more readable. eg.
--   
--   <pre>
--   f x | x &lt; 0     = ...
--       | otherwise = ...
--   </pre>
otherwise :: Bool

-- | If the first argument evaluates to <a>True</a>, then the result is the
--   second argument. Otherwise an <tt>AssertionFailed</tt> exception is
--   raised, containing a <a>String</a> with the source file and line
--   number of the call to <a>assert</a>.
--   
--   Assertions can normally be turned on or off with a compiler flag (for
--   GHC, assertions are normally on unless optimisation is turned on with
--   <tt>-O</tt> or the <tt>-fignore-asserts</tt> option is given). When
--   assertions are turned off, the first argument to <a>assert</a> is
--   ignored, and the second argument is returned as the result.
assert :: () => Bool -> a -> a

-- | <a>map</a> <tt>f xs</tt> is the list obtained by applying <tt>f</tt>
--   to each element of <tt>xs</tt>, i.e.,
--   
--   <pre>
--   map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
--   map f [x1, x2, ...] == [f x1, f x2, ...]
--   </pre>
map :: () => (a -> b) -> [a] -> [b]

-- | Application operator. This operator is redundant, since ordinary
--   application <tt>(f x)</tt> means the same as <tt>(f <a>$</a> x)</tt>.
--   However, <a>$</a> has low, right-associative binding precedence, so it
--   sometimes allows parentheses to be omitted; for example:
--   
--   <pre>
--   f $ g $ h x  =  f (g (h x))
--   </pre>
--   
--   It is also useful in higher-order situations, such as <tt><a>map</a>
--   (<a>$</a> 0) xs</tt>, or <tt><a>zipWith</a> (<a>$</a>) fs xs</tt>.
--   
--   Note that <tt>($)</tt> is levity-polymorphic in its result type, so
--   that foo $ True where foo :: Bool -&gt; Int# is well-typed
($) :: () => (a -> b) -> a -> b
infixr 0 $

-- | general coercion from integral types
fromIntegral :: (Integral a, Num b) => a -> b

-- | general coercion to fractional types
realToFrac :: (Real a, Fractional b) => a -> b

-- | Conditional failure of <a>Alternative</a> computations. Defined by
--   
--   <pre>
--   guard True  = <a>pure</a> ()
--   guard False = <a>empty</a>
--   </pre>
--   
--   <h4><b>Examples</b></h4>
--   
--   Common uses of <a>guard</a> include conditionally signaling an error
--   in an error monad and conditionally rejecting the current choice in an
--   <a>Alternative</a>-based parser.
--   
--   As an example of signaling an error in the error monad <a>Maybe</a>,
--   consider a safe division function <tt>safeDiv x y</tt> that returns
--   <a>Nothing</a> when the denominator <tt>y</tt> is zero and
--   <tt><a>Just</a> (x `div` y)</tt> otherwise. For example:
--   
--   <pre>
--   &gt;&gt;&gt; safeDiv 4 0
--   Nothing
--   &gt;&gt;&gt; safeDiv 4 2
--   Just 2
--   </pre>
--   
--   A definition of <tt>safeDiv</tt> using guards, but not <a>guard</a>:
--   
--   <pre>
--   safeDiv :: Int -&gt; Int -&gt; Maybe Int
--   safeDiv x y | y /= 0    = Just (x `div` y)
--               | otherwise = Nothing
--   </pre>
--   
--   A definition of <tt>safeDiv</tt> using <a>guard</a> and <a>Monad</a>
--   <tt>do</tt>-notation:
--   
--   <pre>
--   safeDiv :: Int -&gt; Int -&gt; Maybe Int
--   safeDiv x y = do
--     guard (y /= 0)
--     return (x `div` y)
--   </pre>
guard :: Alternative f => Bool -> f ()

-- | The <a>join</a> function is the conventional monad join operator. It
--   is used to remove one level of monadic structure, projecting its bound
--   argument into the outer level.
--   
--   <h4><b>Examples</b></h4>
--   
--   A common use of <a>join</a> is to run an <a>IO</a> computation
--   returned from an <a>STM</a> transaction, since <a>STM</a> transactions
--   can't perform <a>IO</a> directly. Recall that
--   
--   <pre>
--   <a>atomically</a> :: STM a -&gt; IO a
--   </pre>
--   
--   is used to run <a>STM</a> transactions atomically. So, by specializing
--   the types of <a>atomically</a> and <a>join</a> to
--   
--   <pre>
--   <a>atomically</a> :: STM (IO b) -&gt; IO (IO b)
--   <a>join</a>       :: IO (IO b)  -&gt; IO b
--   </pre>
--   
--   we can compose them as
--   
--   <pre>
--   <a>join</a> . <a>atomically</a> :: STM (IO b) -&gt; IO b
--   </pre>
--   
--   to run an <a>STM</a> transaction and the <a>IO</a> action it returns.
join :: Monad m => m (m a) -> m a

-- | The <a>Bounded</a> class is used to name the upper and lower limits of
--   a type. <a>Ord</a> is not a superclass of <a>Bounded</a> since types
--   that are not totally ordered may also have upper and lower bounds.
--   
--   The <a>Bounded</a> class may be derived for any enumeration type;
--   <a>minBound</a> is the first constructor listed in the <tt>data</tt>
--   declaration and <a>maxBound</a> is the last. <a>Bounded</a> may also
--   be derived for single-constructor datatypes whose constituent types
--   are in <a>Bounded</a>.
class Bounded a
minBound :: Bounded a => a
maxBound :: Bounded a => a

-- | Class <a>Enum</a> defines operations on sequentially ordered types.
--   
--   The <tt>enumFrom</tt>... methods are used in Haskell's translation of
--   arithmetic sequences.
--   
--   Instances of <a>Enum</a> may be derived for any enumeration type
--   (types whose constructors have no fields). The nullary constructors
--   are assumed to be numbered left-to-right by <a>fromEnum</a> from
--   <tt>0</tt> through <tt>n-1</tt>. See Chapter 10 of the <i>Haskell
--   Report</i> for more details.
--   
--   For any type that is an instance of class <a>Bounded</a> as well as
--   <a>Enum</a>, the following should hold:
--   
--   <ul>
--   <li>The calls <tt><a>succ</a> <a>maxBound</a></tt> and <tt><a>pred</a>
--   <a>minBound</a></tt> should result in a runtime error.</li>
--   <li><a>fromEnum</a> and <a>toEnum</a> should give a runtime error if
--   the result value is not representable in the result type. For example,
--   <tt><a>toEnum</a> 7 :: <a>Bool</a></tt> is an error.</li>
--   <li><a>enumFrom</a> and <a>enumFromThen</a> should be defined with an
--   implicit bound, thus:</li>
--   </ul>
--   
--   <pre>
--   enumFrom     x   = enumFromTo     x maxBound
--   enumFromThen x y = enumFromThenTo x y bound
--     where
--       bound | fromEnum y &gt;= fromEnum x = maxBound
--             | otherwise                = minBound
--   </pre>
class Enum a

-- | Convert to an <a>Int</a>. It is implementation-dependent what
--   <a>fromEnum</a> returns when applied to a value that is too large to
--   fit in an <a>Int</a>.
fromEnum :: Enum a => a -> Int

-- | The <a>Eq</a> class defines equality (<a>==</a>) and inequality
--   (<a>/=</a>). All the basic datatypes exported by the <a>Prelude</a>
--   are instances of <a>Eq</a>, and <a>Eq</a> may be derived for any
--   datatype whose constituents are also instances of <a>Eq</a>.
--   
--   The Haskell Report defines no laws for <a>Eq</a>. However, <a>==</a>
--   is customarily expected to implement an equivalence relationship where
--   two values comparing equal are indistinguishable by "public"
--   functions, with a "public" function being one not allowing to see
--   implementation details. For example, for a type representing
--   non-normalised natural numbers modulo 100, a "public" function doesn't
--   make the difference between 1 and 201. It is expected to have the
--   following properties:
--   
--   <ul>
--   <li><i><b>Reflexivity</b></i> <tt>x == x</tt> = <a>True</a></li>
--   <li><i><b>Symmetry</b></i> <tt>x == y</tt> = <tt>y == x</tt></li>
--   <li><i><b>Transitivity</b></i> if <tt>x == y &amp;&amp; y == z</tt> =
--   <a>True</a>, then <tt>x == z</tt> = <a>True</a></li>
--   <li><i><b>Substitutivity</b></i> if <tt>x == y</tt> = <a>True</a> and
--   <tt>f</tt> is a "public" function whose return type is an instance of
--   <a>Eq</a>, then <tt>f x == f y</tt> = <a>True</a></li>
--   <li><i><b>Negation</b></i> <tt>x /= y</tt> = <tt>not (x ==
--   y)</tt></li>
--   </ul>
--   
--   Minimal complete definition: either <a>==</a> or <a>/=</a>.
class Eq a
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
infix 4 ==
infix 4 /=

-- | Trigonometric and hyperbolic functions and related functions.
--   
--   The Haskell Report defines no laws for <a>Floating</a>. However,
--   '(+)', '(*)' and <a>exp</a> are customarily expected to define an
--   exponential field and have the following properties:
--   
--   <ul>
--   <li><tt>exp (a + b)</tt> = @exp a * exp b</li>
--   <li><tt>exp (fromInteger 0)</tt> = <tt>fromInteger 1</tt></li>
--   </ul>
class Fractional a => Floating a
pi :: Floating a => a
exp :: Floating a => a -> a
log :: Floating a => a -> a
sqrt :: Floating a => a -> a
(**) :: Floating a => a -> a -> a
logBase :: Floating a => a -> a -> a
sin :: Floating a => a -> a
cos :: Floating a => a -> a
tan :: Floating a => a -> a
asin :: Floating a => a -> a
acos :: Floating a => a -> a
atan :: Floating a => a -> a
sinh :: Floating a => a -> a
cosh :: Floating a => a -> a
tanh :: Floating a => a -> a
asinh :: Floating a => a -> a
acosh :: Floating a => a -> a
atanh :: Floating a => a -> a
infixr 8 **

-- | Fractional numbers, supporting real division.
--   
--   The Haskell Report defines no laws for <a>Fractional</a>. However,
--   '(+)' and '(*)' are customarily expected to define a division ring and
--   have the following properties:
--   
--   <ul>
--   <li><i><b><a>recip</a> gives the multiplicative inverse</b></i> <tt>x
--   * recip x</tt> = <tt>recip x * x</tt> = <tt>fromInteger 1</tt></li>
--   </ul>
--   
--   Note that it <i>isn't</i> customarily expected that a type instance of
--   <a>Fractional</a> implement a field. However, all instances in
--   <tt>base</tt> do.
class Num a => Fractional a

-- | fractional division
(/) :: Fractional a => a -> a -> a

-- | reciprocal fraction
recip :: Fractional a => a -> a

-- | Conversion from a <a>Rational</a> (that is <tt><a>Ratio</a>
--   <a>Integer</a></tt>). A floating literal stands for an application of
--   <a>fromRational</a> to a value of type <a>Rational</a>, so such
--   literals have type <tt>(<a>Fractional</a> a) =&gt; a</tt>.
fromRational :: Fractional a => Rational -> a
infixl 7 /

-- | Integral numbers, supporting integer division.
--   
--   The Haskell Report defines no laws for <a>Integral</a>. However,
--   <a>Integral</a> instances are customarily expected to define a
--   Euclidean domain and have the following properties for the 'div'/'mod'
--   and 'quot'/'rem' pairs, given suitable Euclidean functions <tt>f</tt>
--   and <tt>g</tt>:
--   
--   <ul>
--   <li><tt>x</tt> = <tt>y * quot x y + rem x y</tt> with <tt>rem x y</tt>
--   = <tt>fromInteger 0</tt> or <tt>g (rem x y)</tt> &lt; <tt>g
--   y</tt></li>
--   <li><tt>x</tt> = <tt>y * div x y + mod x y</tt> with <tt>mod x y</tt>
--   = <tt>fromInteger 0</tt> or <tt>f (mod x y)</tt> &lt; <tt>f
--   y</tt></li>
--   </ul>
--   
--   An example of a suitable Euclidean function, for <a>Integer</a>'s
--   instance, is <a>abs</a>.
class (Real a, Enum a) => Integral a

-- | integer division truncated toward zero
quot :: Integral a => a -> a -> a

-- | integer remainder, satisfying
--   
--   <pre>
--   (x `quot` y)*y + (x `rem` y) == x
--   </pre>
rem :: Integral a => a -> a -> a

-- | integer division truncated toward negative infinity
div :: Integral a => a -> a -> a

-- | integer modulus, satisfying
--   
--   <pre>
--   (x `div` y)*y + (x `mod` y) == x
--   </pre>
mod :: Integral a => a -> a -> a

-- | simultaneous <a>quot</a> and <a>rem</a>
quotRem :: Integral a => a -> a -> (a, a)

-- | simultaneous <a>div</a> and <a>mod</a>
divMod :: Integral a => a -> a -> (a, a)

-- | conversion to <a>Integer</a>
toInteger :: Integral a => a -> Integer
infixl 7 `mod`
infixl 7 `div`
infixl 7 `rem`
infixl 7 `quot`

-- | The <a>Monad</a> class defines the basic operations over a
--   <i>monad</i>, a concept from a branch of mathematics known as
--   <i>category theory</i>. From the perspective of a Haskell programmer,
--   however, it is best to think of a monad as an <i>abstract datatype</i>
--   of actions. Haskell's <tt>do</tt> expressions provide a convenient
--   syntax for writing monadic expressions.
--   
--   Instances of <a>Monad</a> should satisfy the following laws:
--   
--   <ul>
--   <li><pre><a>return</a> a <a>&gt;&gt;=</a> k = k a</pre></li>
--   <li><pre>m <a>&gt;&gt;=</a> <a>return</a> = m</pre></li>
--   <li><pre>m <a>&gt;&gt;=</a> (\x -&gt; k x <a>&gt;&gt;=</a> h) = (m
--   <a>&gt;&gt;=</a> k) <a>&gt;&gt;=</a> h</pre></li>
--   </ul>
--   
--   Furthermore, the <a>Monad</a> and <a>Applicative</a> operations should
--   relate as follows:
--   
--   <ul>
--   <li><pre><a>pure</a> = <a>return</a></pre></li>
--   <li><pre>(<a>&lt;*&gt;</a>) = <a>ap</a></pre></li>
--   </ul>
--   
--   The above laws imply:
--   
--   <ul>
--   <li><pre><a>fmap</a> f xs = xs <a>&gt;&gt;=</a> <a>return</a> .
--   f</pre></li>
--   <li><pre>(<a>&gt;&gt;</a>) = (<a>*&gt;</a>)</pre></li>
--   </ul>
--   
--   and that <a>pure</a> and (<a>&lt;*&gt;</a>) satisfy the applicative
--   functor laws.
--   
--   The instances of <a>Monad</a> for lists, <a>Maybe</a> and <a>IO</a>
--   defined in the <a>Prelude</a> satisfy these laws.
class Applicative m => Monad (m :: Type -> Type)

-- | Sequentially compose two actions, passing any value produced by the
--   first as an argument to the second.
(>>=) :: Monad m => m a -> (a -> m b) -> m b

-- | Sequentially compose two actions, discarding any value produced by the
--   first, like sequencing operators (such as the semicolon) in imperative
--   languages.
(>>) :: Monad m => m a -> m b -> m b

-- | Inject a value into the monadic type.
return :: Monad m => a -> m a

-- | Fail with a message. This operation is not part of the mathematical
--   definition of a monad, but is invoked on pattern-match failure in a
--   <tt>do</tt> expression.
--   
--   As part of the MonadFail proposal (MFP), this function is moved to its
--   own class <tt>MonadFail</tt> (see <a>Control.Monad.Fail</a> for more
--   details). The definition here will be removed in a future release.
fail :: Monad m => String -> m a
infixl 1 >>=
infixl 1 >>

-- | The <a>Data</a> class comprehends a fundamental primitive
--   <a>gfoldl</a> for folding over constructor applications, say terms.
--   This primitive can be instantiated in several ways to map over the
--   immediate subterms of a term; see the <tt>gmap</tt> combinators later
--   in this class. Indeed, a generic programmer does not necessarily need
--   to use the ingenious gfoldl primitive but rather the intuitive
--   <tt>gmap</tt> combinators. The <a>gfoldl</a> primitive is completed by
--   means to query top-level constructors, to turn constructor
--   representations into proper terms, and to list all possible datatype
--   constructors. This completion allows us to serve generic programming
--   scenarios like read, show, equality, term generation.
--   
--   The combinators <a>gmapT</a>, <a>gmapQ</a>, <a>gmapM</a>, etc are all
--   provided with default definitions in terms of <a>gfoldl</a>, leaving
--   open the opportunity to provide datatype-specific definitions. (The
--   inclusion of the <tt>gmap</tt> combinators as members of class
--   <a>Data</a> allows the programmer or the compiler to derive
--   specialised, and maybe more efficient code per datatype. <i>Note</i>:
--   <a>gfoldl</a> is more higher-order than the <tt>gmap</tt> combinators.
--   This is subject to ongoing benchmarking experiments. It might turn out
--   that the <tt>gmap</tt> combinators will be moved out of the class
--   <a>Data</a>.)
--   
--   Conceptually, the definition of the <tt>gmap</tt> combinators in terms
--   of the primitive <a>gfoldl</a> requires the identification of the
--   <a>gfoldl</a> function arguments. Technically, we also need to
--   identify the type constructor <tt>c</tt> for the construction of the
--   result type from the folded term type.
--   
--   In the definition of <tt>gmapQ</tt><i>x</i> combinators, we use
--   phantom type constructors for the <tt>c</tt> in the type of
--   <a>gfoldl</a> because the result type of a query does not involve the
--   (polymorphic) type of the term argument. In the definition of
--   <a>gmapQl</a> we simply use the plain constant type constructor
--   because <a>gfoldl</a> is left-associative anyway and so it is readily
--   suited to fold a left-associative binary operation over the immediate
--   subterms. In the definition of gmapQr, extra effort is needed. We use
--   a higher-order accumulation trick to mediate between left-associative
--   constructor application vs. right-associative binary operation (e.g.,
--   <tt>(:)</tt>). When the query is meant to compute a value of type
--   <tt>r</tt>, then the result type withing generic folding is <tt>r
--   -&gt; r</tt>. So the result of folding is a function to which we
--   finally pass the right unit.
--   
--   With the <tt>-XDeriveDataTypeable</tt> option, GHC can generate
--   instances of the <a>Data</a> class automatically. For example, given
--   the declaration
--   
--   <pre>
--   data T a b = C1 a b | C2 deriving (Typeable, Data)
--   </pre>
--   
--   GHC will generate an instance that is equivalent to
--   
--   <pre>
--   instance (Data a, Data b) =&gt; Data (T a b) where
--       gfoldl k z (C1 a b) = z C1 `k` a `k` b
--       gfoldl k z C2       = z C2
--   
--       gunfold k z c = case constrIndex c of
--                           1 -&gt; k (k (z C1))
--                           2 -&gt; z C2
--   
--       toConstr (C1 _ _) = con_C1
--       toConstr C2       = con_C2
--   
--       dataTypeOf _ = ty_T
--   
--   con_C1 = mkConstr ty_T "C1" [] Prefix
--   con_C2 = mkConstr ty_T "C2" [] Prefix
--   ty_T   = mkDataType "Module.T" [con_C1, con_C2]
--   </pre>
--   
--   This is suitable for datatypes that are exported transparently.
class Typeable a => Data a

-- | Left-associative fold operation for constructor applications.
--   
--   The type of <a>gfoldl</a> is a headache, but operationally it is a
--   simple generalisation of a list fold.
--   
--   The default definition for <a>gfoldl</a> is <tt><a>const</a>
--   <a>id</a></tt>, which is suitable for abstract datatypes with no
--   substructures.
gfoldl :: Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. () => g -> c g) -> a -> c a

-- | Unfolding constructor applications
gunfold :: Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. () => r -> c r) -> Constr -> c a

-- | Obtaining the constructor from a given datum. For proper terms, this
--   is meant to be the top-level constructor. Primitive datatypes are here
--   viewed as potentially infinite sets of values (i.e., constructors).
toConstr :: Data a => a -> Constr

-- | The outer type constructor of the type
dataTypeOf :: Data a => a -> DataType

-- | Mediate types and unary type constructors.
--   
--   In <a>Data</a> instances of the form
--   
--   <pre>
--   instance (Data a, ...) =&gt; Data (T a)
--   </pre>
--   
--   <a>dataCast1</a> should be defined as <a>gcast1</a>.
--   
--   The default definition is <tt><a>const</a> <a>Nothing</a></tt>, which
--   is appropriate for instances of other forms.
dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c a)

-- | Mediate types and binary type constructors.
--   
--   In <a>Data</a> instances of the form
--   
--   <pre>
--   instance (Data a, Data b, ...) =&gt; Data (T a b)
--   </pre>
--   
--   <a>dataCast2</a> should be defined as <a>gcast2</a>.
--   
--   The default definition is <tt><a>const</a> <a>Nothing</a></tt>, which
--   is appropriate for instances of other forms.
dataCast2 :: (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)

-- | A generic transformation that maps over the immediate subterms
--   
--   The default definition instantiates the type constructor <tt>c</tt> in
--   the type of <a>gfoldl</a> to an identity datatype constructor, using
--   the isomorphism pair as injection and projection.
gmapT :: Data a => (forall b. Data b => b -> b) -> a -> a

-- | A generic query with a left-associative binary operator
gmapQl :: Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r

-- | A generic query with a right-associative binary operator
gmapQr :: Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r

-- | A generic query that processes the immediate subterms and returns a
--   list of results. The list is given in the same order as originally
--   specified in the declaration of the data constructors.
gmapQ :: Data a => (forall d. Data d => d -> u) -> a -> [u]

-- | A generic query that processes one child by index (zero-based)
gmapQi :: Data a => Int -> (forall d. Data d => d -> u) -> a -> u

-- | A generic monadic transformation that maps over the immediate subterms
--   
--   The default definition instantiates the type constructor <tt>c</tt> in
--   the type of <a>gfoldl</a> to the monad datatype constructor, defining
--   injection and projection using <a>return</a> and <a>&gt;&gt;=</a>.
gmapM :: (Data a, Monad m) => (forall d. Data d => d -> m d) -> a -> m a

-- | Transformation of at least one immediate subterm does not fail
gmapMp :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a

-- | Transformation of one immediate subterm with success
gmapMo :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a

-- | The <a>Functor</a> class is used for types that can be mapped over.
--   Instances of <a>Functor</a> should satisfy the following laws:
--   
--   <pre>
--   fmap id  ==  id
--   fmap (f . g)  ==  fmap f . fmap g
--   </pre>
--   
--   The instances of <a>Functor</a> for lists, <a>Maybe</a> and <a>IO</a>
--   satisfy these laws.
class Functor (f :: Type -> Type)
fmap :: Functor f => (a -> b) -> f a -> f b

-- | Replace all locations in the input with the same value. The default
--   definition is <tt><a>fmap</a> . <a>const</a></tt>, but this may be
--   overridden with a more efficient version.
(<$) :: Functor f => a -> f b -> f a
infixl 4 <$

-- | Basic numeric class.
--   
--   The Haskell Report defines no laws for <a>Num</a>. However, '(+)' and
--   '(*)' are customarily expected to define a ring and have the following
--   properties:
--   
--   <ul>
--   <li><i><b>Associativity of (+)</b></i> <tt>(x + y) + z</tt> = <tt>x +
--   (y + z)</tt></li>
--   <li><i><b>Commutativity of (+)</b></i> <tt>x + y</tt> = <tt>y +
--   x</tt></li>
--   <li><i><b><tt>fromInteger 0</tt> is the additive identity</b></i>
--   <tt>x + fromInteger 0</tt> = <tt>x</tt></li>
--   <li><i><b><a>negate</a> gives the additive inverse</b></i> <tt>x +
--   negate x</tt> = <tt>fromInteger 0</tt></li>
--   <li><i><b>Associativity of (*)</b></i> <tt>(x * y) * z</tt> = <tt>x *
--   (y * z)</tt></li>
--   <li><i><b><tt>fromInteger 1</tt> is the multiplicative
--   identity</b></i> <tt>x * fromInteger 1</tt> = <tt>x</tt> and
--   <tt>fromInteger 1 * x</tt> = <tt>x</tt></li>
--   <li><i><b>Distributivity of (*) with respect to (+)</b></i> <tt>a * (b
--   + c)</tt> = <tt>(a * b) + (a * c)</tt> and <tt>(b + c) * a</tt> =
--   <tt>(b * a) + (c * a)</tt></li>
--   </ul>
--   
--   Note that it <i>isn't</i> customarily expected that a type instance of
--   both <a>Num</a> and <a>Ord</a> implement an ordered ring. Indeed, in
--   <tt>base</tt> only <a>Integer</a> and <tt>Rational</tt> do.
class Num a
(+) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a

-- | Unary negation.
negate :: Num a => a -> a

-- | Absolute value.
abs :: Num a => a -> a

-- | Sign of a number. The functions <a>abs</a> and <a>signum</a> should
--   satisfy the law:
--   
--   <pre>
--   abs x * signum x == x
--   </pre>
--   
--   For real numbers, the <a>signum</a> is either <tt>-1</tt> (negative),
--   <tt>0</tt> (zero) or <tt>1</tt> (positive).
signum :: Num a => a -> a

-- | Conversion from an <a>Integer</a>. An integer literal represents the
--   application of the function <a>fromInteger</a> to the appropriate
--   value of type <a>Integer</a>, so such literals have type
--   <tt>(<a>Num</a> a) =&gt; a</tt>.
fromInteger :: Num a => Integer -> a
infixl 6 -
infixl 7 *
infixl 6 +

-- | The <a>Ord</a> class is used for totally ordered datatypes.
--   
--   Instances of <a>Ord</a> can be derived for any user-defined datatype
--   whose constituent types are in <a>Ord</a>. The declared order of the
--   constructors in the data declaration determines the ordering in
--   derived <a>Ord</a> instances. The <a>Ordering</a> datatype allows a
--   single comparison to determine the precise ordering of two objects.
--   
--   The Haskell Report defines no laws for <a>Ord</a>. However,
--   <a>&lt;=</a> is customarily expected to implement a non-strict partial
--   order and have the following properties:
--   
--   <ul>
--   <li><i><b>Transitivity</b></i> if <tt>x &lt;= y &amp;&amp; y &lt;=
--   z</tt> = <a>True</a>, then <tt>x &lt;= z</tt> = <a>True</a></li>
--   <li><i><b>Reflexivity</b></i> <tt>x &lt;= x</tt> = <a>True</a></li>
--   <li><i><b>Antisymmetry</b></i> if <tt>x &lt;= y &amp;&amp; y &lt;=
--   x</tt> = <a>True</a>, then <tt>x == y</tt> = <a>True</a></li>
--   </ul>
--   
--   Note that the following operator interactions are expected to hold:
--   
--   <ol>
--   <li><tt>x &gt;= y</tt> = <tt>y &lt;= x</tt></li>
--   <li><tt>x &lt; y</tt> = <tt>x &lt;= y &amp;&amp; x /= y</tt></li>
--   <li><tt>x &gt; y</tt> = <tt>y &lt; x</tt></li>
--   <li><tt>x &lt; y</tt> = <tt>compare x y == LT</tt></li>
--   <li><tt>x &gt; y</tt> = <tt>compare x y == GT</tt></li>
--   <li><tt>x == y</tt> = <tt>compare x y == EQ</tt></li>
--   <li><tt>min x y == if x &lt;= y then x else y</tt> = <a>True</a></li>
--   <li><tt>max x y == if x &gt;= y then x else y</tt> = <a>True</a></li>
--   </ol>
--   
--   Minimal complete definition: either <a>compare</a> or <a>&lt;=</a>.
--   Using <a>compare</a> can be more efficient for complex types.
class Eq a => Ord a
compare :: Ord a => a -> a -> Ordering
(<) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
infix 4 >=
infix 4 <=
infix 4 <
infix 4 >

-- | Parsing of <a>String</a>s, producing values.
--   
--   Derived instances of <a>Read</a> make the following assumptions, which
--   derived instances of <a>Show</a> obey:
--   
--   <ul>
--   <li>If the constructor is defined to be an infix operator, then the
--   derived <a>Read</a> instance will parse only infix applications of the
--   constructor (not the prefix form).</li>
--   <li>Associativity is not used to reduce the occurrence of parentheses,
--   although precedence may be.</li>
--   <li>If the constructor is defined using record syntax, the derived
--   <a>Read</a> will parse only the record-syntax form, and furthermore,
--   the fields must be given in the same order as the original
--   declaration.</li>
--   <li>The derived <a>Read</a> instance allows arbitrary Haskell
--   whitespace between tokens of the input string. Extra parentheses are
--   also allowed.</li>
--   </ul>
--   
--   For example, given the declarations
--   
--   <pre>
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   </pre>
--   
--   the derived instance of <a>Read</a> in Haskell 2010 is equivalent to
--   
--   <pre>
--   instance (Read a) =&gt; Read (Tree a) where
--   
--           readsPrec d r =  readParen (d &gt; app_prec)
--                            (\r -&gt; [(Leaf m,t) |
--                                    ("Leaf",s) &lt;- lex r,
--                                    (m,t) &lt;- readsPrec (app_prec+1) s]) r
--   
--                         ++ readParen (d &gt; up_prec)
--                            (\r -&gt; [(u:^:v,w) |
--                                    (u,s) &lt;- readsPrec (up_prec+1) r,
--                                    (":^:",t) &lt;- lex s,
--                                    (v,w) &lt;- readsPrec (up_prec+1) t]) r
--   
--             where app_prec = 10
--                   up_prec = 5
--   </pre>
--   
--   Note that right-associativity of <tt>:^:</tt> is unused.
--   
--   The derived instance in GHC is equivalent to
--   
--   <pre>
--   instance (Read a) =&gt; Read (Tree a) where
--   
--           readPrec = parens $ (prec app_prec $ do
--                                    Ident "Leaf" &lt;- lexP
--                                    m &lt;- step readPrec
--                                    return (Leaf m))
--   
--                        +++ (prec up_prec $ do
--                                    u &lt;- step readPrec
--                                    Symbol ":^:" &lt;- lexP
--                                    v &lt;- step readPrec
--                                    return (u :^: v))
--   
--             where app_prec = 10
--                   up_prec = 5
--   
--           readListPrec = readListPrecDefault
--   </pre>
--   
--   Why do both <a>readsPrec</a> and <a>readPrec</a> exist, and why does
--   GHC opt to implement <a>readPrec</a> in derived <a>Read</a> instances
--   instead of <a>readsPrec</a>? The reason is that <a>readsPrec</a> is
--   based on the <a>ReadS</a> type, and although <a>ReadS</a> is mentioned
--   in the Haskell 2010 Report, it is not a very efficient parser data
--   structure.
--   
--   <a>readPrec</a>, on the other hand, is based on a much more efficient
--   <a>ReadPrec</a> datatype (a.k.a "new-style parsers"), but its
--   definition relies on the use of the <tt>RankNTypes</tt> language
--   extension. Therefore, <a>readPrec</a> (and its cousin,
--   <a>readListPrec</a>) are marked as GHC-only. Nevertheless, it is
--   recommended to use <a>readPrec</a> instead of <a>readsPrec</a>
--   whenever possible for the efficiency improvements it brings.
--   
--   As mentioned above, derived <a>Read</a> instances in GHC will
--   implement <a>readPrec</a> instead of <a>readsPrec</a>. The default
--   implementations of <a>readsPrec</a> (and its cousin, <a>readList</a>)
--   will simply use <a>readPrec</a> under the hood. If you are writing a
--   <a>Read</a> instance by hand, it is recommended to write it like so:
--   
--   <pre>
--   instance <a>Read</a> T where
--     <a>readPrec</a>     = ...
--     <a>readListPrec</a> = <a>readListPrecDefault</a>
--   </pre>
class Read a
class (Num a, Ord a) => Real a

-- | the rational equivalent of its real argument with full precision
toRational :: Real a => a -> Rational

-- | Efficient, machine-independent access to the components of a
--   floating-point number.
class (RealFrac a, Floating a) => RealFloat a

-- | a constant function, returning the radix of the representation (often
--   <tt>2</tt>)
floatRadix :: RealFloat a => a -> Integer

-- | a constant function, returning the number of digits of
--   <a>floatRadix</a> in the significand
floatDigits :: RealFloat a => a -> Int

-- | a constant function, returning the lowest and highest values the
--   exponent may assume
floatRange :: RealFloat a => a -> (Int, Int)

-- | The function <a>decodeFloat</a> applied to a real floating-point
--   number returns the significand expressed as an <a>Integer</a> and an
--   appropriately scaled exponent (an <a>Int</a>). If
--   <tt><a>decodeFloat</a> x</tt> yields <tt>(m,n)</tt>, then <tt>x</tt>
--   is equal in value to <tt>m*b^^n</tt>, where <tt>b</tt> is the
--   floating-point radix, and furthermore, either <tt>m</tt> and
--   <tt>n</tt> are both zero or else <tt>b^(d-1) &lt;= <a>abs</a> m &lt;
--   b^d</tt>, where <tt>d</tt> is the value of <tt><a>floatDigits</a>
--   x</tt>. In particular, <tt><a>decodeFloat</a> 0 = (0,0)</tt>. If the
--   type contains a negative zero, also <tt><a>decodeFloat</a> (-0.0) =
--   (0,0)</tt>. <i>The result of</i> <tt><a>decodeFloat</a> x</tt> <i>is
--   unspecified if either of</i> <tt><a>isNaN</a> x</tt> <i>or</i>
--   <tt><a>isInfinite</a> x</tt> <i>is</i> <a>True</a>.
decodeFloat :: RealFloat a => a -> (Integer, Int)

-- | <a>encodeFloat</a> performs the inverse of <a>decodeFloat</a> in the
--   sense that for finite <tt>x</tt> with the exception of <tt>-0.0</tt>,
--   <tt><tt>uncurry</tt> <a>encodeFloat</a> (<a>decodeFloat</a> x) =
--   x</tt>. <tt><a>encodeFloat</a> m n</tt> is one of the two closest
--   representable floating-point numbers to <tt>m*b^^n</tt> (or
--   <tt>±Infinity</tt> if overflow occurs); usually the closer, but if
--   <tt>m</tt> contains too many bits, the result may be rounded in the
--   wrong direction.
encodeFloat :: RealFloat a => Integer -> Int -> a

-- | <a>exponent</a> corresponds to the second component of
--   <a>decodeFloat</a>. <tt><a>exponent</a> 0 = 0</tt> and for finite
--   nonzero <tt>x</tt>, <tt><a>exponent</a> x = snd (<a>decodeFloat</a> x)
--   + <a>floatDigits</a> x</tt>. If <tt>x</tt> is a finite floating-point
--   number, it is equal in value to <tt><a>significand</a> x * b ^^
--   <a>exponent</a> x</tt>, where <tt>b</tt> is the floating-point radix.
--   The behaviour is unspecified on infinite or <tt>NaN</tt> values.
exponent :: RealFloat a => a -> Int

-- | The first component of <a>decodeFloat</a>, scaled to lie in the open
--   interval (<tt>-1</tt>,<tt>1</tt>), either <tt>0.0</tt> or of absolute
--   value <tt>&gt;= 1/b</tt>, where <tt>b</tt> is the floating-point
--   radix. The behaviour is unspecified on infinite or <tt>NaN</tt>
--   values.
significand :: RealFloat a => a -> a

-- | multiplies a floating-point number by an integer power of the radix
scaleFloat :: RealFloat a => Int -> a -> a

-- | <a>True</a> if the argument is an IEEE "not-a-number" (NaN) value
isNaN :: RealFloat a => a -> Bool

-- | <a>True</a> if the argument is an IEEE infinity or negative infinity
isInfinite :: RealFloat a => a -> Bool

-- | <a>True</a> if the argument is too small to be represented in
--   normalized format
isDenormalized :: RealFloat a => a -> Bool

-- | <a>True</a> if the argument is an IEEE negative zero
isNegativeZero :: RealFloat a => a -> Bool

-- | <a>True</a> if the argument is an IEEE floating point number
isIEEE :: RealFloat a => a -> Bool

-- | a version of arctangent taking two real floating-point arguments. For
--   real floating <tt>x</tt> and <tt>y</tt>, <tt><a>atan2</a> y x</tt>
--   computes the angle (from the positive x-axis) of the vector from the
--   origin to the point <tt>(x,y)</tt>. <tt><a>atan2</a> y x</tt> returns
--   a value in the range [<tt>-pi</tt>, <tt>pi</tt>]. It follows the
--   Common Lisp semantics for the origin when signed zeroes are supported.
--   <tt><a>atan2</a> y 1</tt>, with <tt>y</tt> in a type that is
--   <a>RealFloat</a>, should return the same value as <tt><a>atan</a>
--   y</tt>. A default definition of <a>atan2</a> is provided, but
--   implementors can provide a more accurate implementation.
atan2 :: RealFloat a => a -> a -> a

-- | Extracting components of fractions.
class (Real a, Fractional a) => RealFrac a

-- | The function <a>properFraction</a> takes a real fractional number
--   <tt>x</tt> and returns a pair <tt>(n,f)</tt> such that <tt>x =
--   n+f</tt>, and:
--   
--   <ul>
--   <li><tt>n</tt> is an integral number with the same sign as <tt>x</tt>;
--   and</li>
--   <li><tt>f</tt> is a fraction with the same type and sign as
--   <tt>x</tt>, and with absolute value less than <tt>1</tt>.</li>
--   </ul>
--   
--   The default definitions of the <a>ceiling</a>, <a>floor</a>,
--   <a>truncate</a> and <a>round</a> functions are in terms of
--   <a>properFraction</a>.
properFraction :: (RealFrac a, Integral b) => a -> (b, a)

-- | <tt><a>truncate</a> x</tt> returns the integer nearest <tt>x</tt>
--   between zero and <tt>x</tt>
truncate :: (RealFrac a, Integral b) => a -> b

-- | <tt><a>round</a> x</tt> returns the nearest integer to <tt>x</tt>; the
--   even integer if <tt>x</tt> is equidistant between two integers
round :: (RealFrac a, Integral b) => a -> b

-- | <tt><a>ceiling</a> x</tt> returns the least integer not less than
--   <tt>x</tt>
ceiling :: (RealFrac a, Integral b) => a -> b

-- | <tt><a>floor</a> x</tt> returns the greatest integer not greater than
--   <tt>x</tt>
floor :: (RealFrac a, Integral b) => a -> b

-- | Conversion of values to readable <a>String</a>s.
--   
--   Derived instances of <a>Show</a> have the following properties, which
--   are compatible with derived instances of <a>Read</a>:
--   
--   <ul>
--   <li>The result of <a>show</a> is a syntactically correct Haskell
--   expression containing only constants, given the fixity declarations in
--   force at the point where the type is declared. It contains only the
--   constructor names defined in the data type, parentheses, and spaces.
--   When labelled constructor fields are used, braces, commas, field
--   names, and equal signs are also used.</li>
--   <li>If the constructor is defined to be an infix operator, then
--   <a>showsPrec</a> will produce infix applications of the
--   constructor.</li>
--   <li>the representation will be enclosed in parentheses if the
--   precedence of the top-level constructor in <tt>x</tt> is less than
--   <tt>d</tt> (associativity is ignored). Thus, if <tt>d</tt> is
--   <tt>0</tt> then the result is never surrounded in parentheses; if
--   <tt>d</tt> is <tt>11</tt> it is always surrounded in parentheses,
--   unless it is an atomic expression.</li>
--   <li>If the constructor is defined using record syntax, then
--   <a>show</a> will produce the record-syntax form, with the fields given
--   in the same order as the original declaration.</li>
--   </ul>
--   
--   For example, given the declarations
--   
--   <pre>
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   </pre>
--   
--   the derived instance of <a>Show</a> is equivalent to
--   
--   <pre>
--   instance (Show a) =&gt; Show (Tree a) where
--   
--          showsPrec d (Leaf m) = showParen (d &gt; app_prec) $
--               showString "Leaf " . showsPrec (app_prec+1) m
--            where app_prec = 10
--   
--          showsPrec d (u :^: v) = showParen (d &gt; up_prec) $
--               showsPrec (up_prec+1) u .
--               showString " :^: "      .
--               showsPrec (up_prec+1) v
--            where up_prec = 5
--   </pre>
--   
--   Note that right-associativity of <tt>:^:</tt> is ignored. For example,
--   
--   <ul>
--   <li><tt><a>show</a> (Leaf 1 :^: Leaf 2 :^: Leaf 3)</tt> produces the
--   string <tt>"Leaf 1 :^: (Leaf 2 :^: Leaf 3)"</tt>.</li>
--   </ul>
class Show a

-- | A specialised variant of <a>showsPrec</a>, using precedence context
--   zero, and returning an ordinary <a>String</a>.
show :: Show a => a -> String

-- | The class <a>Typeable</a> allows a concrete representation of a type
--   to be calculated.
class Typeable (a :: k)

-- | Class for string-like datastructures; used by the overloaded string
--   extension (-XOverloadedStrings in GHC).
class IsString a
fromString :: IsString a => String -> a

-- | A functor with application, providing operations to
--   
--   <ul>
--   <li>embed pure expressions (<a>pure</a>), and</li>
--   <li>sequence computations and combine their results (<a>&lt;*&gt;</a>
--   and <a>liftA2</a>).</li>
--   </ul>
--   
--   A minimal complete definition must include implementations of
--   <a>pure</a> and of either <a>&lt;*&gt;</a> or <a>liftA2</a>. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   <pre>
--   (<a>&lt;*&gt;</a>) = <a>liftA2</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>liftA2</a> f x y = f <tt>&lt;$&gt;</tt> x <a>&lt;*&gt;</a> y
--   </pre>
--   
--   Further, any definition must satisfy the following:
--   
--   <ul>
--   <li><i><i>identity</i></i> <pre><a>pure</a> <a>id</a> <a>&lt;*&gt;</a>
--   v = v</pre></li>
--   <li><i><i>composition</i></i> <pre><a>pure</a> (.) <a>&lt;*&gt;</a> u
--   <a>&lt;*&gt;</a> v <a>&lt;*&gt;</a> w = u <a>&lt;*&gt;</a> (v
--   <a>&lt;*&gt;</a> w)</pre></li>
--   <li><i><i>homomorphism</i></i> <pre><a>pure</a> f <a>&lt;*&gt;</a>
--   <a>pure</a> x = <a>pure</a> (f x)</pre></li>
--   <li><i><i>interchange</i></i> <pre>u <a>&lt;*&gt;</a> <a>pure</a> y =
--   <a>pure</a> (<a>$</a> y) <a>&lt;*&gt;</a> u</pre></li>
--   </ul>
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   <ul>
--   <li><pre>u <a>*&gt;</a> v = (<a>id</a> <a>&lt;$</a> u)
--   <a>&lt;*&gt;</a> v</pre></li>
--   <li><pre>u <a>&lt;*</a> v = <a>liftA2</a> <a>const</a> u v</pre></li>
--   </ul>
--   
--   As a consequence of these laws, the <a>Functor</a> instance for
--   <tt>f</tt> will satisfy
--   
--   <ul>
--   <li><pre><a>fmap</a> f x = <a>pure</a> f <a>&lt;*&gt;</a> x</pre></li>
--   </ul>
--   
--   It may be useful to note that supposing
--   
--   <pre>
--   forall x y. p (q x y) = f x . g y
--   </pre>
--   
--   it follows from the above that
--   
--   <pre>
--   <a>liftA2</a> p (<a>liftA2</a> q u v) = <a>liftA2</a> f u . <a>liftA2</a> g v
--   </pre>
--   
--   If <tt>f</tt> is also a <a>Monad</a>, it should satisfy
--   
--   <ul>
--   <li><pre><a>pure</a> = <a>return</a></pre></li>
--   <li><pre>(<a>&lt;*&gt;</a>) = <a>ap</a></pre></li>
--   <li><pre>(<a>*&gt;</a>) = (<a>&gt;&gt;</a>)</pre></li>
--   </ul>
--   
--   (which implies that <a>pure</a> and <a>&lt;*&gt;</a> satisfy the
--   applicative functor laws).
class Functor f => Applicative (f :: Type -> Type)

-- | Lift a value.
pure :: Applicative f => a -> f a

-- | Sequential application.
--   
--   A few functors support an implementation of <a>&lt;*&gt;</a> that is
--   more efficient than the default one.
(<*>) :: Applicative f => f (a -> b) -> f a -> f b

-- | Lift a binary function to actions.
--   
--   Some functors support an implementation of <a>liftA2</a> that is more
--   efficient than the default one. In particular, if <a>fmap</a> is an
--   expensive operation, it is likely better to use <a>liftA2</a> than to
--   <a>fmap</a> over the structure and then use <a>&lt;*&gt;</a>.
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c

-- | Sequence actions, discarding the value of the first argument.
(*>) :: Applicative f => f a -> f b -> f b

-- | Sequence actions, discarding the value of the second argument.
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*>
infixl 4 *>
infixl 4 <*

-- | Data structures that can be folded.
--   
--   For example, given a data type
--   
--   <pre>
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   </pre>
--   
--   a suitable instance would be
--   
--   <pre>
--   instance Foldable Tree where
--      foldMap f Empty = mempty
--      foldMap f (Leaf x) = f x
--      foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r
--   </pre>
--   
--   This is suitable even for abstract types, as the monoid is assumed to
--   satisfy the monoid laws. Alternatively, one could define
--   <tt>foldr</tt>:
--   
--   <pre>
--   instance Foldable Tree where
--      foldr f z Empty = z
--      foldr f z (Leaf x) = f x z
--      foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l
--   </pre>
--   
--   <tt>Foldable</tt> instances are expected to satisfy the following
--   laws:
--   
--   <pre>
--   foldr f z t = appEndo (foldMap (Endo . f) t ) z
--   </pre>
--   
--   <pre>
--   foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
--   </pre>
--   
--   <pre>
--   fold = foldMap id
--   </pre>
--   
--   <pre>
--   length = getSum . foldMap (Sum . const  1)
--   </pre>
--   
--   <tt>sum</tt>, <tt>product</tt>, <tt>maximum</tt>, and <tt>minimum</tt>
--   should all be essentially equivalent to <tt>foldMap</tt> forms, such
--   as
--   
--   <pre>
--   sum = getSum . foldMap Sum
--   </pre>
--   
--   but may be less defined.
--   
--   If the type is also a <a>Functor</a> instance, it should satisfy
--   
--   <pre>
--   foldMap f = fold . fmap f
--   </pre>
--   
--   which implies that
--   
--   <pre>
--   foldMap f . fmap g = foldMap (f . g)
--   </pre>
class Foldable (t :: Type -> Type)

-- | Combine the elements of a structure using a monoid.
fold :: (Foldable t, Monoid m) => t m -> m

-- | Map each element of the structure to a monoid, and combine the
--   results.
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m

-- | Right-associative fold of a structure.
--   
--   In the case of lists, <a>foldr</a>, when applied to a binary operator,
--   a starting value (typically the right-identity of the operator), and a
--   list, reduces the list using the binary operator, from right to left:
--   
--   <pre>
--   foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)
--   </pre>
--   
--   Note that, since the head of the resulting expression is produced by
--   an application of the operator to the first element of the list,
--   <a>foldr</a> can produce a terminating expression from an infinite
--   list.
--   
--   For a general <a>Foldable</a> structure this should be semantically
--   identical to,
--   
--   <pre>
--   foldr f z = <a>foldr</a> f z . <a>toList</a>
--   </pre>
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b

-- | Left-associative fold of a structure but with strict application of
--   the operator.
--   
--   This ensures that each step of the fold is forced to weak head normal
--   form before being applied, avoiding the collection of thunks that
--   would otherwise occur. This is often what you want to strictly reduce
--   a finite list to a single, monolithic result (e.g. <a>length</a>).
--   
--   For a general <a>Foldable</a> structure this should be semantically
--   identical to,
--   
--   <pre>
--   foldl f z = <a>foldl'</a> f z . <a>toList</a>
--   </pre>
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b

-- | List of elements of a structure, from left to right.
toList :: Foldable t => t a -> [a]

-- | Test whether the structure is empty. The default implementation is
--   optimized for structures that are similar to cons-lists, because there
--   is no general way to do better.
null :: Foldable t => t a -> Bool

-- | Returns the size/length of a finite structure as an <a>Int</a>. The
--   default implementation is optimized for structures that are similar to
--   cons-lists, because there is no general way to do better.
length :: Foldable t => t a -> Int

-- | Does the element occur in the structure?
elem :: (Foldable t, Eq a) => a -> t a -> Bool

-- | The <a>sum</a> function computes the sum of the numbers of a
--   structure.
sum :: (Foldable t, Num a) => t a -> a

-- | The <a>product</a> function computes the product of the numbers of a
--   structure.
product :: (Foldable t, Num a) => t a -> a
infix 4 `elem`

-- | Functors representing data structures that can be traversed from left
--   to right.
--   
--   A definition of <a>traverse</a> must satisfy the following laws:
--   
--   <ul>
--   <li><i><i>naturality</i></i> <tt>t . <a>traverse</a> f =
--   <a>traverse</a> (t . f)</tt> for every applicative transformation
--   <tt>t</tt></li>
--   <li><i><i>identity</i></i> <tt><a>traverse</a> Identity =
--   Identity</tt></li>
--   <li><i><i>composition</i></i> <tt><a>traverse</a> (Compose .
--   <a>fmap</a> g . f) = Compose . <a>fmap</a> (<a>traverse</a> g) .
--   <a>traverse</a> f</tt></li>
--   </ul>
--   
--   A definition of <a>sequenceA</a> must satisfy the following laws:
--   
--   <ul>
--   <li><i><i>naturality</i></i> <tt>t . <a>sequenceA</a> =
--   <a>sequenceA</a> . <a>fmap</a> t</tt> for every applicative
--   transformation <tt>t</tt></li>
--   <li><i><i>identity</i></i> <tt><a>sequenceA</a> . <a>fmap</a> Identity
--   = Identity</tt></li>
--   <li><i><i>composition</i></i> <tt><a>sequenceA</a> . <a>fmap</a>
--   Compose = Compose . <a>fmap</a> <a>sequenceA</a> .
--   <a>sequenceA</a></tt></li>
--   </ul>
--   
--   where an <i>applicative transformation</i> is a function
--   
--   <pre>
--   t :: (Applicative f, Applicative g) =&gt; f a -&gt; g a
--   </pre>
--   
--   preserving the <a>Applicative</a> operations, i.e.
--   
--   <ul>
--   <li><pre>t (<a>pure</a> x) = <a>pure</a> x</pre></li>
--   <li><pre>t (x <a>&lt;*&gt;</a> y) = t x <a>&lt;*&gt;</a> t
--   y</pre></li>
--   </ul>
--   
--   and the identity functor <tt>Identity</tt> and composition of functors
--   <tt>Compose</tt> are defined as
--   
--   <pre>
--   newtype Identity a = Identity a
--   
--   instance Functor Identity where
--     fmap f (Identity x) = Identity (f x)
--   
--   instance Applicative Identity where
--     pure x = Identity x
--     Identity f &lt;*&gt; Identity x = Identity (f x)
--   
--   newtype Compose f g a = Compose (f (g a))
--   
--   instance (Functor f, Functor g) =&gt; Functor (Compose f g) where
--     fmap f (Compose x) = Compose (fmap (fmap f) x)
--   
--   instance (Applicative f, Applicative g) =&gt; Applicative (Compose f g) where
--     pure x = Compose (pure (pure x))
--     Compose f &lt;*&gt; Compose x = Compose ((&lt;*&gt;) &lt;$&gt; f &lt;*&gt; x)
--   </pre>
--   
--   (The naturality law is implied by parametricity.)
--   
--   Instances are similar to <a>Functor</a>, e.g. given a data type
--   
--   <pre>
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   </pre>
--   
--   a suitable instance would be
--   
--   <pre>
--   instance Traversable Tree where
--      traverse f Empty = pure Empty
--      traverse f (Leaf x) = Leaf &lt;$&gt; f x
--      traverse f (Node l k r) = Node &lt;$&gt; traverse f l &lt;*&gt; f k &lt;*&gt; traverse f r
--   </pre>
--   
--   This is suitable even for abstract types, as the laws for
--   <a>&lt;*&gt;</a> imply a form of associativity.
--   
--   The superclass instances should satisfy the following:
--   
--   <ul>
--   <li>In the <a>Functor</a> instance, <a>fmap</a> should be equivalent
--   to traversal with the identity applicative functor
--   (<a>fmapDefault</a>).</li>
--   <li>In the <a>Foldable</a> instance, <a>foldMap</a> should be
--   equivalent to traversal with a constant applicative functor
--   (<a>foldMapDefault</a>).</li>
--   </ul>
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)

-- | Map each element of a structure to an action, evaluate these actions
--   from left to right, and collect the results. For a version that
--   ignores the results see <a>traverse_</a>.
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)

-- | Evaluate each action in the structure from left to right, and collect
--   the results. For a version that ignores the results see
--   <a>sequenceA_</a>.
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)

-- | Map each element of a structure to a monadic action, evaluate these
--   actions from left to right, and collect the results. For a version
--   that ignores the results see <a>mapM_</a>.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)

-- | Evaluate each monadic action in the structure from left to right, and
--   collect the results. For a version that ignores the results see
--   <a>sequence_</a>.
sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)

-- | Representable types of kind <tt>*</tt>. This class is derivable in GHC
--   with the <tt>DeriveGeneric</tt> flag on.
--   
--   A <a>Generic</a> instance must satisfy the following laws:
--   
--   <pre>
--   <a>from</a> . <a>to</a> ≡ <tt>id</tt>
--   <a>to</a> . <a>from</a> ≡ <tt>id</tt>
--   </pre>
class Generic a

-- | The class of semigroups (types with an associative binary operation).
--   
--   Instances should satisfy the associativity law:
--   
--   <ul>
--   <li><pre>x <a>&lt;&gt;</a> (y <a>&lt;&gt;</a> z) = (x <a>&lt;&gt;</a>
--   y) <a>&lt;&gt;</a> z</pre></li>
--   </ul>
class Semigroup a

-- | An associative operation.
(<>) :: Semigroup a => a -> a -> a

-- | Reduce a non-empty list with <tt>&lt;&gt;</tt>
--   
--   The default definition should be sufficient, but this can be
--   overridden for efficiency.
sconcat :: Semigroup a => NonEmpty a -> a

-- | Repeat a value <tt>n</tt> times.
--   
--   Given that this works on a <a>Semigroup</a> it is allowed to fail if
--   you request 0 or fewer repetitions, and the default definition will do
--   so.
--   
--   By making this a member of the class, idempotent semigroups and
--   monoids can upgrade this to execute in <i>O(1)</i> by picking
--   <tt>stimes = <tt>stimesIdempotent</tt></tt> or <tt>stimes =
--   <a>stimesIdempotentMonoid</a></tt> respectively.
stimes :: (Semigroup a, Integral b) => b -> a -> a
infixr 6 <>

-- | The class of monoids (types with an associative binary operation that
--   has an identity). Instances should satisfy the following laws:
--   
--   <ul>
--   <li><pre>x <a>&lt;&gt;</a> <a>mempty</a> = x</pre></li>
--   <li><pre><a>mempty</a> <a>&lt;&gt;</a> x = x</pre></li>
--   <li><tt>x <a>&lt;&gt;</a> (y <a>&lt;&gt;</a> z) = (x <a>&lt;&gt;</a>
--   y) <a>&lt;&gt;</a> z</tt> (<a>Semigroup</a> law)</li>
--   <li><pre><a>mconcat</a> = <a>foldr</a> '(&lt;&gt;)'
--   <a>mempty</a></pre></li>
--   </ul>
--   
--   The method names refer to the monoid of lists under concatenation, but
--   there are many other instances.
--   
--   Some types can be viewed as a monoid in more than one way, e.g. both
--   addition and multiplication on numbers. In such cases we often define
--   <tt>newtype</tt>s and make those instances of <a>Monoid</a>, e.g.
--   <tt>Sum</tt> and <tt>Product</tt>.
--   
--   <b>NOTE</b>: <a>Semigroup</a> is a superclass of <a>Monoid</a> since
--   <i>base-4.11.0.0</i>.
class Semigroup a => Monoid a

-- | Identity of <a>mappend</a>
mempty :: Monoid a => a

-- | An associative operation
--   
--   <b>NOTE</b>: This method is redundant and has the default
--   implementation <tt><a>mappend</a> = '(&lt;&gt;)'</tt> since
--   <i>base-4.11.0.0</i>.
mappend :: Monoid a => a -> a -> a

-- | Fold a list using the monoid.
--   
--   For most types, the default definition for <a>mconcat</a> will be
--   used, but the function is included in the class definition so that an
--   optimized version can be provided for specific types.
mconcat :: Monoid a => [a] -> a
data Bool
False :: Bool
True :: Bool

-- | The character type <a>Char</a> is an enumeration whose values
--   represent Unicode (or equivalently ISO/IEC 10646) code points (i.e.
--   characters, see <a>http://www.unicode.org/</a> for details). This set
--   extends the ISO 8859-1 (Latin-1) character set (the first 256
--   characters), which is itself an extension of the ASCII character set
--   (the first 128 characters). A character literal in Haskell has type
--   <a>Char</a>.
--   
--   To convert a <a>Char</a> to or from the corresponding <a>Int</a> value
--   defined by Unicode, use <a>toEnum</a> and <a>fromEnum</a> from the
--   <a>Enum</a> class respectively (or equivalently <tt>ord</tt> and
--   <tt>chr</tt>).
data Char

-- | Double-precision floating point numbers. It is desirable that this
--   type be at least equal in range and precision to the IEEE
--   double-precision type.
data Double

-- | Single-precision floating point numbers. It is desirable that this
--   type be at least equal in range and precision to the IEEE
--   single-precision type.
data Float

-- | A fixed-precision integer type with at least the range <tt>[-2^29 ..
--   2^29-1]</tt>. The exact range for a given implementation can be
--   determined by using <a>minBound</a> and <a>maxBound</a> from the
--   <a>Bounded</a> class.
data Int

-- | 8-bit signed integer type
data Int8

-- | 16-bit signed integer type
data Int16

-- | 32-bit signed integer type
data Int32

-- | 64-bit signed integer type
data Int64

-- | Invariant: <a>Jn#</a> and <a>Jp#</a> are used iff value doesn't fit in
--   <a>S#</a>
--   
--   Useful properties resulting from the invariants:
--   
--   <ul>
--   <li><pre>abs (<a>S#</a> _) &lt;= abs (<a>Jp#</a> _)</pre></li>
--   <li><pre>abs (<a>S#</a> _) &lt; abs (<a>Jn#</a> _)</pre></li>
--   </ul>
data Integer

-- | Type representing arbitrary-precision non-negative integers.
--   
--   <pre>
--   &gt;&gt;&gt; 2^100 :: Natural
--   1267650600228229401496703205376
--   </pre>
--   
--   Operations whose result would be negative <tt><tt>throw</tt>
--   (<tt>Underflow</tt> :: <tt>ArithException</tt>)</tt>,
--   
--   <pre>
--   &gt;&gt;&gt; -1 :: Natural
--   *** Exception: arithmetic underflow
--   </pre>
data Natural

-- | The <a>Maybe</a> type encapsulates an optional value. A value of type
--   <tt><a>Maybe</a> a</tt> either contains a value of type <tt>a</tt>
--   (represented as <tt><a>Just</a> a</tt>), or it is empty (represented
--   as <a>Nothing</a>). Using <a>Maybe</a> is a good way to deal with
--   errors or exceptional cases without resorting to drastic measures such
--   as <tt>error</tt>.
--   
--   The <a>Maybe</a> type is also a monad. It is a simple kind of error
--   monad, where all errors are represented by <a>Nothing</a>. A richer
--   error monad can be built using the <a>Either</a> type.
data Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
data Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering

-- | Arbitrary-precision rational numbers, represented as a ratio of two
--   <a>Integer</a> values. A rational number may be constructed using the
--   <a>%</a> operator.
type Rational = Ratio Integer

-- | A value of type <tt><a>IO</a> a</tt> is a computation which, when
--   performed, does some I/O before returning a value of type <tt>a</tt>.
--   
--   There is really only one way to "perform" an I/O action: bind it to
--   <tt>Main.main</tt> in your program. When your program is run, the I/O
--   will be performed. It isn't possible to perform I/O from an arbitrary
--   function, unless that function is itself in the <a>IO</a> monad and
--   called at some point, directly or indirectly, from <tt>Main.main</tt>.
--   
--   <a>IO</a> is a monad, so <a>IO</a> actions can be combined using
--   either the do-notation or the <tt>&gt;&gt;</tt> and <tt>&gt;&gt;=</tt>
--   operations from the <tt>Monad</tt> class.
data IO a

-- | A <a>Word</a> is an unsigned integral type, with the same size as
--   <a>Int</a>.
data Word

-- | 8-bit unsigned integer type
data Word8

-- | 16-bit unsigned integer type
data Word16

-- | 32-bit unsigned integer type
data Word32

-- | 64-bit unsigned integer type
data Word64

-- | The <a>Either</a> type represents values with two possibilities: a
--   value of type <tt><a>Either</a> a b</tt> is either <tt><a>Left</a>
--   a</tt> or <tt><a>Right</a> b</tt>.
--   
--   The <a>Either</a> type is sometimes used to represent a value which is
--   either correct or an error; by convention, the <a>Left</a> constructor
--   is used to hold an error value and the <a>Right</a> constructor is
--   used to hold a correct value (mnemonic: "right" also means "correct").
--   
--   <h4><b>Examples</b></h4>
--   
--   The type <tt><a>Either</a> <a>String</a> <a>Int</a></tt> is the type
--   of values which can be either a <a>String</a> or an <a>Int</a>. The
--   <a>Left</a> constructor can be used only on <a>String</a>s, and the
--   <a>Right</a> constructor can be used only on <a>Int</a>s:
--   
--   <pre>
--   &gt;&gt;&gt; let s = Left "foo" :: Either String Int
--   
--   &gt;&gt;&gt; s
--   Left "foo"
--   
--   &gt;&gt;&gt; let n = Right 3 :: Either String Int
--   
--   &gt;&gt;&gt; n
--   Right 3
--   
--   &gt;&gt;&gt; :type s
--   s :: Either String Int
--   
--   &gt;&gt;&gt; :type n
--   n :: Either String Int
--   </pre>
--   
--   The <a>fmap</a> from our <a>Functor</a> instance will ignore
--   <a>Left</a> values, but will apply the supplied function to values
--   contained in a <a>Right</a>:
--   
--   <pre>
--   &gt;&gt;&gt; let s = Left "foo" :: Either String Int
--   
--   &gt;&gt;&gt; let n = Right 3 :: Either String Int
--   
--   &gt;&gt;&gt; fmap (*2) s
--   Left "foo"
--   
--   &gt;&gt;&gt; fmap (*2) n
--   Right 6
--   </pre>
--   
--   The <a>Monad</a> instance for <a>Either</a> allows us to chain
--   together multiple actions which may fail, and fail overall if any of
--   the individual steps failed. First we'll write a function that can
--   either parse an <a>Int</a> from a <a>Char</a>, or fail.
--   
--   <pre>
--   &gt;&gt;&gt; import Data.Char ( digitToInt, isDigit )
--   
--   &gt;&gt;&gt; :{
--       let parseEither :: Char -&gt; Either String Int
--           parseEither c
--             | isDigit c = Right (digitToInt c)
--             | otherwise = Left "parse error"
--   
--   &gt;&gt;&gt; :}
--   </pre>
--   
--   The following should work, since both <tt>'1'</tt> and <tt>'2'</tt>
--   can be parsed as <a>Int</a>s.
--   
--   <pre>
--   &gt;&gt;&gt; :{
--       let parseMultiple :: Either String Int
--           parseMultiple = do
--             x &lt;- parseEither '1'
--             y &lt;- parseEither '2'
--             return (x + y)
--   
--   &gt;&gt;&gt; :}
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parseMultiple
--   Right 3
--   </pre>
--   
--   But the following should fail overall, since the first operation where
--   we attempt to parse <tt>'m'</tt> as an <a>Int</a> will fail:
--   
--   <pre>
--   &gt;&gt;&gt; :{
--       let parseMultiple :: Either String Int
--           parseMultiple = do
--             x &lt;- parseEither 'm'
--             y &lt;- parseEither '2'
--             return (x + y)
--   
--   &gt;&gt;&gt; :}
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; parseMultiple
--   Left "parse error"
--   </pre>
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b

-- | <a>CallStack</a>s are a lightweight method of obtaining a partial
--   call-stack at any point in the program.
--   
--   A function can request its call-site with the <a>HasCallStack</a>
--   constraint. For example, we can define
--   
--   <pre>
--   putStrLnWithCallStack :: HasCallStack =&gt; String -&gt; IO ()
--   </pre>
--   
--   as a variant of <tt>putStrLn</tt> that will get its call-site and
--   print it, along with the string given as argument. We can access the
--   call-stack inside <tt>putStrLnWithCallStack</tt> with
--   <a>callStack</a>.
--   
--   <pre>
--   putStrLnWithCallStack :: HasCallStack =&gt; String -&gt; IO ()
--   putStrLnWithCallStack msg = do
--     putStrLn msg
--     putStrLn (prettyCallStack callStack)
--   </pre>
--   
--   Thus, if we call <tt>putStrLnWithCallStack</tt> we will get a
--   formatted call-stack alongside our string.
--   
--   <pre>
--   &gt;&gt;&gt; putStrLnWithCallStack "hello"
--   hello
--   CallStack (from HasCallStack):
--     putStrLnWithCallStack, called at &lt;interactive&gt;:2:1 in interactive:Ghci1
--   </pre>
--   
--   GHC solves <a>HasCallStack</a> constraints in three steps:
--   
--   <ol>
--   <li>If there is a <a>CallStack</a> in scope -- i.e. the enclosing
--   function has a <a>HasCallStack</a> constraint -- GHC will append the
--   new call-site to the existing <a>CallStack</a>.</li>
--   <li>If there is no <a>CallStack</a> in scope -- e.g. in the GHCi
--   session above -- and the enclosing definition does not have an
--   explicit type signature, GHC will infer a <a>HasCallStack</a>
--   constraint for the enclosing definition (subject to the monomorphism
--   restriction).</li>
--   <li>If there is no <a>CallStack</a> in scope and the enclosing
--   definition has an explicit type signature, GHC will solve the
--   <a>HasCallStack</a> constraint for the singleton <a>CallStack</a>
--   containing just the current call-site.</li>
--   </ol>
--   
--   <a>CallStack</a>s do not interact with the RTS and do not require
--   compilation with <tt>-prof</tt>. On the other hand, as they are built
--   up explicitly via the <a>HasCallStack</a> constraints, they will
--   generally not contain as much information as the simulated call-stacks
--   maintained by the RTS.
--   
--   A <a>CallStack</a> is a <tt>[(String, SrcLoc)]</tt>. The
--   <tt>String</tt> is the name of function that was called, the
--   <a>SrcLoc</a> is the call-site. The list is ordered with the most
--   recently called function at the head.
--   
--   NOTE: The intrepid user may notice that <a>HasCallStack</a> is just an
--   alias for an implicit parameter <tt>?callStack :: CallStack</tt>. This
--   is an implementation detail and <b>should not</b> be considered part
--   of the <a>CallStack</a> API, we may decide to change the
--   implementation in the future.
data CallStack

-- | A compact representation of a <a>Word8</a> vector.
--   
--   It has a lower memory overhead than a <a>ByteString</a> and and does
--   not contribute to heap fragmentation. It can be converted to or from a
--   <a>ByteString</a> (at the cost of copying the string data). It
--   supports very few other operations.
--   
--   It is suitable for use as an internal representation for code that
--   needs to keep many short strings in memory, but it <i>should not</i>
--   be used as an interchange type. That is, it should not generally be
--   used in public APIs. The <a>ByteString</a> type is usually more
--   suitable for use in interfaces; it is more flexible and it supports a
--   wide range of operations.
data ShortByteString

-- | A space-efficient representation of a <a>Word8</a> vector, supporting
--   many efficient operations.
--   
--   A <a>ByteString</a> contains 8-bit bytes, or by using the operations
--   from <a>Data.ByteString.Char8</a> it can be interpreted as containing
--   8-bit characters.
data ByteString

-- | Swap bytes in <a>Word16</a>.
byteSwap16 :: Word16 -> Word16

-- | Reverse order of bytes in <a>Word32</a>.
byteSwap32 :: Word32 -> Word32

-- | Reverse order of bytes in <a>Word64</a>.
byteSwap64 :: Word64 -> Word64

-- | A class of types that can be fully evaluated.
class NFData a

-- | <a>rnf</a> should reduce its argument to normal form (that is, fully
--   evaluate all sub-components), and then return '()'.
--   
--   <h3><a>Generic</a> <a>NFData</a> deriving</h3>
--   
--   Starting with GHC 7.2, you can automatically derive instances for
--   types possessing a <a>Generic</a> instance.
--   
--   Note: <a>Generic1</a> can be auto-derived starting with GHC 7.4
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics (Generic, Generic1)
--   import Control.DeepSeq
--   
--   data Foo a = Foo a String
--                deriving (Eq, Generic, Generic1)
--   
--   instance NFData a =&gt; NFData (Foo a)
--   instance NFData1 Foo
--   
--   data Colour = Red | Green | Blue
--                 deriving Generic
--   
--   instance NFData Colour
--   </pre>
--   
--   Starting with GHC 7.10, the example above can be written more
--   concisely by enabling the new <tt>DeriveAnyClass</tt> extension:
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric, DeriveAnyClass #-}
--   
--   import GHC.Generics (Generic)
--   import Control.DeepSeq
--   
--   data Foo a = Foo a String
--                deriving (Eq, Generic, Generic1, NFData, NFData1)
--   
--   data Colour = Red | Green | Blue
--                 deriving (Generic, NFData)
--   </pre>
--   
--   <h3>Compatibility with previous <tt>deepseq</tt> versions</h3>
--   
--   Prior to version 1.4.0.0, the default implementation of the <a>rnf</a>
--   method was defined as
--   
--   <pre>
--   <a>rnf</a> a = <a>seq</a> a ()
--   </pre>
--   
--   However, starting with <tt>deepseq-1.4.0.0</tt>, the default
--   implementation is based on <tt>DefaultSignatures</tt> allowing for
--   more accurate auto-derived <a>NFData</a> instances. If you need the
--   previously used exact default <a>rnf</a> method implementation
--   semantics, use
--   
--   <pre>
--   instance NFData Colour where rnf x = seq x ()
--   </pre>
--   
--   or alternatively
--   
--   <pre>
--   instance NFData Colour where rnf = rwhnf
--   </pre>
--   
--   or
--   
--   <pre>
--   {-# LANGUAGE BangPatterns #-}
--   instance NFData Colour where rnf !_ = ()
--   </pre>
rnf :: NFData a => a -> ()

-- | A Map from keys <tt>k</tt> to values <tt>a</tt>.
data Map k a

-- | Boolean "not"
not :: Bool -> Bool

-- | Boolean "or"
(||) :: Bool -> Bool -> Bool
infixr 2 ||

-- | Boolean "and"
(&&) :: Bool -> Bool -> Bool
infixr 3 &&

-- | <a>error</a> stops execution and displays an error message.
error :: HasCallStack => [Char] -> a

-- | A special case of <a>error</a>. It is expected that compilers will
--   recognize this and insert error messages which are more appropriate to
--   the context in which <a>undefined</a> appears.
undefined :: HasCallStack => a

-- | A <a>String</a> is a list of characters. String constants in Haskell
--   are values of type <a>String</a>.
type String = [Char]

-- | Monads that also support choice and failure.
class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)

-- | The identity of <a>mplus</a>. It should also satisfy the equations
--   
--   <pre>
--   mzero &gt;&gt;= f  =  mzero
--   v &gt;&gt; mzero   =  mzero
--   </pre>
--   
--   The default definition is
--   
--   <pre>
--   mzero = <a>empty</a>
--   </pre>
mzero :: MonadPlus m => m a

-- | An associative operation. The default definition is
--   
--   <pre>
--   mplus = (<a>&lt;|&gt;</a>)
--   </pre>
mplus :: MonadPlus m => m a -> m a -> m a

-- | A monoid on applicative functors.
--   
--   If defined, <a>some</a> and <a>many</a> should be the least solutions
--   of the equations:
--   
--   <ul>
--   <li><pre><a>some</a> v = (:) <tt>&lt;$&gt;</tt> v <a>&lt;*&gt;</a>
--   <a>many</a> v</pre></li>
--   <li><pre><a>many</a> v = <a>some</a> v <a>&lt;|&gt;</a> <a>pure</a>
--   []</pre></li>
--   </ul>
class Applicative f => Alternative (f :: Type -> Type)

-- | An associative binary operation
(<|>) :: Alternative f => f a -> f a -> f a

-- | One or more.
some :: Alternative f => f a -> f [a]

-- | Zero or more.
many :: Alternative f => f a -> f [a]
infixl 3 <|>

-- | Same as <a>&gt;&gt;=</a>, but with the arguments interchanged.
(=<<) :: Monad m => (a -> m b) -> m a -> m b
infixr 1 =<<

-- | Conditional execution of <a>Applicative</a> expressions. For example,
--   
--   <pre>
--   when debug (putStrLn "Debugging")
--   </pre>
--   
--   will output the string <tt>Debugging</tt> if the Boolean value
--   <tt>debug</tt> is <a>True</a>, and otherwise do nothing.
when :: Applicative f => Bool -> f () -> f ()

-- | Promote a function to a monad.
liftM :: Monad m => (a1 -> r) -> m a1 -> m r

-- | Promote a function to a monad, scanning the monadic arguments from
--   left to right. For example,
--   
--   <pre>
--   liftM2 (+) [0,1] [0,2] = [0,2,1,3]
--   liftM2 (+) (Just 1) Nothing = Nothing
--   </pre>
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r

-- | Identity function.
--   
--   <pre>
--   id x = x
--   </pre>
id :: () => a -> a

-- | <tt>const x</tt> is a unary function which evaluates to <tt>x</tt> for
--   all inputs.
--   
--   <pre>
--   &gt;&gt;&gt; const 42 "hello"
--   42
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; map (const 42) [0..3]
--   [42,42,42,42]
--   </pre>
const :: () => a -> b -> a

-- | Function composition.
(.) :: () => (b -> c) -> (a -> b) -> a -> c
infixr 9 .

-- | <tt><a>flip</a> f</tt> takes its (first) two arguments in the reverse
--   order of <tt>f</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; flip (++) "hello" "world"
--   "worldhello"
--   </pre>
flip :: () => (a -> b -> c) -> b -> a -> c

-- | Strict (call-by-value) application operator. It takes a function and
--   an argument, evaluates the argument to weak head normal form (WHNF),
--   then calls the function with that value.
($!) :: () => (a -> b) -> a -> b
infixr 0 $!

-- | <a>asTypeOf</a> is a type-restricted version of <a>const</a>. It is
--   usually used as an infix operator, and its typing forces its first
--   argument (which is usually overloaded) to have the same type as the
--   second.
asTypeOf :: () => a -> a -> a

-- | the same as <tt><a>flip</a> (<a>-</a>)</tt>.
--   
--   Because <tt>-</tt> is treated specially in the Haskell grammar,
--   <tt>(-</tt> <i>e</i><tt>)</tt> is not a section, but an application of
--   prefix negation. However, <tt>(<a>subtract</a></tt>
--   <i>exp</i><tt>)</tt> is equivalent to the disallowed section.
subtract :: Num a => a -> a -> a

-- | <a>curry</a> converts an uncurried function to a curried function.
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; curry fst 1 2
--   1
--   </pre>
curry :: () => ((a, b) -> c) -> a -> b -> c

-- | <a>uncurry</a> converts a curried function to a function on pairs.
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; uncurry (+) (1,2)
--   3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; uncurry ($) (show, 1)
--   "1"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; map (uncurry max) [(1,2), (3,4), (6,8)]
--   [2,4,8]
--   </pre>
uncurry :: () => (a -> b -> c) -> (a, b) -> c

-- | The <a>maybe</a> function takes a default value, a function, and a
--   <a>Maybe</a> value. If the <a>Maybe</a> value is <a>Nothing</a>, the
--   function returns the default value. Otherwise, it applies the function
--   to the value inside the <a>Just</a> and returns the result.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; maybe False odd (Just 3)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; maybe False odd Nothing
--   False
--   </pre>
--   
--   Read an integer from a string using <tt>readMaybe</tt>. If we succeed,
--   return twice the integer; that is, apply <tt>(*2)</tt> to it. If
--   instead we fail to parse an integer, return <tt>0</tt> by default:
--   
--   <pre>
--   &gt;&gt;&gt; import Text.Read ( readMaybe )
--   
--   &gt;&gt;&gt; maybe 0 (*2) (readMaybe "5")
--   10
--   
--   &gt;&gt;&gt; maybe 0 (*2) (readMaybe "")
--   0
--   </pre>
--   
--   Apply <tt>show</tt> to a <tt>Maybe Int</tt>. If we have <tt>Just
--   n</tt>, we want to show the underlying <a>Int</a> <tt>n</tt>. But if
--   we have <a>Nothing</a>, we return the empty string instead of (for
--   example) "Nothing":
--   
--   <pre>
--   &gt;&gt;&gt; maybe "" show (Just 5)
--   "5"
--   
--   &gt;&gt;&gt; maybe "" show Nothing
--   ""
--   </pre>
maybe :: () => b -> (a -> b) -> Maybe a -> b

-- | The <a>isJust</a> function returns <a>True</a> iff its argument is of
--   the form <tt>Just _</tt>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; isJust (Just 3)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isJust (Just ())
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isJust Nothing
--   False
--   </pre>
--   
--   Only the outer constructor is taken into consideration:
--   
--   <pre>
--   &gt;&gt;&gt; isJust (Just Nothing)
--   True
--   </pre>
isJust :: () => Maybe a -> Bool

-- | The <a>isNothing</a> function returns <a>True</a> iff its argument is
--   <a>Nothing</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; isNothing (Just 3)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isNothing (Just ())
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; isNothing Nothing
--   True
--   </pre>
--   
--   Only the outer constructor is taken into consideration:
--   
--   <pre>
--   &gt;&gt;&gt; isNothing (Just Nothing)
--   False
--   </pre>
isNothing :: () => Maybe a -> Bool

-- | The <a>fromMaybe</a> function takes a default value and and
--   <a>Maybe</a> value. If the <a>Maybe</a> is <a>Nothing</a>, it returns
--   the default values; otherwise, it returns the value contained in the
--   <a>Maybe</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; fromMaybe "" (Just "Hello, World!")
--   "Hello, World!"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromMaybe "" Nothing
--   ""
--   </pre>
--   
--   Read an integer from a string using <tt>readMaybe</tt>. If we fail to
--   parse an integer, we want to return <tt>0</tt> by default:
--   
--   <pre>
--   &gt;&gt;&gt; import Text.Read ( readMaybe )
--   
--   &gt;&gt;&gt; fromMaybe 0 (readMaybe "5")
--   5
--   
--   &gt;&gt;&gt; fromMaybe 0 (readMaybe "")
--   0
--   </pre>
fromMaybe :: () => a -> Maybe a -> a

-- | The <a>maybeToList</a> function returns an empty list when given
--   <a>Nothing</a> or a singleton list when not given <a>Nothing</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; maybeToList (Just 7)
--   [7]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; maybeToList Nothing
--   []
--   </pre>
--   
--   One can use <a>maybeToList</a> to avoid pattern matching when combined
--   with a function that (safely) works on lists:
--   
--   <pre>
--   &gt;&gt;&gt; import Text.Read ( readMaybe )
--   
--   &gt;&gt;&gt; sum $ maybeToList (readMaybe "3")
--   3
--   
--   &gt;&gt;&gt; sum $ maybeToList (readMaybe "")
--   0
--   </pre>
maybeToList :: () => Maybe a -> [a]

-- | The <a>listToMaybe</a> function returns <a>Nothing</a> on an empty
--   list or <tt><a>Just</a> a</tt> where <tt>a</tt> is the first element
--   of the list.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; listToMaybe []
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; listToMaybe [9]
--   Just 9
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; listToMaybe [1,2,3]
--   Just 1
--   </pre>
--   
--   Composing <a>maybeToList</a> with <a>listToMaybe</a> should be the
--   identity on singleton/empty lists:
--   
--   <pre>
--   &gt;&gt;&gt; maybeToList $ listToMaybe [5]
--   [5]
--   
--   &gt;&gt;&gt; maybeToList $ listToMaybe []
--   []
--   </pre>
--   
--   But not on lists with more than one element:
--   
--   <pre>
--   &gt;&gt;&gt; maybeToList $ listToMaybe [1,2,3]
--   [1]
--   </pre>
listToMaybe :: () => [a] -> Maybe a

-- | The <a>catMaybes</a> function takes a list of <a>Maybe</a>s and
--   returns a list of all the <a>Just</a> values.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; catMaybes [Just 1, Nothing, Just 3]
--   [1,3]
--   </pre>
--   
--   When constructing a list of <a>Maybe</a> values, <a>catMaybes</a> can
--   be used to return all of the "success" results (if the list is the
--   result of a <a>map</a>, then <a>mapMaybe</a> would be more
--   appropriate):
--   
--   <pre>
--   &gt;&gt;&gt; import Text.Read ( readMaybe )
--   
--   &gt;&gt;&gt; [readMaybe x :: Maybe Int | x &lt;- ["1", "Foo", "3"] ]
--   [Just 1,Nothing,Just 3]
--   
--   &gt;&gt;&gt; catMaybes $ [readMaybe x :: Maybe Int | x &lt;- ["1", "Foo", "3"] ]
--   [1,3]
--   </pre>
catMaybes :: () => [Maybe a] -> [a]

-- | The <a>mapMaybe</a> function is a version of <a>map</a> which can
--   throw out elements. In particular, the functional argument returns
--   something of type <tt><a>Maybe</a> b</tt>. If this is <a>Nothing</a>,
--   no element is added on to the result list. If it is <tt><a>Just</a>
--   b</tt>, then <tt>b</tt> is included in the result list.
--   
--   <h4><b>Examples</b></h4>
--   
--   Using <tt><a>mapMaybe</a> f x</tt> is a shortcut for
--   <tt><a>catMaybes</a> $ <a>map</a> f x</tt> in most cases:
--   
--   <pre>
--   &gt;&gt;&gt; import Text.Read ( readMaybe )
--   
--   &gt;&gt;&gt; let readMaybeInt = readMaybe :: String -&gt; Maybe Int
--   
--   &gt;&gt;&gt; mapMaybe readMaybeInt ["1", "Foo", "3"]
--   [1,3]
--   
--   &gt;&gt;&gt; catMaybes $ map readMaybeInt ["1", "Foo", "3"]
--   [1,3]
--   </pre>
--   
--   If we map the <a>Just</a> constructor, the entire list should be
--   returned:
--   
--   <pre>
--   &gt;&gt;&gt; mapMaybe Just [1,2,3]
--   [1,2,3]
--   </pre>
mapMaybe :: () => (a -> Maybe b) -> [a] -> [b]

-- | <a>replicate</a> <tt>n x</tt> is a list of length <tt>n</tt> with
--   <tt>x</tt> the value of every element. It is an instance of the more
--   general <a>genericReplicate</a>, in which <tt>n</tt> may be of any
--   integral type.
replicate :: () => Int -> a -> [a]

-- | <a>takeWhile</a>, applied to a predicate <tt>p</tt> and a list
--   <tt>xs</tt>, returns the longest prefix (possibly empty) of
--   <tt>xs</tt> of elements that satisfy <tt>p</tt>:
--   
--   <pre>
--   takeWhile (&lt; 3) [1,2,3,4,1,2,3,4] == [1,2]
--   takeWhile (&lt; 9) [1,2,3] == [1,2,3]
--   takeWhile (&lt; 0) [1,2,3] == []
--   </pre>
takeWhile :: () => (a -> Bool) -> [a] -> [a]

-- | <a>dropWhile</a> <tt>p xs</tt> returns the suffix remaining after
--   <a>takeWhile</a> <tt>p xs</tt>:
--   
--   <pre>
--   dropWhile (&lt; 3) [1,2,3,4,5,1,2,3] == [3,4,5,1,2,3]
--   dropWhile (&lt; 9) [1,2,3] == []
--   dropWhile (&lt; 0) [1,2,3] == [1,2,3]
--   </pre>
dropWhile :: () => (a -> Bool) -> [a] -> [a]

-- | <a>take</a> <tt>n</tt>, applied to a list <tt>xs</tt>, returns the
--   prefix of <tt>xs</tt> of length <tt>n</tt>, or <tt>xs</tt> itself if
--   <tt>n &gt; <a>length</a> xs</tt>:
--   
--   <pre>
--   take 5 "Hello World!" == "Hello"
--   take 3 [1,2,3,4,5] == [1,2,3]
--   take 3 [1,2] == [1,2]
--   take 3 [] == []
--   take (-1) [1,2] == []
--   take 0 [1,2] == []
--   </pre>
--   
--   It is an instance of the more general <a>genericTake</a>, in which
--   <tt>n</tt> may be of any integral type.
take :: () => Int -> [a] -> [a]

-- | <a>drop</a> <tt>n xs</tt> returns the suffix of <tt>xs</tt> after the
--   first <tt>n</tt> elements, or <tt>[]</tt> if <tt>n &gt; <a>length</a>
--   xs</tt>:
--   
--   <pre>
--   drop 6 "Hello World!" == "World!"
--   drop 3 [1,2,3,4,5] == [4,5]
--   drop 3 [1,2] == []
--   drop 3 [] == []
--   drop (-1) [1,2] == [1,2]
--   drop 0 [1,2] == [1,2]
--   </pre>
--   
--   It is an instance of the more general <a>genericDrop</a>, in which
--   <tt>n</tt> may be of any integral type.
drop :: () => Int -> [a] -> [a]

-- | <a>span</a>, applied to a predicate <tt>p</tt> and a list <tt>xs</tt>,
--   returns a tuple where first element is longest prefix (possibly empty)
--   of <tt>xs</tt> of elements that satisfy <tt>p</tt> and second element
--   is the remainder of the list:
--   
--   <pre>
--   span (&lt; 3) [1,2,3,4,1,2,3,4] == ([1,2],[3,4,1,2,3,4])
--   span (&lt; 9) [1,2,3] == ([1,2,3],[])
--   span (&lt; 0) [1,2,3] == ([],[1,2,3])
--   </pre>
--   
--   <a>span</a> <tt>p xs</tt> is equivalent to <tt>(<a>takeWhile</a> p xs,
--   <a>dropWhile</a> p xs)</tt>
span :: () => (a -> Bool) -> [a] -> ([a], [a])

-- | <a>break</a>, applied to a predicate <tt>p</tt> and a list
--   <tt>xs</tt>, returns a tuple where first element is longest prefix
--   (possibly empty) of <tt>xs</tt> of elements that <i>do not satisfy</i>
--   <tt>p</tt> and second element is the remainder of the list:
--   
--   <pre>
--   break (&gt; 3) [1,2,3,4,1,2,3,4] == ([1,2,3],[4,1,2,3,4])
--   break (&lt; 9) [1,2,3] == ([],[1,2,3])
--   break (&gt; 9) [1,2,3] == ([1,2,3],[])
--   </pre>
--   
--   <a>break</a> <tt>p</tt> is equivalent to <tt><a>span</a> (<a>not</a> .
--   p)</tt>.
break :: () => (a -> Bool) -> [a] -> ([a], [a])

-- | <a>reverse</a> <tt>xs</tt> returns the elements of <tt>xs</tt> in
--   reverse order. <tt>xs</tt> must be finite.
reverse :: () => [a] -> [a]

-- | <a>lookup</a> <tt>key assocs</tt> looks up a key in an association
--   list.
lookup :: Eq a => a -> [(a, b)] -> Maybe b
even :: Integral a => a -> Bool
odd :: Integral a => a -> Bool

-- | raise a number to a non-negative integral power
(^) :: (Num a, Integral b) => a -> b -> a
infixr 8 ^

-- | raise a number to an integral power
(^^) :: (Fractional a, Integral b) => a -> b -> a
infixr 8 ^^

-- | <tt><a>gcd</a> x y</tt> is the non-negative factor of both <tt>x</tt>
--   and <tt>y</tt> of which every common factor of <tt>x</tt> and
--   <tt>y</tt> is also a factor; for example <tt><a>gcd</a> 4 2 = 2</tt>,
--   <tt><a>gcd</a> (-4) 6 = 2</tt>, <tt><a>gcd</a> 0 4</tt> = <tt>4</tt>.
--   <tt><a>gcd</a> 0 0</tt> = <tt>0</tt>. (That is, the common divisor
--   that is "greatest" in the divisibility preordering.)
--   
--   Note: Since for signed fixed-width integer types, <tt><a>abs</a>
--   <a>minBound</a> &lt; 0</tt>, the result may be negative if one of the
--   arguments is <tt><a>minBound</a></tt> (and necessarily is if the other
--   is <tt>0</tt> or <tt><a>minBound</a></tt>) for such types.
gcd :: Integral a => a -> a -> a

-- | <tt><a>lcm</a> x y</tt> is the smallest positive integer that both
--   <tt>x</tt> and <tt>y</tt> divide.
lcm :: Integral a => a -> a -> a

-- | An infix synonym for <a>fmap</a>.
--   
--   The name of this operator is an allusion to <tt>$</tt>. Note the
--   similarities between their types:
--   
--   <pre>
--    ($)  ::              (a -&gt; b) -&gt;   a -&gt;   b
--   (&lt;$&gt;) :: Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
--   </pre>
--   
--   Whereas <tt>$</tt> is function application, <a>&lt;$&gt;</a> is
--   function application lifted over a <a>Functor</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Convert from a <tt><tt>Maybe</tt> <tt>Int</tt></tt> to a
--   <tt><tt>Maybe</tt> <tt>String</tt></tt> using <tt>show</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; show &lt;$&gt; Nothing
--   Nothing
--   
--   &gt;&gt;&gt; show &lt;$&gt; Just 3
--   Just "3"
--   </pre>
--   
--   Convert from an <tt><tt>Either</tt> <tt>Int</tt> <tt>Int</tt></tt> to
--   an <tt><tt>Either</tt> <tt>Int</tt></tt> <tt>String</tt> using
--   <tt>show</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; show &lt;$&gt; Left 17
--   Left 17
--   
--   &gt;&gt;&gt; show &lt;$&gt; Right 17
--   Right "17"
--   </pre>
--   
--   Double each element of a list:
--   
--   <pre>
--   &gt;&gt;&gt; (*2) &lt;$&gt; [1,2,3]
--   [2,4,6]
--   </pre>
--   
--   Apply <tt>even</tt> to the second element of a pair:
--   
--   <pre>
--   &gt;&gt;&gt; even &lt;$&gt; (2,2)
--   (2,True)
--   </pre>
(<$>) :: Functor f => (a -> b) -> f a -> f b
infixl 4 <$>

-- | <tt><a>void</a> value</tt> discards or ignores the result of
--   evaluation, such as the return value of an <a>IO</a> action.
--   
--   <h4><b>Examples</b></h4>
--   
--   Replace the contents of a <tt><tt>Maybe</tt> <tt>Int</tt></tt> with
--   unit:
--   
--   <pre>
--   &gt;&gt;&gt; void Nothing
--   Nothing
--   
--   &gt;&gt;&gt; void (Just 3)
--   Just ()
--   </pre>
--   
--   Replace the contents of an <tt><tt>Either</tt> <tt>Int</tt>
--   <tt>Int</tt></tt> with unit, resulting in an <tt><tt>Either</tt>
--   <tt>Int</tt> '()'</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; void (Left 8675309)
--   Left 8675309
--   
--   &gt;&gt;&gt; void (Right 8675309)
--   Right ()
--   </pre>
--   
--   Replace every element of a list with unit:
--   
--   <pre>
--   &gt;&gt;&gt; void [1,2,3]
--   [(),(),()]
--   </pre>
--   
--   Replace the second element of a pair with unit:
--   
--   <pre>
--   &gt;&gt;&gt; void (1,2)
--   (1,())
--   </pre>
--   
--   Discard the result of an <a>IO</a> action:
--   
--   <pre>
--   &gt;&gt;&gt; mapM print [1,2]
--   1
--   2
--   [(),()]
--   
--   &gt;&gt;&gt; void $ mapM print [1,2]
--   1
--   2
--   </pre>
void :: Functor f => f a -> f ()

-- | <pre>
--   comparing p x y = compare (p x) (p y)
--   </pre>
--   
--   Useful combinator for use in conjunction with the <tt>xxxBy</tt>
--   family of functions from <a>Data.List</a>, for example:
--   
--   <pre>
--   ... sortBy (comparing fst) ...
--   </pre>
comparing :: Ord a => (b -> a) -> b -> b -> Ordering

-- | Case analysis for the <a>Either</a> type. If the value is
--   <tt><a>Left</a> a</tt>, apply the first function to <tt>a</tt>; if it
--   is <tt><a>Right</a> b</tt>, apply the second function to <tt>b</tt>.
--   
--   <h4><b>Examples</b></h4>
--   
--   We create two values of type <tt><a>Either</a> <a>String</a>
--   <a>Int</a></tt>, one using the <a>Left</a> constructor and another
--   using the <a>Right</a> constructor. Then we apply "either" the
--   <tt>length</tt> function (if we have a <a>String</a>) or the
--   "times-two" function (if we have an <a>Int</a>):
--   
--   <pre>
--   &gt;&gt;&gt; let s = Left "foo" :: Either String Int
--   
--   &gt;&gt;&gt; let n = Right 3 :: Either String Int
--   
--   &gt;&gt;&gt; either length (*2) s
--   3
--   
--   &gt;&gt;&gt; either length (*2) n
--   6
--   </pre>
either :: () => (a -> c) -> (b -> c) -> Either a b -> c

-- | <a>lines</a> breaks a string up into a list of strings at newline
--   characters. The resulting strings do not contain newlines.
--   
--   Note that after splitting the string at newline characters, the last
--   part of the string is considered a line even if it doesn't end with a
--   newline. For example,
--   
--   <pre>
--   &gt;&gt;&gt; lines ""
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lines "\n"
--   [""]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lines "one"
--   ["one"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lines "one\n"
--   ["one"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lines "one\n\n"
--   ["one",""]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lines "one\ntwo"
--   ["one","two"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lines "one\ntwo\n"
--   ["one","two"]
--   </pre>
--   
--   Thus <tt><a>lines</a> s</tt> contains at least as many elements as
--   newlines in <tt>s</tt>.
lines :: String -> [String]

-- | <a>unlines</a> is an inverse operation to <a>lines</a>. It joins
--   lines, after appending a terminating newline to each.
--   
--   <pre>
--   &gt;&gt;&gt; unlines ["Hello", "World", "!"]
--   "Hello\nWorld\n!\n"
--   </pre>
unlines :: [String] -> String

-- | <a>words</a> breaks a string up into a list of words, which were
--   delimited by white space.
--   
--   <pre>
--   &gt;&gt;&gt; words "Lorem ipsum\ndolor"
--   ["Lorem","ipsum","dolor"]
--   </pre>
words :: String -> [String]

-- | <a>unwords</a> is an inverse operation to <a>words</a>. It joins words
--   with separating spaces.
--   
--   <pre>
--   &gt;&gt;&gt; unwords ["Lorem", "ipsum", "dolor"]
--   "Lorem ipsum dolor"
--   </pre>
unwords :: [String] -> String

-- | Boolean monoid under disjunction (<a>||</a>).
--   
--   <pre>
--   &gt;&gt;&gt; getAny (Any True &lt;&gt; mempty &lt;&gt; Any False)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getAny (mconcat (map (\x -&gt; Any (even x)) [2,4,6,7,8]))
--   True
--   </pre>
newtype Any
Any :: Bool -> Any
[getAny] :: Any -> Bool

-- | Map each element of a structure to an action, evaluate these actions
--   from left to right, and ignore the results. For a version that doesn't
--   ignore the results see <a>traverse</a>.
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()

-- | <a>for_</a> is <a>traverse_</a> with its arguments flipped. For a
--   version that doesn't ignore the results see <a>for</a>.
--   
--   <pre>
--   &gt;&gt;&gt; for_ [1..4] print
--   1
--   2
--   3
--   4
--   </pre>
for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()

-- | Evaluate each monadic action in the structure from left to right, and
--   ignore the results. For a version that doesn't ignore the results see
--   <a>sequence</a>.
--   
--   As of base 4.8.0.0, <a>sequence_</a> is just <a>sequenceA_</a>,
--   specialized to <a>Monad</a>.
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()

-- | The concatenation of all the elements of a container of lists.
concat :: Foldable t => t [a] -> [a]

-- | Map a function over all the elements of a container and concatenate
--   the resulting lists.
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]

-- | <a>and</a> returns the conjunction of a container of Bools. For the
--   result to be <a>True</a>, the container must be finite; <a>False</a>,
--   however, results from a <a>False</a> value finitely far from the left
--   end.
and :: Foldable t => t Bool -> Bool

-- | <a>or</a> returns the disjunction of a container of Bools. For the
--   result to be <a>False</a>, the container must be finite; <a>True</a>,
--   however, results from a <a>True</a> value finitely far from the left
--   end.
or :: Foldable t => t Bool -> Bool

-- | Determines whether any element of the structure satisfies the
--   predicate.
any :: Foldable t => (a -> Bool) -> t a -> Bool

-- | Determines whether all elements of the structure satisfy the
--   predicate.
all :: Foldable t => (a -> Bool) -> t a -> Bool

-- | <a>notElem</a> is the negation of <a>elem</a>.
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
infix 4 `notElem`

-- | File and directory names are values of type <a>String</a>, whose
--   precise meaning is operating system dependent. Files can be opened,
--   yielding a handle which can then be used to operate on the contents of
--   that file.
type FilePath = String

-- | One or none.
optional :: Alternative f => f a -> f (Maybe a)

-- | <a>for</a> is <a>traverse</a> with its arguments flipped. For a
--   version that ignores the results see <a>for_</a>.
for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)

-- | This generalizes the list-based <tt>filter</tt> function.
filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]

-- | The <a>foldM</a> function is analogous to <tt>foldl</tt>, except that
--   its result is encapsulated in a monad. Note that <a>foldM</a> works
--   from left-to-right over the list arguments. This could be an issue
--   where <tt>(<a>&gt;&gt;</a>)</tt> and the `folded function' are not
--   commutative.
--   
--   <pre>
--   foldM f a1 [x1, x2, ..., xm]
--   
--   ==
--   
--   do
--     a2 &lt;- f a1 x1
--     a3 &lt;- f a2 x2
--     ...
--     f am xm
--   </pre>
--   
--   If right-to-left evaluation is required, the input list should be
--   reversed.
--   
--   Note: <a>foldM</a> is the same as <a>foldlM</a>
foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b

-- | The reverse of <a>when</a>.
unless :: Applicative f => Bool -> f () -> f ()

-- | <a>Builder</a>s denote sequences of bytes. They are <a>Monoid</a>s
--   where <a>mempty</a> is the zero-length sequence and <a>mappend</a> is
--   concatenation, which runs in <i>O(1)</i>.
data Builder

-- | The class of types that can be converted to a hash value.
--   
--   Minimal implementation: <a>hashWithSalt</a>.
class Hashable a

-- | A space efficient, packed, unboxed Unicode text type.
data Text

-- | A map from keys to values. A map cannot contain duplicate keys; each
--   key can map to at most one value.
data HashMap k v

-- | A class for monads in which exceptions may be thrown.
--   
--   Instances should obey the following law:
--   
--   <pre>
--   throwM e &gt;&gt; x = throwM e
--   </pre>
--   
--   In other words, throwing an exception short-circuits the rest of the
--   monadic computation.
class Monad m => MonadThrow (m :: Type -> Type)

-- | Throw an exception. Note that this throws when this action is run in
--   the monad <tt>m</tt>, not when it is applied. It is a generalization
--   of <a>Control.Exception</a>'s <a>throwIO</a>.
--   
--   Should satisfy the law:
--   
--   <pre>
--   throwM e &gt;&gt; f = throwM e
--   </pre>
throwM :: (MonadThrow m, Exception e) => e -> m a

-- | Haskell defines operations to read and write characters from and to
--   files, represented by values of type <tt>Handle</tt>. Each value of
--   this type is a <i>handle</i>: a record used by the Haskell run-time
--   system to <i>manage</i> I/O with file system objects. A handle has at
--   least the following properties:
--   
--   <ul>
--   <li>whether it manages input or output or both;</li>
--   <li>whether it is <i>open</i>, <i>closed</i> or
--   <i>semi-closed</i>;</li>
--   <li>whether the object is seekable;</li>
--   <li>whether buffering is disabled, or enabled on a line or block
--   basis;</li>
--   <li>a buffer (whose length may be zero).</li>
--   </ul>
--   
--   Most handles will also have a current I/O position indicating where
--   the next input or output operation will occur. A handle is
--   <i>readable</i> if it manages only input or both input and output;
--   likewise, it is <i>writable</i> if it manages only output or both
--   input and output. A handle is <i>open</i> when first allocated. Once
--   it is closed it can no longer be used for either input or output,
--   though an implementation cannot re-use its storage while references
--   remain to it. Handles are in the <a>Show</a> and <a>Eq</a> classes.
--   The string produced by showing a handle is system dependent; it should
--   include enough information to identify the handle for debugging. A
--   handle is equal according to <a>==</a> only to itself; no attempt is
--   made to compare the internal state of different handles for equality.
data Handle

-- | A <a>ThreadId</a> is an abstract type representing a handle to a
--   thread. <a>ThreadId</a> is an instance of <a>Eq</a>, <a>Ord</a> and
--   <a>Show</a>, where the <a>Ord</a> instance implements an arbitrary
--   total ordering over <a>ThreadId</a>s. The <a>Show</a> instance lets
--   you convert an arbitrary-valued <a>ThreadId</a> to string form;
--   showing a <a>ThreadId</a> value is occasionally useful when debugging
--   or diagnosing the behaviour of a concurrent program.
--   
--   <i>Note</i>: in GHC, if you have a <a>ThreadId</a>, you essentially
--   have a pointer to the thread itself. This means the thread itself
--   can't be garbage collected until you drop the <a>ThreadId</a>. This
--   misfeature will hopefully be corrected at a later date.
data ThreadId

-- | A version of <a>waitBoth</a> that can be used inside an STM
--   transaction.
waitBothSTM :: () => Async a -> Async b -> STM (a, b)

-- | A version of <a>waitEither_</a> that can be used inside an STM
--   transaction.
waitEitherSTM_ :: () => Async a -> Async b -> STM ()

-- | A version of <a>waitEither</a> that can be used inside an STM
--   transaction.
waitEitherSTM :: () => Async a -> Async b -> STM (Either a b)

-- | A version of <a>waitEitherCatch</a> that can be used inside an STM
--   transaction.
waitEitherCatchSTM :: () => Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b))

-- | A version of <a>waitAny</a> that can be used inside an STM
--   transaction.
waitAnySTM :: () => [Async a] -> STM (Async a, a)

-- | A version of <a>waitAnyCatch</a> that can be used inside an STM
--   transaction.
waitAnyCatchSTM :: () => [Async a] -> STM (Async a, Either SomeException a)

-- | A version of <a>poll</a> that can be used inside an STM transaction.
pollSTM :: () => Async a -> STM (Maybe (Either SomeException a))

-- | A version of <a>waitCatch</a> that can be used inside an STM
--   transaction.
waitCatchSTM :: () => Async a -> STM (Either SomeException a)

-- | A version of <a>wait</a> that can be used inside an STM transaction.
waitSTM :: () => Async a -> STM a

-- | An asynchronous action spawned by <a>async</a> or <a>withAsync</a>.
--   Asynchronous actions are executed in a separate thread, and operations
--   are provided for waiting for asynchronous actions to complete and
--   obtaining their results (see e.g. <a>wait</a>).
data Async a

-- | Since <a>Void</a> values logically don't exist, this witnesses the
--   logical reasoning tool of "ex falso quodlibet".
--   
--   <pre>
--   &gt;&gt;&gt; let x :: Either Void Int; x = Right 5
--   
--   &gt;&gt;&gt; :{
--   case x of
--       Right r -&gt; r
--       Left l  -&gt; absurd l
--   :}
--   5
--   </pre>
absurd :: () => Void -> a

-- | Uninhabited data type
data Void

-- | <a>Chan</a> is an abstract type representing an unbounded FIFO
--   channel.
data Chan a

-- | Monads in which <a>IO</a> computations may be embedded. Any monad
--   built by applying a sequence of monad transformers to the <a>IO</a>
--   monad will be an instance of this class.
--   
--   Instances should satisfy the following laws, which state that
--   <a>liftIO</a> is a transformer of monads:
--   
--   <ul>
--   <li><pre><a>liftIO</a> . <a>return</a> = <a>return</a></pre></li>
--   <li><pre><a>liftIO</a> (m &gt;&gt;= f) = <a>liftIO</a> m &gt;&gt;=
--   (<a>liftIO</a> . f)</pre></li>
--   </ul>
class Monad m => MonadIO (m :: Type -> Type)

-- | Lift a computation from the <a>IO</a> monad.
liftIO :: MonadIO m => IO a -> m a

-- | Strict version of <a>&lt;$&gt;</a>.
(<$!>) :: Monad m => (a -> b) -> m a -> m b
infixl 4 <$!>

-- | Like <a>replicateM</a>, but discards the result.
replicateM_ :: Applicative m => Int -> m a -> m ()

-- | Like <a>foldM</a>, but discards the result.
foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m ()

-- | <a>zipWithM_</a> is the extension of <a>zipWithM</a> which ignores the
--   final result.
zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m ()

-- | The <a>zipWithM</a> function generalizes <a>zipWith</a> to arbitrary
--   applicative functors.
zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]

-- | Repeat an action indefinitely.
--   
--   <h4><b>Examples</b></h4>
--   
--   A common use of <a>forever</a> is to process input from network
--   sockets, <a>Handle</a>s, and channels (e.g. <a>MVar</a> and
--   <a>Chan</a>).
--   
--   For example, here is how we might implement an <a>echo server</a>,
--   using <a>forever</a> both to listen for client connections on a
--   network socket and to echo client input on client connection handles:
--   
--   <pre>
--   echoServer :: Socket -&gt; IO ()
--   echoServer socket = <a>forever</a> $ do
--     client &lt;- accept socket
--     <a>forkFinally</a> (echo client) (\_ -&gt; hClose client)
--     where
--       echo :: Handle -&gt; IO ()
--       echo client = <a>forever</a> $
--         hGetLine client &gt;&gt;= hPutStrLn client
--   </pre>
forever :: Applicative f => f a -> f b

-- | Right-to-left composition of Kleisli arrows.
--   <tt>(<a>&gt;=&gt;</a>)</tt>, with the arguments flipped.
--   
--   Note how this operator resembles function composition
--   <tt>(<a>.</a>)</tt>:
--   
--   <pre>
--   (.)   ::            (b -&gt;   c) -&gt; (a -&gt;   b) -&gt; a -&gt;   c
--   (&lt;=&lt;) :: Monad m =&gt; (b -&gt; m c) -&gt; (a -&gt; m b) -&gt; a -&gt; m c
--   </pre>
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
infixr 1 <=<

-- | Left-to-right composition of Kleisli arrows.
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
infixr 1 >=>

-- | <a>forM</a> is <a>mapM</a> with its arguments flipped. For a version
--   that ignores the results see <a>forM_</a>.
forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)

-- | Send the first component of the input through the argument arrow, and
--   copy the rest unchanged to the output.
first :: Arrow a => a b c -> a (b, d) (c, d)

-- | A mirror image of <a>first</a>.
--   
--   The default definition may be overridden with a more efficient version
--   if desired.
second :: Arrow a => a b c -> a (d, b) (d, c)

-- | Split the input between the two argument arrows and combine their
--   output. Note that this is in general not a functor.
--   
--   The default definition may be overridden with a more efficient version
--   if desired.
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
infixr 3 ***

-- | Fanout: send the input to both argument arrows and combine their
--   output.
--   
--   The default definition may be overridden with a more efficient version
--   if desired.
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
infixr 3 &&&

-- | Identity functor and monad. (a non-strict monad)
newtype Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a

-- | A handle managing output to the Haskell program's standard error
--   channel.
stderr :: Handle

-- | A handle managing input from the Haskell program's standard input
--   channel.
stdin :: Handle

-- | Write the supplied value into a <a>TVar</a>.
writeTVar :: () => TVar a -> a -> STM ()

-- | Return the current value stored in a <a>TVar</a>.
readTVar :: () => TVar a -> STM a

-- | Create a new <a>TVar</a> holding a value supplied
newTVar :: () => a -> STM (TVar a)

-- | A monad supporting atomic memory transactions.
data STM a

-- | Shared memory locations that support atomic memory transactions.
data TVar a

-- | Superclass for asynchronous exceptions.
data SomeAsyncException
[SomeAsyncException] :: forall e. Exception e => e -> SomeAsyncException

-- | Defines the exit codes that a program can return.
data ExitCode

-- | indicates successful termination;
ExitSuccess :: ExitCode

-- | indicates program failure with an exit code. The exact interpretation
--   of the code is operating-system dependent. In particular, some values
--   may be prohibited (e.g. 0 on a POSIX-compliant system).
ExitFailure :: Int -> ExitCode

-- | A handle managing output to the Haskell program's standard output
--   channel.
stdout :: Handle

-- | Three kinds of buffering are supported: line-buffering,
--   block-buffering or no-buffering. These modes have the following
--   effects. For output, items are written out, or <i>flushed</i>, from
--   the internal buffer according to the buffer mode:
--   
--   <ul>
--   <li><i>line-buffering</i>: the entire output buffer is flushed
--   whenever a newline is output, the buffer overflows, a <a>hFlush</a> is
--   issued, or the handle is closed.</li>
--   <li><i>block-buffering</i>: the entire buffer is written out whenever
--   it overflows, a <a>hFlush</a> is issued, or the handle is closed.</li>
--   <li><i>no-buffering</i>: output is written immediately, and never
--   stored in the buffer.</li>
--   </ul>
--   
--   An implementation is free to flush the buffer more frequently, but not
--   less frequently, than specified above. The output buffer is emptied as
--   soon as it has been written out.
--   
--   Similarly, input occurs according to the buffer mode for the handle:
--   
--   <ul>
--   <li><i>line-buffering</i>: when the buffer for the handle is not
--   empty, the next item is obtained from the buffer; otherwise, when the
--   buffer is empty, characters up to and including the next newline
--   character are read into the buffer. No characters are available until
--   the newline character is available or the buffer is full.</li>
--   <li><i>block-buffering</i>: when the buffer for the handle becomes
--   empty, the next block of data is read into the buffer.</li>
--   <li><i>no-buffering</i>: the next input item is read and returned. The
--   <a>hLookAhead</a> operation implies that even a no-buffered handle may
--   require a one-character buffer.</li>
--   </ul>
--   
--   The default buffering mode when a handle is opened is
--   implementation-dependent and may depend on the file system object
--   which is attached to that handle. For most implementations, physical
--   files will normally be block-buffered and terminals will normally be
--   line-buffered.
data BufferMode

-- | buffering is disabled if possible.
NoBuffering :: BufferMode

-- | line-buffering should be enabled if possible.
LineBuffering :: BufferMode

-- | block-buffering should be enabled if possible. The size of the buffer
--   is <tt>n</tt> items if the argument is <a>Just</a> <tt>n</tt> and is
--   otherwise implementation-dependent.
BlockBuffering :: Maybe Int -> BufferMode

-- | A mode that determines the effect of <tt>hSeek</tt> <tt>hdl mode
--   i</tt>.
data SeekMode

-- | A mutable variable in the <a>IO</a> monad
data IORef a

-- | Exceptions that occur in the <tt>IO</tt> monad. An
--   <tt>IOException</tt> records a more specific error type, a descriptive
--   string and maybe the handle that was used when the error was flagged.
data IOException

-- | Any type that you wish to throw or catch as an exception must be an
--   instance of the <tt>Exception</tt> class. The simplest case is a new
--   exception type directly below the root:
--   
--   <pre>
--   data MyException = ThisException | ThatException
--       deriving Show
--   
--   instance Exception MyException
--   </pre>
--   
--   The default method definitions in the <tt>Exception</tt> class do what
--   we need in this case. You can now throw and catch
--   <tt>ThisException</tt> and <tt>ThatException</tt> as exceptions:
--   
--   <pre>
--   *Main&gt; throw ThisException `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: MyException))
--   Caught ThisException
--   </pre>
--   
--   In more complicated examples, you may wish to define a whole hierarchy
--   of exceptions:
--   
--   <pre>
--   ---------------------------------------------------------------------
--   -- Make the root exception type for all the exceptions in a compiler
--   
--   data SomeCompilerException = forall e . Exception e =&gt; SomeCompilerException e
--   
--   instance Show SomeCompilerException where
--       show (SomeCompilerException e) = show e
--   
--   instance Exception SomeCompilerException
--   
--   compilerExceptionToException :: Exception e =&gt; e -&gt; SomeException
--   compilerExceptionToException = toException . SomeCompilerException
--   
--   compilerExceptionFromException :: Exception e =&gt; SomeException -&gt; Maybe e
--   compilerExceptionFromException x = do
--       SomeCompilerException a &lt;- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make a subhierarchy for exceptions in the frontend of the compiler
--   
--   data SomeFrontendException = forall e . Exception e =&gt; SomeFrontendException e
--   
--   instance Show SomeFrontendException where
--       show (SomeFrontendException e) = show e
--   
--   instance Exception SomeFrontendException where
--       toException = compilerExceptionToException
--       fromException = compilerExceptionFromException
--   
--   frontendExceptionToException :: Exception e =&gt; e -&gt; SomeException
--   frontendExceptionToException = toException . SomeFrontendException
--   
--   frontendExceptionFromException :: Exception e =&gt; SomeException -&gt; Maybe e
--   frontendExceptionFromException x = do
--       SomeFrontendException a &lt;- fromException x
--       cast a
--   
--   ---------------------------------------------------------------------
--   -- Make an exception type for a particular frontend compiler exception
--   
--   data MismatchedParentheses = MismatchedParentheses
--       deriving Show
--   
--   instance Exception MismatchedParentheses where
--       toException   = frontendExceptionToException
--       fromException = frontendExceptionFromException
--   </pre>
--   
--   We can now catch a <tt>MismatchedParentheses</tt> exception as
--   <tt>MismatchedParentheses</tt>, <tt>SomeFrontendException</tt> or
--   <tt>SomeCompilerException</tt>, but not other types, e.g.
--   <tt>IOException</tt>:
--   
--   <pre>
--   *Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
--   Caught MismatchedParentheses
--   *Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: SomeFrontendException))
--   Caught MismatchedParentheses
--   *Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: SomeCompilerException))
--   Caught MismatchedParentheses
--   *Main&gt; throw MismatchedParentheses `catch` \e -&gt; putStrLn ("Caught " ++ show (e :: IOException))
--   *** Exception: MismatchedParentheses
--   </pre>
class (Typeable e, Show e) => Exception e
toException :: Exception e => e -> SomeException
fromException :: Exception e => SomeException -> Maybe e

-- | Render this exception value in a human-friendly manner.
--   
--   Default implementation: <tt><a>show</a></tt>.
displayException :: Exception e => e -> String

-- | The <a>Const</a> functor.
newtype Const a (b :: k) :: forall k. () => Type -> k -> Type
Const :: a -> Const a
[getConst] :: Const a -> a

-- | The sum of a collection of actions, generalizing <a>concat</a>. As of
--   base 4.8.0.0, <a>msum</a> is just <a>asum</a>, specialized to
--   <a>MonadPlus</a>.
msum :: (Foldable t, MonadPlus m) => t (m a) -> m a

-- | The sum of a collection of actions, generalizing <a>concat</a>.
--   
--   asum [Just <a>Hello</a>, Nothing, Just <a>World</a>] Just <a>Hello</a>
asum :: (Foldable t, Alternative f) => t (f a) -> f a

-- | Evaluate each action in the structure from left to right, and ignore
--   the results. For a version that doesn't ignore the results see
--   <a>sequenceA</a>.
sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()

-- | <a>forM_</a> is <a>mapM_</a> with its arguments flipped. For a version
--   that doesn't ignore the results see <a>forM</a>.
--   
--   As of base 4.8.0.0, <a>forM_</a> is just <a>for_</a>, specialized to
--   <a>Monad</a>.
forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()

-- | Map each element of a structure to a monadic action, evaluate these
--   actions from left to right, and ignore the results. For a version that
--   doesn't ignore the results see <a>mapM</a>.
--   
--   As of base 4.8.0.0, <a>mapM_</a> is just <a>traverse_</a>, specialized
--   to <a>Monad</a>.
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

-- | Maybe monoid returning the leftmost non-Nothing value.
--   
--   <tt><a>First</a> a</tt> is isomorphic to <tt><a>Alt</a> <a>Maybe</a>
--   a</tt>, but precedes it historically.
--   
--   <pre>
--   &gt;&gt;&gt; getFirst (First (Just "hello") &lt;&gt; First Nothing &lt;&gt; First (Just "world"))
--   Just "hello"
--   </pre>
--   
--   Use of this type is discouraged. Note the following equivalence:
--   
--   <pre>
--   Data.Monoid.First x === Maybe (Data.Semigroup.First x)
--   </pre>
--   
--   In addition to being equivalent in the structural sense, the two also
--   have <a>Monoid</a> instances that behave the same. This type will be
--   marked deprecated in GHC 8.8, and removed in GHC 8.10. Users are
--   advised to use the variant from <a>Data.Semigroup</a> and wrap it in
--   <a>Maybe</a>.
newtype First a
First :: Maybe a -> First a
[getFirst] :: First a -> Maybe a

-- | The monoid of endomorphisms under composition.
--   
--   <pre>
--   &gt;&gt;&gt; let computation = Endo ("Hello, " ++) &lt;&gt; Endo (++ "!")
--   
--   &gt;&gt;&gt; appEndo computation "Haskell"
--   "Hello, Haskell!"
--   </pre>
newtype Endo a
Endo :: (a -> a) -> Endo a
[appEndo] :: Endo a -> a -> a

-- | Monoid under addition.
--   
--   <pre>
--   &gt;&gt;&gt; getSum (Sum 1 &lt;&gt; Sum 2 &lt;&gt; mempty)
--   3
--   </pre>
newtype Sum a
Sum :: a -> Sum a
[getSum] :: Sum a -> a

-- | Parse a string using the <a>Read</a> instance. Succeeds if there is
--   exactly one valid result.
--   
--   <pre>
--   &gt;&gt;&gt; readMaybe "123" :: Maybe Int
--   Just 123
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; readMaybe "hello" :: Maybe Int
--   Nothing
--   </pre>
readMaybe :: Read a => String -> Maybe a

-- | Return <a>True</a> if the given value is a <a>Right</a>-value,
--   <a>False</a> otherwise.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; isRight (Left "foo")
--   False
--   
--   &gt;&gt;&gt; isRight (Right 3)
--   True
--   </pre>
--   
--   Assuming a <a>Left</a> value signifies some sort of error, we can use
--   <a>isRight</a> to write a very simple reporting function that only
--   outputs "SUCCESS" when a computation has succeeded.
--   
--   This example shows how <a>isRight</a> might be used to avoid pattern
--   matching when one does not care about the value contained in the
--   constructor:
--   
--   <pre>
--   &gt;&gt;&gt; import Control.Monad ( when )
--   
--   &gt;&gt;&gt; let report e = when (isRight e) $ putStrLn "SUCCESS"
--   
--   &gt;&gt;&gt; report (Left "parse error")
--   
--   &gt;&gt;&gt; report (Right 1)
--   SUCCESS
--   </pre>
isRight :: () => Either a b -> Bool

-- | Return <a>True</a> if the given value is a <a>Left</a>-value,
--   <a>False</a> otherwise.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; isLeft (Left "foo")
--   True
--   
--   &gt;&gt;&gt; isLeft (Right 3)
--   False
--   </pre>
--   
--   Assuming a <a>Left</a> value signifies some sort of error, we can use
--   <a>isLeft</a> to write a very simple error-reporting function that
--   does absolutely nothing in the case of success, and outputs "ERROR" if
--   any error occurred.
--   
--   This example shows how <a>isLeft</a> might be used to avoid pattern
--   matching when one does not care about the value contained in the
--   constructor:
--   
--   <pre>
--   &gt;&gt;&gt; import Control.Monad ( when )
--   
--   &gt;&gt;&gt; let report e = when (isLeft e) $ putStrLn "ERROR"
--   
--   &gt;&gt;&gt; report (Right 1)
--   
--   &gt;&gt;&gt; report (Left "parse error")
--   ERROR
--   </pre>
isLeft :: () => Either a b -> Bool

-- | Partitions a list of <a>Either</a> into two lists. All the <a>Left</a>
--   elements are extracted, in order, to the first component of the
--   output. Similarly the <a>Right</a> elements are extracted to the
--   second component of the output.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
--   
--   &gt;&gt;&gt; partitionEithers list
--   (["foo","bar","baz"],[3,7])
--   </pre>
--   
--   The pair returned by <tt><a>partitionEithers</a> x</tt> should be the
--   same pair as <tt>(<a>lefts</a> x, <a>rights</a> x)</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
--   
--   &gt;&gt;&gt; partitionEithers list == (lefts list, rights list)
--   True
--   </pre>
partitionEithers :: () => [Either a b] -> ([a], [b])

-- | Extracts from a list of <a>Either</a> all the <a>Right</a> elements.
--   All the <a>Right</a> elements are extracted in order.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
--   
--   &gt;&gt;&gt; rights list
--   [3,7]
--   </pre>
rights :: () => [Either a b] -> [b]

-- | Extracts from a list of <a>Either</a> all the <a>Left</a> elements.
--   All the <a>Left</a> elements are extracted in order.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
--   
--   &gt;&gt;&gt; lefts list
--   ["foo","bar","baz"]
--   </pre>
lefts :: () => [Either a b] -> [a]

-- | <a>Proxy</a> is a type that holds no data, but has a phantom parameter
--   of arbitrary type (or even kind). Its use is to provide type
--   information, even though there is no value available of that type (or
--   it may be too costly to create one).
--   
--   Historically, <tt><a>Proxy</a> :: <a>Proxy</a> a</tt> is a safer
--   alternative to the <tt>'undefined :: a'</tt> idiom.
--   
--   <pre>
--   &gt;&gt;&gt; Proxy :: Proxy (Void, Int -&gt; Int)
--   Proxy
--   </pre>
--   
--   Proxy can even hold types of higher kinds,
--   
--   <pre>
--   &gt;&gt;&gt; Proxy :: Proxy Either
--   Proxy
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Proxy :: Proxy Functor
--   Proxy
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Proxy :: Proxy complicatedStructure
--   Proxy
--   </pre>
data Proxy (t :: k) :: forall k. () => k -> Type
Proxy :: Proxy

-- | Left-to-right composition
(>>>) :: Category cat => cat a b -> cat b c -> cat a c
infixr 1 >>>

-- | See <a>openFile</a>
data IOMode
ReadMode :: IOMode
WriteMode :: IOMode
AppendMode :: IOMode
ReadWriteMode :: IOMode

-- | The member functions of this class facilitate writing values of
--   primitive types to raw memory (which may have been allocated with the
--   above mentioned routines) and reading values from blocks of raw
--   memory. The class, furthermore, includes support for computing the
--   storage requirements and alignment restrictions of storable types.
--   
--   Memory addresses are represented as values of type <tt><a>Ptr</a>
--   a</tt>, for some <tt>a</tt> which is an instance of class
--   <a>Storable</a>. The type argument to <a>Ptr</a> helps provide some
--   valuable type safety in FFI code (you can't mix pointers of different
--   types without an explicit cast), while helping the Haskell type system
--   figure out which marshalling method is needed for a given pointer.
--   
--   All marshalling between Haskell and a foreign language ultimately
--   boils down to translating Haskell data structures into the binary
--   representation of a corresponding data structure of the foreign
--   language and vice versa. To code this marshalling in Haskell, it is
--   necessary to manipulate primitive data types stored in unstructured
--   memory blocks. The class <a>Storable</a> facilitates this manipulation
--   on all types for which it is instantiated, which are the standard
--   basic types of Haskell, the fixed size <tt>Int</tt> types
--   (<a>Int8</a>, <a>Int16</a>, <a>Int32</a>, <a>Int64</a>), the fixed
--   size <tt>Word</tt> types (<a>Word8</a>, <a>Word16</a>, <a>Word32</a>,
--   <a>Word64</a>), <a>StablePtr</a>, all types from
--   <a>Foreign.C.Types</a>, as well as <a>Ptr</a>.
class Storable a

-- | Case analysis for the <a>Bool</a> type. <tt><a>bool</a> x y p</tt>
--   evaluates to <tt>x</tt> when <tt>p</tt> is <a>False</a>, and evaluates
--   to <tt>y</tt> when <tt>p</tt> is <a>True</a>.
--   
--   This is equivalent to <tt>if p then y else x</tt>; that is, one can
--   think of it as an if-then-else construct with its arguments reordered.
--   
--   <h4><b>Examples</b></h4>
--   
--   Basic usage:
--   
--   <pre>
--   &gt;&gt;&gt; bool "foo" "bar" True
--   "bar"
--   
--   &gt;&gt;&gt; bool "foo" "bar" False
--   "foo"
--   </pre>
--   
--   Confirm that <tt><a>bool</a> x y p</tt> and <tt>if p then y else
--   x</tt> are equivalent:
--   
--   <pre>
--   &gt;&gt;&gt; let p = True; x = "bar"; y = "foo"
--   
--   &gt;&gt;&gt; bool x y p == if p then y else x
--   True
--   
--   &gt;&gt;&gt; let p = False
--   
--   &gt;&gt;&gt; bool x y p == if p then y else x
--   True
--   </pre>
bool :: () => a -> a -> Bool -> a

-- | <a>&amp;</a> is a reverse application operator. This provides
--   notational convenience. Its precedence is one higher than that of the
--   forward application operator <a>$</a>, which allows <a>&amp;</a> to be
--   nested in <a>$</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 5 &amp; (+1) &amp; show
--   "6"
--   </pre>
(&) :: () => a -> (a -> b) -> b
infixl 1 &

-- | <tt><a>on</a> b u x y</tt> runs the binary function <tt>b</tt>
--   <i>on</i> the results of applying unary function <tt>u</tt> to two
--   arguments <tt>x</tt> and <tt>y</tt>. From the opposite perspective, it
--   transforms two inputs and combines the outputs.
--   
--   <pre>
--   ((+) `<a>on</a>` f) x y = f x + f y
--   </pre>
--   
--   Typical usage: <tt><a>sortBy</a> (<tt>compare</tt> `on`
--   <tt>fst</tt>)</tt>.
--   
--   Algebraic properties:
--   
--   <ul>
--   <li><pre>(*) `on` <a>id</a> = (*) -- (if (*) ∉ {⊥, <a>const</a>
--   ⊥})</pre></li>
--   <li><pre>((*) `on` f) `on` g = (*) `on` (f . g)</pre></li>
--   <li><pre><a>flip</a> on f . <a>flip</a> on g = <a>flip</a> on (g .
--   f)</pre></li>
--   </ul>
on :: () => (b -> b -> c) -> (a -> b) -> a -> a -> c
infixl 0 `on`

-- | <tt><a>fix</a> f</tt> is the least fixed point of the function
--   <tt>f</tt>, i.e. the least defined <tt>x</tt> such that <tt>f x =
--   x</tt>.
--   
--   For example, we can write the factorial function using direct
--   recursion as
--   
--   <pre>
--   &gt;&gt;&gt; let fac n = if n &lt;= 1 then 1 else n * fac (n-1) in fac 5
--   120
--   </pre>
--   
--   This uses the fact that Haskell’s <tt>let</tt> introduces recursive
--   bindings. We can rewrite this definition using <a>fix</a>,
--   
--   <pre>
--   &gt;&gt;&gt; fix (\rec n -&gt; if n &lt;= 1 then 1 else n * rec (n-1)) 5
--   120
--   </pre>
--   
--   Instead of making a recursive call, we introduce a dummy parameter
--   <tt>rec</tt>; when used within <a>fix</a>, this parameter then refers
--   to <tt>fix'</tt> argument, hence the recursion is reintroduced.
fix :: () => (a -> a) -> a

-- | Flipped version of <a>&lt;$</a>.
--   
--   <h4><b>Examples</b></h4>
--   
--   Replace the contents of a <tt><tt>Maybe</tt> <tt>Int</tt></tt> with a
--   constant <tt>String</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; Nothing $&gt; "foo"
--   Nothing
--   
--   &gt;&gt;&gt; Just 90210 $&gt; "foo"
--   Just "foo"
--   </pre>
--   
--   Replace the contents of an <tt><tt>Either</tt> <tt>Int</tt>
--   <tt>Int</tt></tt> with a constant <tt>String</tt>, resulting in an
--   <tt><tt>Either</tt> <tt>Int</tt> <tt>String</tt></tt>:
--   
--   <pre>
--   &gt;&gt;&gt; Left 8675309 $&gt; "foo"
--   Left 8675309
--   
--   &gt;&gt;&gt; Right 8675309 $&gt; "foo"
--   Right "foo"
--   </pre>
--   
--   Replace each element of a list with a constant <tt>String</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] $&gt; "foo"
--   ["foo","foo","foo"]
--   </pre>
--   
--   Replace the second element of a pair with a constant <tt>String</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) $&gt; "foo"
--   (1,"foo")
--   </pre>
($>) :: Functor f => f a -> b -> f b
infixl 4 $>

-- | Flipped version of <a>&lt;$&gt;</a>.
--   
--   <pre>
--   (<a>&lt;&amp;&gt;</a>) = <a>flip</a> <a>fmap</a>
--   </pre>
--   
--   <h4><b>Examples</b></h4>
--   
--   Apply <tt>(+1)</tt> to a list, a <a>Just</a> and a <a>Right</a>:
--   
--   <pre>
--   &gt;&gt;&gt; Just 2 &lt;&amp;&gt; (+1)
--   Just 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] &lt;&amp;&gt; (+1)
--   [2,3,4]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right 3 &lt;&amp;&gt; (+1)
--   Right 4
--   </pre>
(<&>) :: Functor f => f a -> (a -> b) -> f b
infixl 1 <&>

-- | An <a>MVar</a> (pronounced "em-var") is a synchronising variable, used
--   for communication between concurrent threads. It can be thought of as
--   a box, which may be empty or full.
data MVar a

-- | Lift a ternary function to actions.
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d

-- | Lift a function to actions. This function may be used as a value for
--   <a>fmap</a> in a <a>Functor</a> instance.
liftA :: Applicative f => (a -> b) -> f a -> f b

-- | Request a CallStack.
--   
--   NOTE: The implicit parameter <tt>?callStack :: CallStack</tt> is an
--   implementation detail and <b>should not</b> be considered part of the
--   <a>CallStack</a> API, we may decide to change the implementation in
--   the future.
type HasCallStack = ?callStack :: CallStack

-- | The <tt>SomeException</tt> type is the root of the exception type
--   hierarchy. When an exception of type <tt>e</tt> is thrown, behind the
--   scenes it is encapsulated in a <tt>SomeException</tt>.
data SomeException
[SomeException] :: forall e. Exception e => e -> SomeException

-- | <i>O(n)</i>. Convert a <a>ShortByteString</a> into a
--   <a>ByteString</a>.
fromShort :: ShortByteString -> ByteString

-- | <i>O(n)</i>. Convert a <a>ByteString</a> into a
--   <a>ShortByteString</a>.
--   
--   This makes a copy, so does not retain the input string.
toShort :: ByteString -> ShortByteString

-- | The reader monad transformer, which adds a read-only environment to
--   the given monad.
--   
--   The <a>return</a> function ignores the environment, while
--   <tt>&gt;&gt;=</tt> passes the inherited environment to both
--   subcomputations.
newtype ReaderT r (m :: Type -> Type) a
ReaderT :: (r -> m a) -> ReaderT r a
[runReaderT] :: ReaderT r a -> r -> m a

-- | Run a pipeline until processing completes.
--   
--   Since 1.2.1
runConduit :: Monad m => ConduitT () Void m r -> m r

-- | Combine two <tt>Conduit</tt>s together into a new <tt>Conduit</tt>
--   (aka <a>fuse</a>).
--   
--   Output from the upstream (left) conduit will be fed into the
--   downstream (right) conduit. Processing will terminate when downstream
--   (right) returns. Leftover data returned from the right
--   <tt>Conduit</tt> will be discarded.
--   
--   Equivalent to <a>fuse</a> and <a>=$=</a>, however the latter is
--   deprecated and will be removed in a future version.
--   
--   Note that, while this operator looks like categorical composition
--   (from <a>Control.Category</a>), there are a few reasons it's
--   different:
--   
--   <ul>
--   <li>The position of the type parameters to <a>ConduitT</a> do not
--   match. We would need to change <tt>ConduitT i o m r</tt> to
--   <tt>ConduitT r m i o</tt>, which would preclude a <a>Monad</a> or
--   <a>MonadTrans</a> instance.</li>
--   <li>The result value from upstream and downstream are allowed to
--   differ between upstream and downstream. In other words, we would need
--   the type signature here to look like <tt>ConduitT a b m r -&gt;
--   ConduitT b c m r -&gt; ConduitT a c m r</tt>.</li>
--   <li>Due to leftovers, we do not have a left identity in Conduit. This
--   can be achieved with the underlying <tt>Pipe</tt> datatype, but this
--   is not generally recommended. See
--   <a>https://stackoverflow.com/a/15263700</a>.</li>
--   </ul>
(.|) :: Monad m => ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r
infixr 2 .|

-- | Same as <a>ConduitT</a>, for backwards compat
type ConduitM = ConduitT

-- | Monads which allow their actions to be run in <a>IO</a>.
--   
--   While <a>MonadIO</a> allows an <a>IO</a> action to be lifted into
--   another monad, this class captures the opposite concept: allowing you
--   to capture the monadic context. Note that, in order to meet the laws
--   given below, the intuition is that a monad must have no monadic state,
--   but may have monadic context. This essentially limits
--   <a>MonadUnliftIO</a> to <a>ReaderT</a> and <a>IdentityT</a>
--   transformers on top of <a>IO</a>.
--   
--   Laws. For any value <tt>u</tt> returned by <a>askUnliftIO</a>, it must
--   meet the monad transformer laws as reformulated for
--   <tt>MonadUnliftIO</tt>:
--   
--   <ul>
--   <li><pre>unliftIO u . return = return</pre></li>
--   <li><pre>unliftIO u (m &gt;&gt;= f) = unliftIO u m &gt;&gt;= unliftIO
--   u . f</pre></li>
--   </ul>
--   
--   The third is a currently nameless law which ensures that the current
--   context is preserved.
--   
--   <ul>
--   <li><pre>askUnliftIO &gt;&gt;= (u -&gt; liftIO (unliftIO u m)) =
--   m</pre></li>
--   </ul>
--   
--   If you have a name for this, please submit it in a pull request for
--   great glory.
class MonadIO m => MonadUnliftIO (m :: Type -> Type)

-- | Capture the current monadic context, providing the ability to run
--   monadic actions in <a>IO</a>.
--   
--   See <a>UnliftIO</a> for an explanation of why we need a helper
--   datatype here.
askUnliftIO :: MonadUnliftIO m => m (UnliftIO m)

-- | Convenience function for capturing the monadic context and running an
--   <a>IO</a> action with a runner function. The runner function is used
--   to run a monadic action <tt>m</tt> in <tt>IO</tt>.
withRunInIO :: MonadUnliftIO m => ((forall a. () => m a -> IO a) -> IO b) -> m b

-- | Class of monads which can perform primitive state-transformer actions
class Monad m => PrimMonad (m :: Type -> Type) where {
    
    -- | State token type
    type family PrimState (m :: Type -> Type) :: Type;
}

-- | Execute a primitive operation
primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a

-- | The class of monad transformers. Instances should satisfy the
--   following laws, which state that <a>lift</a> is a monad
--   transformation:
--   
--   <ul>
--   <li><pre><a>lift</a> . <a>return</a> = <a>return</a></pre></li>
--   <li><pre><a>lift</a> (m &gt;&gt;= f) = <a>lift</a> m &gt;&gt;=
--   (<a>lift</a> . f)</pre></li>
--   </ul>
class MonadTrans (t :: Type -> Type -> Type -> Type)

-- | Lift a computation from the argument monad to the constructed monad.
lift :: (MonadTrans t, Monad m) => m a -> t m a

-- | A map of integers to values <tt>a</tt>.
data IntMap a

-- | A set of integers.
data IntSet

-- | A set of values <tt>a</tt>.
data Set a

-- | a variant of <a>deepseq</a> that is useful in some circumstances:
--   
--   <pre>
--   force x = x `deepseq` x
--   </pre>
--   
--   <tt>force x</tt> fully evaluates <tt>x</tt>, and then returns it. Note
--   that <tt>force x</tt> only performs evaluation when the value of
--   <tt>force x</tt> itself is demanded, so essentially it turns shallow
--   evaluation into deep evaluation.
--   
--   <a>force</a> can be conveniently used in combination with
--   <tt>ViewPatterns</tt>:
--   
--   <pre>
--   {-# LANGUAGE BangPatterns, ViewPatterns #-}
--   import Control.DeepSeq
--   
--   someFun :: ComplexData -&gt; SomeResult
--   someFun (force -&gt; !arg) = {- 'arg' will be fully evaluated -}
--   </pre>
--   
--   Another useful application is to combine <a>force</a> with
--   <a>evaluate</a> in order to force deep evaluation relative to other
--   <a>IO</a> operations:
--   
--   <pre>
--   import Control.Exception (evaluate)
--   import Control.DeepSeq
--   
--   main = do
--     result &lt;- evaluate $ force $ pureComputation
--     {- 'result' will be fully evaluated at this point -}
--     return ()
--   </pre>
--   
--   Finally, here's an exception safe variant of the <tt>readFile'</tt>
--   example:
--   
--   <pre>
--   readFile' :: FilePath -&gt; IO String
--   readFile' fn = bracket (openFile fn ReadMode) hClose $ \h -&gt;
--                          evaluate . force =&lt;&lt; hGetContents h
--   </pre>
force :: NFData a => a -> a

-- | the deep analogue of <a>$!</a>. In the expression <tt>f $!! x</tt>,
--   <tt>x</tt> is fully evaluated before the function <tt>f</tt> is
--   applied to it.
($!!) :: NFData a => (a -> b) -> a -> b
infixr 0 $!!

-- | <a>lens</a> creates a <a>Lens</a> from a getter and a setter. The
--   resulting lens isn't the most effective one (because of having to
--   traverse the structure twice when modifying), but it shouldn't matter
--   much.
--   
--   A (partial) lens for list indexing:
--   
--   <pre>
--   ix :: Int -&gt; <a>Lens'</a> [a] a
--   ix i = <a>lens</a> (<a>!!</a> i)                                   -- getter
--               (\s b -&gt; take i s ++ b : drop (i+1) s)   -- setter
--   </pre>
--   
--   Usage:
--   
--   <pre>
--   &gt;&gt;&gt; [1..9] <a>^.</a> ix 3
--   4
--   
--   &gt;&gt;&gt; [1..9] &amp; ix 3 <a>%~</a> negate
--   [1,2,3,-4,5,6,7,8,9]
--   </pre>
--   
--   When getting, the setter is completely unused; when setting, the
--   getter is unused. Both are used only when the value is being modified.
--   For instance, here we define a lens for the 1st element of a list, but
--   instead of a legitimate getter we use <a>undefined</a>. Then we use
--   the resulting lens for <i>setting</i> and it works, which proves that
--   the getter wasn't used:
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] &amp; lens undefined (\s b -&gt; b : tail s) .~ 10
--   [10,2,3]
--   </pre>
lens :: () => (s -> a) -> (s -> b -> t) -> Lens s t a b

-- | <a>to</a> creates a getter from any function:
--   
--   <pre>
--   a <a>^.</a> <a>to</a> f = f a
--   </pre>
--   
--   It's most useful in chains, because it lets you mix lenses and
--   ordinary functions. Suppose you have a record which comes from some
--   third-party library and doesn't have any lens accessors. You want to
--   do something like this:
--   
--   <pre>
--   value ^. _1 . field . at 2
--   </pre>
--   
--   However, <tt>field</tt> isn't a getter, and you have to do this
--   instead:
--   
--   <pre>
--   field (value ^. _1) ^. at 2
--   </pre>
--   
--   but now <tt>value</tt> is in the middle and it's hard to read the
--   resulting code. A variant with <a>to</a> is prettier and more
--   readable:
--   
--   <pre>
--   value ^. _1 . to field . at 2
--   </pre>
to :: () => (s -> a) -> SimpleGetter s a

-- | (<a>^.</a>) applies a getter to a value; in other words, it gets a
--   value out of a structure using a getter (which can be a lens,
--   traversal, fold, etc.).
--   
--   Getting 1st field of a tuple:
--   
--   <pre>
--   (<a>^.</a> <a>_1</a>) :: (a, b) -&gt; a
--   (<a>^.</a> <a>_1</a>) = <a>fst</a>
--   </pre>
--   
--   When (<a>^.</a>) is used with a traversal, it combines all results
--   using the <a>Monoid</a> instance for the resulting type. For instance,
--   for lists it would be simple concatenation:
--   
--   <pre>
--   &gt;&gt;&gt; ("str","ing") ^. each
--   "string"
--   </pre>
--   
--   The reason for this is that traversals use <a>Applicative</a>, and the
--   <a>Applicative</a> instance for <a>Const</a> uses monoid concatenation
--   to combine “effects” of <a>Const</a>.
--   
--   A non-operator version of (<a>^.</a>) is called <tt>view</tt>, and
--   it's a bit more general than (<a>^.</a>) (it works in
--   <tt>MonadReader</tt>). If you need the general version, you can get it
--   from <a>microlens-mtl</a>; otherwise there's <a>view</a> available in
--   <a>Lens.Micro.Extras</a>.
(^.) :: () => s -> Getting a s a -> a
infixl 8 ^.

-- | <a>set</a> is a synonym for (<a>.~</a>).
--   
--   Setting the 1st component of a pair:
--   
--   <pre>
--   <a>set</a> <a>_1</a> :: x -&gt; (a, b) -&gt; (x, b)
--   <a>set</a> <a>_1</a> = \x t -&gt; (x, snd t)
--   </pre>
--   
--   Using it to rewrite (<a>&lt;$</a>):
--   
--   <pre>
--   <a>set</a> <a>mapped</a> :: <a>Functor</a> f =&gt; a -&gt; f b -&gt; f a
--   <a>set</a> <a>mapped</a> = (<a>&lt;$</a>)
--   </pre>
set :: () => ASetter s t a b -> b -> s -> t

-- | <a>over</a> is a synonym for (<a>%~</a>).
--   
--   Getting <a>fmap</a> in a roundabout way:
--   
--   <pre>
--   <a>over</a> <a>mapped</a> :: <a>Functor</a> f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
--   <a>over</a> <a>mapped</a> = <a>fmap</a>
--   </pre>
--   
--   Applying a function to both components of a pair:
--   
--   <pre>
--   <a>over</a> <a>both</a> :: (a -&gt; b) -&gt; (a, a) -&gt; (b, b)
--   <a>over</a> <a>both</a> = \f t -&gt; (f (fst t), f (snd t))
--   </pre>
--   
--   Using <tt><a>over</a> <a>_2</a></tt> as a replacement for
--   <a>second</a>:
--   
--   <pre>
--   &gt;&gt;&gt; over _2 show (10,20)
--   (10,"20")
--   </pre>
over :: () => ASetter s t a b -> (a -> b) -> s -> t

-- | <a>sets</a> creates an <a>ASetter</a> from an ordinary function. (The
--   only thing it does is wrapping and unwrapping <a>Identity</a>.)
sets :: () => ((a -> b) -> s -> t) -> ASetter s t a b

-- | <tt>ASetter s t a b</tt> is something that turns a function modifying
--   a value into a function modifying a <i>structure</i>. If you ignore
--   <a>Identity</a> (as <tt>Identity a</tt> is the same thing as
--   <tt>a</tt>), the type is:
--   
--   <pre>
--   type ASetter s t a b = (a -&gt; b) -&gt; s -&gt; t
--   </pre>
--   
--   The reason <a>Identity</a> is used here is for <a>ASetter</a> to be
--   composable with other types, such as <a>Lens</a>.
--   
--   Technically, if you're writing a library, you shouldn't use this type
--   for setters you are exporting from your library; the right type to use
--   is <tt><a>Setter</a></tt>, but it is not provided by this package
--   (because then it'd have to depend on <a>distributive</a>). It's
--   completely alright, however, to export functions which take an
--   <a>ASetter</a> as an argument.
type ASetter s t a b = a -> Identity b -> s -> Identity t

-- | This is a type alias for monomorphic setters which don't change the
--   type of the container (or of the value inside). It's useful more often
--   than the same type in lens, because we can't provide real setters and
--   so it does the job of both <tt><a>ASetter'</a></tt> and
--   <tt><a>Setter'</a></tt>.
type ASetter' s a = ASetter s s a a

-- | A <tt>SimpleGetter s a</tt> extracts <tt>a</tt> from <tt>s</tt>; so,
--   it's the same thing as <tt>(s -&gt; a)</tt>, but you can use it in
--   lens chains because its type looks like this:
--   
--   <pre>
--   type SimpleGetter s a =
--     forall r. (a -&gt; Const r a) -&gt; s -&gt; Const r s
--   </pre>
--   
--   Since <tt>Const r</tt> is a functor, <a>SimpleGetter</a> has the same
--   shape as other lens types and can be composed with them. To get <tt>(s
--   -&gt; a)</tt> out of a <a>SimpleGetter</a>, choose <tt>r ~ a</tt> and
--   feed <tt>Const :: a -&gt; Const a a</tt> to the getter:
--   
--   <pre>
--   -- the actual signature is more permissive:
--   -- <a>view</a> :: <a>Getting</a> a s a -&gt; s -&gt; a
--   <a>view</a> :: <a>SimpleGetter</a> s a -&gt; s -&gt; a
--   <a>view</a> getter = <a>getConst</a> . getter <a>Const</a>
--   </pre>
--   
--   The actual <tt><a>Getter</a></tt> from lens is more general:
--   
--   <pre>
--   type Getter s a =
--     forall f. (Contravariant f, Functor f) =&gt; (a -&gt; f a) -&gt; s -&gt; f s
--   </pre>
--   
--   I'm not currently aware of any functions that take lens's
--   <tt>Getter</tt> but won't accept <a>SimpleGetter</a>, but you should
--   try to avoid exporting <a>SimpleGetter</a>s anyway to minimise
--   confusion. Alternatively, look at <a>microlens-contra</a>, which
--   provides a fully lens-compatible <tt>Getter</tt>.
--   
--   Lens users: you can convert a <a>SimpleGetter</a> to <tt>Getter</tt>
--   by applying <tt>to . view</tt> to it.
type SimpleGetter s a = forall r. () => Getting r s a

-- | Functions that operate on getters and folds – such as (<a>^.</a>),
--   (<a>^..</a>), (<a>^?</a>) – use <tt>Getter r s a</tt> (with different
--   values of <tt>r</tt>) to describe what kind of result they need. For
--   instance, (<a>^.</a>) needs the getter to be able to return a single
--   value, and so it accepts a getter of type <tt>Getting a s a</tt>.
--   (<a>^..</a>) wants the getter to gather values together, so it uses
--   <tt>Getting (Endo [a]) s a</tt> (it could've used <tt>Getting [a] s
--   a</tt> instead, but it's faster with <a>Endo</a>). The choice of
--   <tt>r</tt> depends on what you want to do with elements you're
--   extracting from <tt>s</tt>.
type Getting r s a = a -> Const r a -> s -> Const r s

-- | <tt>Lens s t a b</tt> is the lowest common denominator of a setter and
--   a getter, something that has the power of both; it has a
--   <a>Functor</a> constraint, and since both <a>Const</a> and
--   <a>Identity</a> are functors, it can be used whenever a getter or a
--   setter is needed.
--   
--   <ul>
--   <li><tt>a</tt> is the type of the value inside of structure</li>
--   <li><tt>b</tt> is the type of the replaced value</li>
--   <li><tt>s</tt> is the type of the whole structure</li>
--   <li><tt>t</tt> is the type of the structure after replacing <tt>a</tt>
--   in it with <tt>b</tt></li>
--   </ul>
type Lens s t a b = forall (f :: Type -> Type). Functor f => a -> f b -> s -> f t

-- | This is a type alias for monomorphic lenses which don't change the
--   type of the container (or of the value inside).
type Lens' s a = Lens s s a a

-- | Retrieves a function of the current environment.
asks :: MonadReader r m => (r -> a) -> m a

-- | See examples in <a>Control.Monad.Reader</a>. Note, the partially
--   applied function type <tt>(-&gt;) r</tt> is a simple reader monad. See
--   the <tt>instance</tt> declaration below.
class Monad m => MonadReader r (m :: Type -> Type) | m -> r

-- | Retrieves the monad environment.
ask :: MonadReader r m => m r

-- | Executes a computation in a modified environment.
local :: MonadReader r m => (r -> r) -> m a -> m a

-- | The parameterizable reader monad.
--   
--   Computations are functions of a shared environment.
--   
--   The <a>return</a> function ignores the environment, while
--   <tt>&gt;&gt;=</tt> passes the inherited environment to both
--   subcomputations.
type Reader r = ReaderT r Identity

-- | Runs a <tt>Reader</tt> and extracts the final value from it. (The
--   inverse of <a>reader</a>.)
runReader :: () => Reader r a -> r -> a

-- | An absolute path.
data Abs

-- | A relative path; one without a root. Note that a <tt>..</tt> path
--   component to represent the parent directory is not allowed by this
--   library.
data Rel

-- | A file path.
data File

-- | A directory path.
data Dir

-- | Convert to a <a>FilePath</a> type.
--   
--   All directories have a trailing slash, so if you want no trailing
--   slash, you can use <a>dropTrailingPathSeparator</a> from the filepath
--   package.
toFilePath :: () => Path b t -> FilePath

-- | Path of some base and type.
--   
--   The type variables are:
--   
--   <ul>
--   <li><tt>b</tt> — base, the base location of the path; absolute or
--   relative.</li>
--   <li><tt>t</tt> — type, whether file or directory.</li>
--   </ul>
--   
--   Internally is a string. The string can be of two formats only:
--   
--   <ol>
--   <li>File format: <tt>file.txt</tt>, <tt>foo/bar.txt</tt>,
--   <tt>/foo/bar.txt</tt></li>
--   <li>Directory format: <tt>foo/</tt>, <tt>/foo/bar/</tt></li>
--   </ol>
--   
--   All directories end in a trailing separator. There are no duplicate
--   path separators <tt>//</tt>, no <tt>..</tt>, no <tt>./</tt>, no
--   <tt>~/</tt>, etc.
data Path b t

-- | Lifted <a>newChan</a>.
newChan :: MonadIO m => m (Chan a)

-- | Lifted <a>writeChan</a>.
writeChan :: MonadIO m => Chan a -> a -> m ()

-- | Lifted <a>readChan</a>.
readChan :: MonadIO m => Chan a -> m a

-- | Lifted <a>dupChan</a>.
dupChan :: MonadIO m => Chan a -> m (Chan a)

-- | Lifted <a>getChanContents</a>.
getChanContents :: MonadIO m => Chan a -> m [a]

-- | Lifted <a>writeList2Chan</a>.
writeList2Chan :: MonadIO m => Chan a -> [a] -> m ()

-- | Exception type thrown by <a>throwString</a>.
--   
--   Note that the second field of the data constructor depends on GHC/base
--   version. For base 4.9 and GHC 8.0 and later, the second field is a
--   call stack. Previous versions of GHC and base do not support call
--   stacks, and the field is simply unit (provided to make pattern
--   matching across GHC versions easier).
data StringException
StringException :: String -> CallStack -> StringException

-- | Wrap up a synchronous exception to be treated as an asynchronous
--   exception.
--   
--   This is intended to be created via <a>toAsyncException</a>.
data AsyncExceptionWrapper
[AsyncExceptionWrapper] :: forall e. Exception e => e -> AsyncExceptionWrapper

-- | Wrap up an asynchronous exception to be treated as a synchronous
--   exception.
--   
--   This is intended to be created via <a>toSyncException</a>.
data SyncExceptionWrapper
[SyncExceptionWrapper] :: forall e. Exception e => e -> SyncExceptionWrapper

-- | Generalized version of <a>Handler</a>.
data Handler (m :: Type -> Type) a
[Handler] :: forall (m :: Type -> Type) a e. Exception e => (e -> m a) -> Handler m a

-- | Unlifted <a>catch</a>, but will not catch asynchronous exceptions.
catch :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a

-- | <a>catch</a> specialized to only catching <a>IOException</a>s.
catchIO :: MonadUnliftIO m => m a -> (IOException -> m a) -> m a

-- | <a>catch</a> specialized to catch all synchronous exception.
catchAny :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a

-- | Same as <a>catch</a>, but fully force evaluation of the result value
--   to find all impure exceptions.
catchDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> (e -> m a) -> m a

-- | <a>catchDeep</a> specialized to catch all synchronous exception.
catchAnyDeep :: (NFData a, MonadUnliftIO m) => m a -> (SomeException -> m a) -> m a

-- | <a>catchJust</a> is like <a>catch</a> but it takes an extra argument
--   which is an exception predicate, a function which selects which type
--   of exceptions we're interested in.
catchJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> (b -> m a) -> m a

-- | Flipped version of <a>catch</a>.
handle :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a

-- | <a>handle</a> specialized to only catching <a>IOException</a>s.
handleIO :: MonadUnliftIO m => (IOException -> m a) -> m a -> m a

-- | Flipped version of <a>catchAny</a>.
handleAny :: MonadUnliftIO m => (SomeException -> m a) -> m a -> m a

-- | Flipped version of <a>catchDeep</a>.
handleDeep :: (MonadUnliftIO m, Exception e, NFData a) => (e -> m a) -> m a -> m a

-- | Flipped version of <a>catchAnyDeep</a>.
handleAnyDeep :: (MonadUnliftIO m, NFData a) => (SomeException -> m a) -> m a -> m a

-- | Flipped <a>catchJust</a>.
handleJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a

-- | Unlifted <a>try</a>, but will not catch asynchronous exceptions.
try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a)

-- | <a>try</a> specialized to only catching <a>IOException</a>s.
tryIO :: MonadUnliftIO m => m a -> m (Either IOException a)

-- | <a>try</a> specialized to catch all synchronous exceptions.
tryAny :: MonadUnliftIO m => m a -> m (Either SomeException a)

-- | Same as <a>try</a>, but fully force evaluation of the result value to
--   find all impure exceptions.
tryDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> m (Either e a)

-- | <a>tryDeep</a> specialized to catch all synchronous exceptions.
tryAnyDeep :: (MonadUnliftIO m, NFData a) => m a -> m (Either SomeException a)

-- | A variant of <a>try</a> that takes an exception predicate to select
--   which exceptions are caught.
tryJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> m a -> m (Either b a)

-- | Evaluate the value to WHNF and catch any synchronous exceptions.
--   
--   The expression may still have bottom values within it; you may instead
--   want to use <a>pureTryDeep</a>.
pureTry :: () => a -> Either SomeException a

-- | Evaluate the value to NF and catch any synchronous exceptions.
pureTryDeep :: NFData a => a -> Either SomeException a

-- | Same as upstream <a>catches</a>, but will not catch asynchronous
--   exceptions.
catches :: MonadUnliftIO m => m a -> [Handler m a] -> m a

-- | Same as <a>catches</a>, but fully force evaluation of the result value
--   to find all impure exceptions.
catchesDeep :: (MonadUnliftIO m, NFData a) => m a -> [Handler m a] -> m a

-- | Lifted version of <a>evaluate</a>.
evaluate :: MonadIO m => a -> m a

-- | Deeply evaluate a value using <a>evaluate</a> and <a>NFData</a>.
evaluateDeep :: (MonadIO m, NFData a) => a -> m a

-- | Async safe version of <a>bracket</a>.
bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c

-- | Async safe version of <a>bracket_</a>.
bracket_ :: MonadUnliftIO m => m a -> m b -> m c -> m c

-- | Async safe version of <a>bracketOnError</a>.
bracketOnError :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c

-- | A variant of <a>bracketOnError</a> where the return value from the
--   first computation is not required.
bracketOnError_ :: MonadUnliftIO m => m a -> m b -> m c -> m c

-- | Async safe version of <a>finally</a>.
finally :: MonadUnliftIO m => m a -> m b -> m a

-- | Like <a>onException</a>, but provides the handler the thrown
--   exception.
withException :: (MonadUnliftIO m, Exception e) => m a -> (e -> m b) -> m a

-- | Async safe version of <a>onException</a>.
onException :: MonadUnliftIO m => m a -> m b -> m a

-- | Synchronously throw the given exception.
throwIO :: (MonadIO m, Exception e) => e -> m a

-- | Convert an exception into a synchronous exception.
--   
--   For synchronous exceptions, this is the same as <a>toException</a>.
--   For asynchronous exceptions, this will wrap up the exception with
--   <a>SyncExceptionWrapper</a>.
toSyncException :: Exception e => e -> SomeException

-- | Convert an exception into an asynchronous exception.
--   
--   For asynchronous exceptions, this is the same as <a>toException</a>.
--   For synchronous exceptions, this will wrap up the exception with
--   <a>AsyncExceptionWrapper</a>.
toAsyncException :: Exception e => e -> SomeException

-- | Check if the given exception is synchronous.
isSyncException :: Exception e => e -> Bool

-- | Check if the given exception is asynchronous.
isAsyncException :: Exception e => e -> Bool

-- | Unlifted version of <a>mask</a>.
mask :: MonadUnliftIO m => ((forall a. () => m a -> m a) -> m b) -> m b

-- | Unlifted version of <a>uninterruptibleMask</a>.
uninterruptibleMask :: MonadUnliftIO m => ((forall a. () => m a -> m a) -> m b) -> m b

-- | Unlifted version of <a>mask_</a>.
mask_ :: MonadUnliftIO m => m a -> m a

-- | Unlifted version of <a>uninterruptibleMask_</a>.
uninterruptibleMask_ :: MonadUnliftIO m => m a -> m a

-- | A convenience function for throwing a user error. This is useful for
--   cases where it would be too high a burden to define your own exception
--   type.
--   
--   This throws an exception of type <a>StringException</a>. When GHC
--   supports it (base 4.9 and GHC 8.0 and onward), it includes a call
--   stack.
throwString :: (MonadIO m, HasCallStack) => String -> m a

-- | Smart constructor for a <a>StringException</a> that deals with the
--   call stack.
stringException :: HasCallStack -> String -> StringException

-- | Throw an asynchronous exception to another thread.
--   
--   Synchronously typed exceptions will be wrapped into an
--   <a>AsyncExceptionWrapper</a>, see
--   <a>https://github.com/fpco/safe-exceptions#determining-sync-vs-async</a>.
--   
--   It's usually a better idea to use the <a>UnliftIO.Async</a> module,
--   see <a>https://github.com/fpco/safe-exceptions#quickstart</a>.
throwTo :: (Exception e, MonadIO m) => ThreadId -> e -> m ()

-- | Generate a pure value which, when forced, will synchronously throw the
--   given exception.
--   
--   Generally it's better to avoid using this function and instead use
--   <a>throwIO</a>, see
--   <a>https://github.com/fpco/safe-exceptions#quickstart</a>.
impureThrow :: Exception e => e -> a

-- | Unwrap an <a>Either</a> value, throwing its <a>Left</a> value as a
--   runtime exception via <a>throwIO</a> if present.
fromEither :: (Exception e, MonadIO m) => Either e a -> m a

-- | Same as <a>fromEither</a>, but works on an <a>IO</a>-wrapped
--   <a>Either</a>.
fromEitherIO :: (Exception e, MonadIO m) => IO (Either e a) -> m a

-- | Same as <a>fromEither</a>, but works on an <tt>m</tt>-wrapped
--   <a>Either</a>.
fromEitherM :: (Exception e, MonadIO m) => m (Either e a) -> m a

-- | Unlifted version of <a>withFile</a>.
withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

-- | Unlifted version of <a>withBinaryFile</a>.
withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

-- | Lifted version of <a>hClose</a>
hClose :: MonadIO m => Handle -> m ()

-- | Lifted version of <a>hFlush</a>
hFlush :: MonadIO m => Handle -> m ()

-- | Lifted version of <a>hFileSize</a>
hFileSize :: MonadIO m => Handle -> m Integer

-- | Lifted version of <a>hSetFileSize</a>
hSetFileSize :: MonadIO m => Handle -> Integer -> m ()

-- | Lifted version of <a>hIsEOF</a>
hIsEOF :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hSetBuffering</a>
hSetBuffering :: MonadIO m => Handle -> BufferMode -> m ()

-- | Lifted version of <a>hGetBuffering</a>
hGetBuffering :: MonadIO m => Handle -> m BufferMode

-- | Lifted version of <a>hSeek</a>
hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> m ()

-- | Lifted version of <a>hTell</a>
hTell :: MonadIO m => Handle -> m Integer

-- | Lifted version of <a>hIsOpen</a>
hIsOpen :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hIsClosed</a>
hIsClosed :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hIsReadable</a>
hIsReadable :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hIsWritable</a>
hIsWritable :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hIsSeekable</a>
hIsSeekable :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hIsTerminalDevice</a>
hIsTerminalDevice :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hSetEcho</a>
hSetEcho :: MonadIO m => Handle -> Bool -> m ()

-- | Lifted version of <a>hGetEcho</a>
hGetEcho :: MonadIO m => Handle -> m Bool

-- | Lifted version of <a>hWaitForInput</a>
hWaitForInput :: MonadIO m => Handle -> Int -> m Bool

-- | Lifted version of <a>hReady</a>
hReady :: MonadIO m => Handle -> m Bool

-- | Get the number of seconds which have passed since an arbitrary
--   starting time, useful for calculating runtime in a program.
getMonotonicTime :: MonadIO m => m Double

-- | Lifted <a>newIORef</a>.
newIORef :: MonadIO m => a -> m (IORef a)

-- | Lifted <a>readIORef</a>.
readIORef :: MonadIO m => IORef a -> m a

-- | Lifted <a>writeIORef</a>.
writeIORef :: MonadIO m => IORef a -> a -> m ()

-- | Lifted <a>modifyIORef</a>.
modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m ()

-- | Lifted <a>modifyIORef'</a>.
modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m ()

-- | Lifted <a>atomicModifyIORef</a>.
atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b

-- | Lifted <a>atomicModifyIORef'</a>.
atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b

-- | Lifted <a>atomicWriteIORef</a>.
atomicWriteIORef :: MonadIO m => IORef a -> a -> m ()

-- | Unlifted <a>mkWeakIORef</a>.
mkWeakIORef :: MonadUnliftIO m => IORef a -> m () -> m (Weak (IORef a))

-- | Things that can go wrong in the structure of a <a>Conc</a>. These are
--   <i>programmer errors</i>.
data ConcException
EmptyWithNoAlternative :: ConcException

-- | A more efficient alternative to <a>Concurrently</a>, which reduces the
--   number of threads that need to be forked. For more information, see
--   <tt>FIXME link to blog post</tt>. This is provided as a separate type
--   to <tt>Concurrently</tt> as it has a slightly different API.
--   
--   Use the <a>conc</a> function to construct values of type <a>Conc</a>,
--   and <a>runConc</a> to execute the composed actions. You can use the
--   <tt>Applicative</tt> instance to run different actions and wait for
--   all of them to complete, or the <tt>Alternative</tt> instance to wait
--   for the first thread to complete.
--   
--   In the event of a runtime exception thrown by any of the children
--   threads, or an asynchronous exception received in the parent thread,
--   all threads will be killed with an <a>AsyncCancelled</a> exception and
--   the original exception rethrown. If multiple exceptions are generated
--   by different threads, there are no guarantees on which exception will
--   end up getting rethrown.
--   
--   For many common use cases, you may prefer using helper functions in
--   this module like <a>mapConcurrently</a>.
--   
--   There are some intentional differences in behavior to
--   <tt>Concurrently</tt>:
--   
--   <ul>
--   <li>Children threads are always launched in an unmasked state, not the
--   inherited state of the parent thread.</li>
--   </ul>
--   
--   Note that it is a programmer error to use the <tt>Alternative</tt>
--   instance in such a way that there are no alternatives to an empty,
--   e.g. <tt>runConc (empty <a>|</a> empty)</tt>. In such a case, a
--   <a>ConcException</a> will be thrown. If there was an
--   <tt>Alternative</tt> in the standard libraries without <tt>empty</tt>,
--   this library would use it instead.
data Conc (m :: Type -> Type) a

-- | Unlifted <a>Concurrently</a>.
newtype Concurrently (m :: Type -> Type) a
Concurrently :: m a -> Concurrently a
[runConcurrently] :: Concurrently a -> m a

-- | Unlifted <a>async</a>.
async :: MonadUnliftIO m => m a -> m (Async a)

-- | Unlifted <a>asyncBound</a>.
asyncBound :: MonadUnliftIO m => m a -> m (Async a)

-- | Unlifted <a>asyncOn</a>.
asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a)

-- | Unlifted <a>asyncWithUnmask</a>.
asyncWithUnmask :: MonadUnliftIO m => ((forall b. () => m b -> m b) -> m a) -> m (Async a)

-- | Unlifted <a>asyncOnWithUnmask</a>.
asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. () => m b -> m b) -> m a) -> m (Async a)

-- | Unlifted <a>withAsync</a>.
withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b

-- | Unlifted <a>withAsyncBound</a>.
withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b

-- | Unlifted <a>withAsyncOn</a>.
withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b

-- | Unlifted <a>withAsyncWithUnmask</a>.
withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. () => m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Unlifted <a>withAsyncOnWithMask</a>.
withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. () => m c -> m c) -> m a) -> (Async a -> m b) -> m b

-- | Lifted <a>wait</a>.
wait :: MonadIO m => Async a -> m a

-- | Lifted <a>poll</a>.
poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a))

-- | Lifted <a>waitCatch</a>.
waitCatch :: MonadIO m => Async a -> m (Either SomeException a)

-- | Lifted <a>cancel</a>.
cancel :: MonadIO m => Async a -> m ()

-- | Lifted <a>uninterruptibleCancel</a>.
uninterruptibleCancel :: MonadIO m => Async a -> m ()

-- | Lifted <a>cancelWith</a>. Additionally uses <a>toAsyncException</a> to
--   ensure async exception safety.
cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m ()

-- | Lifted <a>waitAny</a>.
waitAny :: MonadIO m => [Async a] -> m (Async a, a)

-- | Lifted <a>waitAnyCatch</a>.
waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)

-- | Lifted <a>waitAnyCancel</a>.
waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a)

-- | Lifted <a>waitAnyCatchCancel</a>.
waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a)

-- | Lifted <a>waitEither</a>.
waitEither :: MonadIO m => Async a -> Async b -> m (Either a b)

-- | Lifted <a>waitEitherCatch</a>.
waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Lifted <a>waitEitherCancel</a>.
waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b)

-- | Lifted <a>waitEitherCatchCancel</a>.
waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b))

-- | Lifted <a>waitEither_</a>.
waitEither_ :: MonadIO m => Async a -> Async b -> m ()

-- | Lifted <a>waitBoth</a>.
waitBoth :: MonadIO m => Async a -> Async b -> m (a, b)

-- | Lifted <a>link</a>.
link :: MonadIO m => Async a -> m ()

-- | Lifted <a>link2</a>.
link2 :: MonadIO m => Async a -> Async b -> m ()

-- | Unlifted <a>race</a>.
race :: MonadUnliftIO m => m a -> m b -> m (Either a b)

-- | Unlifted <a>race_</a>.
race_ :: MonadUnliftIO m => m a -> m b -> m ()

-- | Unlifted <a>concurrently</a>.
concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b)

-- | Unlifted <a>concurrently_</a>.
concurrently_ :: MonadUnliftIO m => m a -> m b -> m ()

-- | Similar to <a>mapConcurrently</a> but with arguments flipped
forConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b)

-- | Similar to <a>mapConcurrently_</a> but with arguments flipped
forConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m ()

-- | Unlifted <a>replicateConcurrently</a>.
replicateConcurrently :: MonadUnliftIO m => Int -> m b -> m [b]

-- | Unlifted <a>replicateConcurrently_</a>.
replicateConcurrently_ :: (Applicative m, MonadUnliftIO m) => Int -> m a -> m ()

-- | Executes a <a>Traversable</a> container of items concurrently, it uses
--   the <a>Flat</a> type internally.
mapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b)

-- | Executes a <a>Traversable</a> container of items concurrently, it uses
--   the <a>Flat</a> type internally. This function ignores the results.
mapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m ()

-- | Construct a value of type <a>Conc</a> from an action. Compose these
--   values using the typeclass instances (most commonly <a>Applicative</a>
--   and <a>Alternative</a>) and then run with <a>runConc</a>.
conc :: () => m a -> Conc m a

-- | Run a <a>Conc</a> value on multiple threads.
runConc :: MonadUnliftIO m => Conc m a -> m a

-- | Like <a>mapConcurrently</a> from async, but instead of one thread per
--   element, it does pooling from a set of threads. This is useful in
--   scenarios where resource consumption is bounded and for use cases
--   where too many concurrent tasks aren't allowed.
--   
--   <h3><b>Example usage</b></h3>
--   
--   <pre>
--   import Say
--   
--   action :: Int -&gt; IO Int
--   action n = do
--     tid &lt;- myThreadId
--     sayString $ show tid
--     threadDelay (2 * 10^6) -- 2 seconds
--     return n
--   
--   main :: IO ()
--   main = do
--     yx &lt;- pooledMapConcurrentlyN 5 (\x -&gt; action x) [1..5]
--     print yx
--   </pre>
--   
--   On executing you can see that five threads have been spawned:
--   
--   <pre>
--   $ ./pool
--   ThreadId 36
--   ThreadId 38
--   ThreadId 40
--   ThreadId 42
--   ThreadId 44
--   [1,2,3,4,5]
--   </pre>
--   
--   Let's modify the above program such that there are less threads than
--   the number of items in the list:
--   
--   <pre>
--   import Say
--   
--   action :: Int -&gt; IO Int
--   action n = do
--     tid &lt;- myThreadId
--     sayString $ show tid
--     threadDelay (2 * 10^6) -- 2 seconds
--     return n
--   
--   main :: IO ()
--   main = do
--     yx &lt;- pooledMapConcurrentlyN 3 (\x -&gt; action x) [1..5]
--     print yx
--   </pre>
--   
--   On executing you can see that only three threads are active totally:
--   
--   <pre>
--   $ ./pool
--   ThreadId 35
--   ThreadId 37
--   ThreadId 39
--   ThreadId 35
--   ThreadId 39
--   [1,2,3,4,5]
--   </pre>
pooledMapConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> (a -> m b) -> t a -> m (t b)

-- | Similar to <a>pooledMapConcurrentlyN</a> but with number of threads
--   set from <a>getNumCapabilities</a>. Usually this is useful for CPU
--   bound tasks.
pooledMapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b)

-- | Similar to <a>pooledMapConcurrentlyN</a> but with flipped arguments.
pooledForConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> t a -> (a -> m b) -> m (t b)

-- | Similar to <a>pooledForConcurrentlyN</a> but with number of threads
--   set from <a>getNumCapabilities</a>. Usually this is useful for CPU
--   bound tasks.
pooledForConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b)

-- | Like <a>pooledMapConcurrentlyN</a> but with the return value
--   discarded.
pooledMapConcurrentlyN_ :: (MonadUnliftIO m, Foldable f) => Int -> (a -> m b) -> f a -> m ()

-- | Like <a>pooledMapConcurrently</a> but with the return value discarded.
pooledMapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m ()

-- | Like <a>pooledMapConcurrently_</a> but with flipped arguments.
pooledForConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m ()

-- | Like <a>pooledMapConcurrentlyN_</a> but with flipped arguments.
pooledForConcurrentlyN_ :: (MonadUnliftIO m, Foldable t) => Int -> t a -> (a -> m b) -> m ()

-- | Pooled version of <a>replicateConcurrently</a>. Performs the action in
--   the pooled threads.
pooledReplicateConcurrentlyN :: MonadUnliftIO m => Int -> Int -> m a -> m [a]

-- | Similar to <a>pooledReplicateConcurrentlyN</a> but with number of
--   threads set from <a>getNumCapabilities</a>. Usually this is useful for
--   CPU bound tasks.
pooledReplicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a]

-- | Pooled version of <a>replicateConcurrently_</a>. Performs the action
--   in the pooled threads.
pooledReplicateConcurrentlyN_ :: MonadUnliftIO m => Int -> Int -> m a -> m ()

-- | Similar to <a>pooledReplicateConcurrently_</a> but with number of
--   threads set from <a>getNumCapabilities</a>. Usually this is useful for
--   CPU bound tasks.
pooledReplicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m ()

-- | Lifted <a>newEmptyMVar</a>.
newEmptyMVar :: MonadIO m => m (MVar a)

-- | Lifted <a>newMVar</a>.
newMVar :: MonadIO m => a -> m (MVar a)

-- | Lifted <a>takeMVar</a>.
takeMVar :: MonadIO m => MVar a -> m a

-- | Lifted <a>putMVar</a>.
putMVar :: MonadIO m => MVar a -> a -> m ()

-- | Lifted <a>readMVar</a>.
readMVar :: MonadIO m => MVar a -> m a

-- | Lifted <a>swapMVar</a>.
swapMVar :: MonadIO m => MVar a -> a -> m a

-- | Lifted <a>tryTakeMVar</a>.
tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a)

-- | Lifted <a>tryPutMVar</a>.
tryPutMVar :: MonadIO m => MVar a -> a -> m Bool

-- | Lifted <a>isEmptyMVar</a>.
isEmptyMVar :: MonadIO m => MVar a -> m Bool

-- | Lifted <a>tryReadMVar</a>.
tryReadMVar :: MonadIO m => MVar a -> m (Maybe a)

-- | Unlifted <a>withMVar</a>.
withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b

-- | Unlifted <a>withMVarMasked</a>.
withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b

-- | Unlifted <a>modifyMVar_</a>.
modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()

-- | Unlifted <a>modifyMVar</a>.
modifyMVar :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b

-- | Unlifted <a>modifyMVarMasked_</a>.
modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m ()

-- | Unlifted <a>modifyMVarMasked</a>.
modifyMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b

-- | Unlifted <a>mkWeakMVar</a>.
mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a))

-- | A "run once" value, with results saved. Extract the value with
--   <a>runMemoized</a>. For single-threaded usage, you can use
--   <a>memoizeRef</a> to create a value. If you need guarantees that only
--   one thread will run the action at a time, use <a>memoizeMVar</a>.
--   
--   Note that this type provides a <a>Show</a> instance for convenience,
--   but not useful information can be provided.
data Memoized a

-- | Extract a value from a <a>Memoized</a>, running an action if no cached
--   value is available.
runMemoized :: MonadIO m => Memoized a -> m a

-- | Create a new <a>Memoized</a> value using an <a>IORef</a> under the
--   surface. Note that the action may be run in multiple threads
--   simultaneously, so this may not be thread safe (depending on the
--   underlying action). Consider using <a>memoizeMVar</a>.
memoizeRef :: MonadUnliftIO m => m a -> m (Memoized a)

-- | Same as <a>memoizeRef</a>, but uses an <a>MVar</a> to ensure that an
--   action is only run once, even in a multithreaded application.
memoizeMVar :: MonadUnliftIO m => m a -> m (Memoized a)

-- | Lifted version of <a>atomically</a>
atomically :: MonadIO m => STM a -> m a

-- | Renamed <a>retry</a> for unqualified export
retrySTM :: () => STM a

-- | Renamed <a>check</a> for unqualified export
checkSTM :: Bool -> STM ()

-- | Lifted version of <a>newTVarIO</a>
newTVarIO :: MonadIO m => a -> m (TVar a)

-- | Lifted version of <a>readTVarIO</a>
readTVarIO :: MonadIO m => TVar a -> m a

-- | Lifted version of <a>registerDelay</a>
registerDelay :: MonadIO m => Int -> m (TVar Bool)

-- | Lifted version of <a>mkWeakTVar</a>
mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a))

-- | Lifted version of <a>newTMVarIO</a>
newTMVarIO :: MonadIO m => a -> m (TMVar a)

-- | Lifted version of <a>newEmptyTMVarIO</a>
newEmptyTMVarIO :: MonadIO m => m (TMVar a)

-- | Lifted version of <a>mkWeakTMVar</a>
mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a))

-- | Lifted version of <a>newTChanIO</a>
newTChanIO :: MonadIO m => m (TChan a)

-- | Lifted version of <a>newBroadcastTChanIO</a>
newBroadcastTChanIO :: MonadIO m => m (TChan a)

-- | Lifted version of <a>newTQueueIO</a>
newTQueueIO :: MonadIO m => m (TQueue a)

-- | Lifted version of <a>newTBQueueIO</a>
newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a)

-- | Create and use a temporary file in the system standard temporary
--   directory.
--   
--   Behaves exactly the same as <a>withTempFile</a>, except that the
--   parent temporary directory will be that returned by
--   <a>getCanonicalTemporaryDirectory</a>.
withSystemTempFile :: MonadUnliftIO m => String -> (FilePath -> Handle -> m a) -> m a

-- | Create and use a temporary directory in the system standard temporary
--   directory.
--   
--   Behaves exactly the same as <a>withTempDirectory</a>, except that the
--   parent temporary directory will be that returned by
--   <a>getCanonicalTemporaryDirectory</a>.
withSystemTempDirectory :: MonadUnliftIO m => String -> (FilePath -> m a) -> m a

-- | Use a temporary filename that doesn't already exist.
--   
--   Creates a new temporary file inside the given directory, making use of
--   the template. The temp file is deleted after use. For example:
--   
--   <pre>
--   withTempFile "src" "sdist." $ \tmpFile hFile -&gt; do ...
--   </pre>
--   
--   The <tt>tmpFile</tt> will be file in the given directory, e.g.
--   <tt>src/sdist.342</tt>.
withTempFile :: MonadUnliftIO m => FilePath -> String -> (FilePath -> Handle -> m a) -> m a

-- | Create and use a temporary directory.
--   
--   Creates a new temporary directory inside the given directory, making
--   use of the template. The temp directory is deleted after use. For
--   example:
--   
--   <pre>
--   withTempDirectory "src" "sdist." $ \tmpDir -&gt; do ...
--   </pre>
--   
--   The <tt>tmpDir</tt> will be a new subdirectory of the given directory,
--   e.g. <tt>src/sdist.342</tt>.
withTempDirectory :: MonadUnliftIO m => FilePath -> String -> (FilePath -> m a) -> m a

-- | Unlifted <a>timeout</a>.
timeout :: MonadUnliftIO m => Int -> m a -> m (Maybe a)

-- | A helper function for implementing <tt>MonadUnliftIO</tt> instances.
--   Useful for the common case where you want to simply delegate to the
--   underlying transformer.
--   
--   <h4><b>Example</b></h4>
--   
--   <pre>
--   newtype AppT m a = AppT { unAppT :: ReaderT Int (ResourceT m) a }
--     deriving (Functor, Applicative, Monad, MonadIO)
--     -- Unfortunately, deriving MonadUnliftIO does not work.
--   
--   instance MonadUnliftIO m =&gt; MonadUnliftIO (AppT m) where
--     withRunInIO = wrappedWithRunInIO AppT unAppT
--   </pre>
wrappedWithRunInIO :: MonadUnliftIO n => (n b -> m b) -> (forall a. () => m a -> n a) -> ((forall a. () => m a -> IO a) -> IO b) -> m b

-- | Convert an action in <tt>m</tt> to an action in <tt>IO</tt>.
toIO :: MonadUnliftIO m => m a -> m (IO a)

-- | Convenience function for capturing the monadic context and running an
--   <a>IO</a> action. The <a>UnliftIO</a> newtype wrapper is rarely
--   needed, so prefer <a>withRunInIO</a> to this function.
withUnliftIO :: MonadUnliftIO m => (UnliftIO m -> IO a) -> m a

-- | Same as <a>askUnliftIO</a>, but returns a monomorphic function instead
--   of a polymorphic newtype wrapper. If you only need to apply the
--   transformation on one concrete type, this function can be more
--   convenient.
askRunInIO :: MonadUnliftIO m => m (m a -> IO a)

-- | The ability to run any monadic action <tt>m a</tt> as <tt>IO a</tt>.
--   
--   This is more precisely a natural transformation. We need to new
--   datatype (instead of simply using a <tt>forall</tt>) due to lack of
--   support in GHC for impredicative types.
newtype UnliftIO (m :: Type -> Type)
UnliftIO :: (forall a. () => m a -> IO a) -> UnliftIO
[unliftIO] :: UnliftIO -> forall a. () => m a -> IO a

-- | <a>TBQueue</a> is an abstract type representing a bounded FIFO
--   channel.
data TBQueue a

-- | Builds and returns a new instance of <a>TBQueue</a>.
newTBQueue :: () => Natural -> STM (TBQueue a)

-- | Write a value to a <a>TBQueue</a>; blocks if the queue is full.
writeTBQueue :: () => TBQueue a -> a -> STM ()

-- | Read the next value from the <a>TBQueue</a>.
readTBQueue :: () => TBQueue a -> STM a

-- | A version of <a>readTBQueue</a> which does not retry. Instead it
--   returns <tt>Nothing</tt> if no value is available.
tryReadTBQueue :: () => TBQueue a -> STM (Maybe a)

-- | Get the next value from the <tt>TBQueue</tt> without removing it,
--   retrying if the channel is empty.
peekTBQueue :: () => TBQueue a -> STM a

-- | A version of <a>peekTBQueue</a> which does not retry. Instead it
--   returns <tt>Nothing</tt> if no value is available.
tryPeekTBQueue :: () => TBQueue a -> STM (Maybe a)

-- | Put a data item back onto a channel, where it will be the next item
--   read. Blocks if the queue is full.
unGetTBQueue :: () => TBQueue a -> a -> STM ()

-- | Returns <a>True</a> if the supplied <a>TBQueue</a> is empty.
isEmptyTBQueue :: () => TBQueue a -> STM Bool

-- | Returns <a>True</a> if the supplied <a>TBQueue</a> is full.
isFullTBQueue :: () => TBQueue a -> STM Bool

-- | <a>TChan</a> is an abstract type representing an unbounded FIFO
--   channel.
data TChan a

-- | Build and return a new instance of <a>TChan</a>
newTChan :: () => STM (TChan a)

-- | Create a write-only <a>TChan</a>. More precisely, <a>readTChan</a>
--   will <a>retry</a> even after items have been written to the channel.
--   The only way to read a broadcast channel is to duplicate it with
--   <a>dupTChan</a>.
--   
--   Consider a server that broadcasts messages to clients:
--   
--   <pre>
--   serve :: TChan Message -&gt; Client -&gt; IO loop
--   serve broadcastChan client = do
--       myChan &lt;- dupTChan broadcastChan
--       forever $ do
--           message &lt;- readTChan myChan
--           send client message
--   </pre>
--   
--   The problem with using <a>newTChan</a> to create the broadcast channel
--   is that if it is only written to and never read, items will pile up in
--   memory. By using <a>newBroadcastTChan</a> to create the broadcast
--   channel, items can be garbage collected after clients have seen them.
newBroadcastTChan :: () => STM (TChan a)

-- | Write a value to a <a>TChan</a>.
writeTChan :: () => TChan a -> a -> STM ()

-- | Read the next value from the <a>TChan</a>.
readTChan :: () => TChan a -> STM a

-- | A version of <a>readTChan</a> which does not retry. Instead it returns
--   <tt>Nothing</tt> if no value is available.
tryReadTChan :: () => TChan a -> STM (Maybe a)

-- | Get the next value from the <tt>TChan</tt> without removing it,
--   retrying if the channel is empty.
peekTChan :: () => TChan a -> STM a

-- | A version of <a>peekTChan</a> which does not retry. Instead it returns
--   <tt>Nothing</tt> if no value is available.
tryPeekTChan :: () => TChan a -> STM (Maybe a)

-- | Duplicate a <a>TChan</a>: the duplicate channel begins empty, but data
--   written to either channel from then on will be available from both.
--   Hence this creates a kind of broadcast channel, where data written by
--   anyone is seen by everyone else.
dupTChan :: () => TChan a -> STM (TChan a)

-- | Put a data item back onto a channel, where it will be the next item
--   read.
unGetTChan :: () => TChan a -> a -> STM ()

-- | Returns <a>True</a> if the supplied <a>TChan</a> is empty.
isEmptyTChan :: () => TChan a -> STM Bool

-- | Clone a <a>TChan</a>: similar to dupTChan, but the cloned channel
--   starts with the same content available as the original channel.
cloneTChan :: () => TChan a -> STM (TChan a)

-- | A <a>TMVar</a> is a synchronising variable, used for communication
--   between concurrent threads. It can be thought of as a box, which may
--   be empty or full.
data TMVar a

-- | Create a <a>TMVar</a> which contains the supplied value.
newTMVar :: () => a -> STM (TMVar a)

-- | Create a <a>TMVar</a> which is initially empty.
newEmptyTMVar :: () => STM (TMVar a)

-- | Return the contents of the <a>TMVar</a>. If the <a>TMVar</a> is
--   currently empty, the transaction will <a>retry</a>. After a
--   <a>takeTMVar</a>, the <a>TMVar</a> is left empty.
takeTMVar :: () => TMVar a -> STM a

-- | A version of <a>takeTMVar</a> that does not <a>retry</a>. The
--   <a>tryTakeTMVar</a> function returns <a>Nothing</a> if the
--   <a>TMVar</a> was empty, or <tt><a>Just</a> a</tt> if the <a>TMVar</a>
--   was full with contents <tt>a</tt>. After <a>tryTakeTMVar</a>, the
--   <a>TMVar</a> is left empty.
tryTakeTMVar :: () => TMVar a -> STM (Maybe a)

-- | Put a value into a <a>TMVar</a>. If the <a>TMVar</a> is currently
--   full, <a>putTMVar</a> will <a>retry</a>.
putTMVar :: () => TMVar a -> a -> STM ()

-- | A version of <a>putTMVar</a> that does not <a>retry</a>. The
--   <a>tryPutTMVar</a> function attempts to put the value <tt>a</tt> into
--   the <a>TMVar</a>, returning <a>True</a> if it was successful, or
--   <a>False</a> otherwise.
tryPutTMVar :: () => TMVar a -> a -> STM Bool

-- | This is a combination of <a>takeTMVar</a> and <a>putTMVar</a>; ie. it
--   takes the value from the <a>TMVar</a>, puts it back, and also returns
--   it.
readTMVar :: () => TMVar a -> STM a

-- | A version of <a>readTMVar</a> which does not retry. Instead it returns
--   <tt>Nothing</tt> if no value is available.
tryReadTMVar :: () => TMVar a -> STM (Maybe a)

-- | Swap the contents of a <a>TMVar</a> for a new value.
swapTMVar :: () => TMVar a -> a -> STM a

-- | Check whether a given <a>TMVar</a> is empty.
isEmptyTMVar :: () => TMVar a -> STM Bool

-- | <a>TQueue</a> is an abstract type representing an unbounded FIFO
--   channel.
data TQueue a

-- | Build and returns a new instance of <a>TQueue</a>
newTQueue :: () => STM (TQueue a)

-- | Write a value to a <a>TQueue</a>.
writeTQueue :: () => TQueue a -> a -> STM ()

-- | Read the next value from the <a>TQueue</a>.
readTQueue :: () => TQueue a -> STM a

-- | A version of <a>readTQueue</a> which does not retry. Instead it
--   returns <tt>Nothing</tt> if no value is available.
tryReadTQueue :: () => TQueue a -> STM (Maybe a)

-- | Get the next value from the <tt>TQueue</tt> without removing it,
--   retrying if the channel is empty.
peekTQueue :: () => TQueue a -> STM a

-- | A version of <a>peekTQueue</a> which does not retry. Instead it
--   returns <tt>Nothing</tt> if no value is available.
tryPeekTQueue :: () => TQueue a -> STM (Maybe a)

-- | Put a data item back onto a channel, where it will be the next item
--   read.
unGetTQueue :: () => TQueue a -> a -> STM ()

-- | Returns <a>True</a> if the supplied <a>TQueue</a> is empty.
isEmptyTQueue :: () => TQueue a -> STM Bool

-- | Mutate the contents of a <a>TVar</a>. <i>N.B.</i>, this version is
--   non-strict.
modifyTVar :: () => TVar a -> (a -> a) -> STM ()

-- | Strict version of <a>modifyTVar</a>.
modifyTVar' :: () => TVar a -> (a -> a) -> STM ()

-- | Swap the contents of a <a>TVar</a> for a new value.
swapTVar :: () => TVar a -> a -> STM a

traceDisplayStack :: Display a => a -> b -> b

traceDisplayMarkerIO :: (Display a, MonadIO m) => a -> m ()

traceDisplayMarker :: Display a => a -> b -> b

traceDisplayEventIO :: (Display a, MonadIO m) => a -> m ()

traceDisplayEvent :: Display a => a -> b -> b

traceDisplayM :: (Display a, Applicative f) => a -> f ()

traceDisplayIO :: (Display a, MonadIO m) => a -> m ()

traceDisplayId :: Display a => a -> a

traceDisplay :: Display a => a -> b -> b

traceShowStack :: Show a => a -> b -> b

traceShowMarkerIO :: (Show a, MonadIO m) => a -> m ()

traceShowMarker :: Show a => a -> b -> b

traceShowEventIO :: (Show a, MonadIO m) => a -> m ()

traceShowEvent :: Show a => a -> b -> b

traceShowM :: (Show a, Applicative f) => a -> f ()

traceShowIO :: (Show a, MonadIO m) => a -> m ()

traceShowId :: Show a => a -> a

traceShow :: Show a => a -> b -> b

traceStack :: () => Text -> a -> a

traceMarkerIO :: MonadIO m => Text -> m ()

traceMarker :: () => Text -> a -> a

traceEventIO :: MonadIO m => Text -> m ()

traceEvent :: () => Text -> a -> a

traceM :: Applicative f => Text -> f ()

traceIO :: MonadIO m => Text -> m ()

traceId :: Text -> Text

trace :: () => Text -> a -> a

-- | Run with a default configured <tt>SimpleApp</tt>, consisting of:
--   
--   <ul>
--   <li>Logging to stderr</li>
--   <li>If the <tt>RIO_VERBOSE</tt> environment variable is set, turns on
--   verbose logging</li>
--   <li>Default process context</li>
--   </ul>
runSimpleApp :: MonadIO m => RIO SimpleApp a -> m a

-- | A simple, non-customizable environment type for <tt>RIO</tt>, which
--   provides common functionality. If it's insufficient for your needs,
--   define your own, custom <tt>App</tt> data type.
data SimpleApp

-- | create a new unboxed SomeRef
newUnboxedSomeRef :: (MonadIO m, Unbox a) => a -> m (SomeRef a)

-- | create a new boxed SomeRef
newSomeRef :: MonadIO m => a -> m (SomeRef a)

-- | Modify a SomeRef This function is subject to change due to the lack of
--   atomic operations
modifySomeRef :: MonadIO m => SomeRef a -> (a -> a) -> m ()

-- | Write to a SomeRef
writeSomeRef :: MonadIO m => SomeRef a -> a -> m ()

-- | Read from a SomeRef
readSomeRef :: MonadIO m => SomeRef a -> m a
liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a
runRIO :: MonadIO m => env -> RIO env a -> m a

-- | The Reader+IO monad. This is different from a <a>ReaderT</a> because:
--   
--   <ul>
--   <li>It's not a transformer, it hardcodes IO for simpler usage and
--   error messages.</li>
--   <li>Instances of typeclasses like <tt>MonadLogger</tt> are implemented
--   using classes defined on the environment, instead of using an
--   underlying monad.</li>
--   </ul>
newtype RIO env a
RIO :: ReaderT env IO a -> RIO env a
[unRIO] :: RIO env a -> ReaderT env IO a

-- | Abstraction over how to read from and write to a mutable reference
data SomeRef a

-- | Environment values with stateful capabilities to SomeRef
class HasStateRef s env | env -> s
stateRefL :: HasStateRef s env => Lens' env (SomeRef s)

-- | Environment values with writing capabilities to SomeRef
class HasWriteRef w env | env -> w
writeRefL :: HasWriteRef w env => Lens' env (SomeRef w)

-- | Modify a value in a <a>URef</a>. Note that this action is strict, and
--   will force evaluation of the result value.
modifyURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> (a -> a) -> m ()

-- | Write a value into a <a>URef</a>. Note that this action is strict, and
--   will force evalution of the value.
writeURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> a -> m ()

-- | Read the value in a <a>URef</a>
readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a

-- | Create a new <a>URef</a>
newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a)

-- | An unboxed reference. This works like an <a>IORef</a>, but the data is
--   stored in a bytearray instead of a heap object, avoiding significant
--   allocation overhead in some cases. For a concrete example, see this
--   Stack Overflow question:
--   <a>https://stackoverflow.com/questions/27261813/why-is-my-little-stref-int-require-allocating-gigabytes</a>.
--   
--   The first parameter is the state token type, the same as would be used
--   for the <tt>ST</tt> monad. If you're using an <a>IO</a>-based monad,
--   you can use the convenience <a>IOURef</a> type synonym instead.
data URef s a

-- | Helpful type synonym for using a <a>URef</a> from an <a>IO</a>-based
--   stack.
type IOURef = URef PrimState IO
decodeUtf8Lenient :: ByteString -> Text
tshow :: Show a => a -> Text

-- | Disable logging capabilities in a given sub-routine
--   
--   Intended to skip logging in general purpose implementations, where
--   secrets might be logged accidently.
noLogging :: (HasLogFunc env, MonadReader env m) => m a -> m a

-- | Is the log func configured to use color output?
--   
--   Intended for use by code which wants to optionally add additional
--   color to its log messages.
logFuncUseColorL :: HasLogFunc env => SimpleGetter env Bool

-- | Convert a <a>CallStack</a> value into a <a>Utf8Builder</a> indicating
--   the first source location.
--   
--   TODO Consider showing the entire call stack instead.
displayCallStack :: CallStack -> Utf8Builder

-- | Use code location in the log output.
--   
--   Default: true if in verbose mode, false otherwise.
setLogUseLoc :: Bool -> LogOptions -> LogOptions

-- | Use ANSI color codes in the log output.
--   
--   Default: true if in verbose mode <i>and</i> the <a>Handle</a> is a
--   terminal device.
setLogUseColor :: Bool -> LogOptions -> LogOptions

-- | Include the time when printing log messages.
--   
--   Default: true in debug mode, false otherwise.
setLogUseTime :: Bool -> LogOptions -> LogOptions

-- | Do we treat output as a terminal. If <tt>True</tt>, we will enabled
--   sticky logging functionality.
--   
--   Default: checks if the <tt>Handle</tt> provided to
--   <a>logOptionsHandle</a> is a terminal with <a>hIsTerminalDevice</a>.
setLogTerminal :: Bool -> LogOptions -> LogOptions

-- | Refer to <a>setLogVerboseFormat</a>. This modifier allows to alter the
--   verbose format value dynamically at runtime.
--   
--   Default: follows the value of the verbose flag.
setLogVerboseFormatIO :: IO Bool -> LogOptions -> LogOptions

-- | Use the verbose format for printing log messages.
--   
--   Default: follows the value of the verbose flag.
setLogVerboseFormat :: Bool -> LogOptions -> LogOptions

-- | Refer to <a>setLogMinLevel</a>. This modifier allows to alter the
--   verbose format value dynamically at runtime.
--   
--   Default: in verbose mode, <a>LevelDebug</a>. Otherwise,
--   <a>LevelInfo</a>.
setLogMinLevelIO :: IO LogLevel -> LogOptions -> LogOptions

-- | Set the minimum log level. Messages below this level will not be
--   printed.
--   
--   Default: in verbose mode, <a>LevelDebug</a>. Otherwise,
--   <a>LevelInfo</a>.
setLogMinLevel :: LogLevel -> LogOptions -> LogOptions

-- | Given a <a>LogOptions</a> value, run the given function with the
--   specified <a>LogFunc</a>. A common way to use this function is:
--   
--   <pre>
--   let isVerbose = False -- get from the command line instead
--   logOptions' &lt;- logOptionsHandle stderr isVerbose
--   let logOptions = setLogUseTime True logOptions'
--   withLogFunc logOptions $ lf -&gt; do
--     let app = App -- application specific environment
--           { appLogFunc = lf
--           , appOtherStuff = ...
--           }
--     runRIO app $ do
--       logInfo "Starting app"
--       myApp
--   </pre>
withLogFunc :: MonadUnliftIO m => LogOptions -> (LogFunc -> m a) -> m a

-- | Given a <a>LogOptions</a> value, returns both a new <a>LogFunc</a> and
--   a sub-routine that disposes it.
--   
--   Intended for use if you want to deal with the teardown of
--   <a>LogFunc</a> yourself, otherwise prefer the <a>withLogFunc</a>
--   function instead.
--   
--   @since 0.1.3.0
newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ())

-- | Create a <a>LogOptions</a> value from the given <a>Handle</a> and
--   whether to perform verbose logging or not. Individiual settings can be
--   overridden using appropriate <tt>set</tt> functions.
--   
--   When Verbose Flag is <tt>True</tt>, the following happens:
--   
--   <ul>
--   <li><tt>setLogVerboseFormat</tt> is called with <tt>True</tt></li>
--   <li><tt>setLogUseColor</tt> is called with <tt>True</tt> (except on
--   Windows)</li>
--   <li><tt>setLogUseLoc</tt> is called with <tt>True</tt></li>
--   <li><tt>setLogUseTime</tt> is called with <tt>True</tt></li>
--   <li><tt>setLogMinLevel</tt> is called with <tt>Debug</tt> log
--   level</li>
--   </ul>
logOptionsHandle :: MonadIO m => Handle -> Bool -> m LogOptions

-- | Create a <a>LogOptions</a> value which will store its data in memory.
--   This is primarily intended for testing purposes. This will return both
--   a <a>LogOptions</a> value and an <a>IORef</a> containing the resulting
--   <a>Builder</a> value.
--   
--   This will default to non-verbose settings and assume there is a
--   terminal attached. These assumptions can be overridden using the
--   appropriate <tt>set</tt> functions.
logOptionsMemory :: MonadIO m => m (IORef Builder, LogOptions)

-- | This will print out the given message with a newline and disable any
--   further stickiness of the line until a new call to <a>logSticky</a>
--   happens.
logStickyDone :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m ()

-- | Write a "sticky" line to the terminal. Any subsequent lines will
--   overwrite this one, and that same line will be repeated below again.
--   In other words, the line sticks at the bottom of the output forever.
--   Running this function again will replace the sticky line with a new
--   sticky line. When you want to get rid of the sticky line, run
--   <a>logStickyDone</a>.
--   
--   Note that not all <a>LogFunc</a> implementations will support sticky
--   messages as described. However, the <a>withLogFunc</a> implementation
--   provided by this module does.
logSticky :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m ()

-- | Log a message with the specified textual level and the given source.
logOtherS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> LogSource -> Utf8Builder -> m ()

-- | Log an error level message with the given source.
logErrorS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log a warn level message with the given source.
logWarnS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log an info level message with the given source.
logInfoS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log a debug level message with the given source.
logDebugS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log a message with the specified textual level and no source.
logOther :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> Utf8Builder -> m ()

-- | Log an error level message with no source.
logError :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log a warn level message with no source.
logWarn :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log an info level message with no source.
logInfo :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log a debug level message with no source.
logDebug :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Generic, basic function for creating other logging functions.
logGeneric :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> LogLevel -> Utf8Builder -> m ()

-- | Create a <a>LogFunc</a> from the given function.
mkLogFunc :: (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> LogFunc

-- | The log level of a message.
data LogLevel
LevelDebug :: LogLevel
LevelInfo :: LogLevel
LevelWarn :: LogLevel
LevelError :: LogLevel
LevelOther :: !Text -> LogLevel

-- | Where in the application a log message came from. Used for display
--   purposes only.
type LogSource = Text

-- | Environment values with a logging function.
class HasLogFunc env
logFuncL :: HasLogFunc env => Lens' env LogFunc

-- | A logging function, wrapped in a newtype for better error messages.
--   
--   An implementation may choose any behavior of this value it wishes,
--   including printing to standard output or no action at all.
data LogFunc

-- | Configuration for how to create a <a>LogFunc</a>. Intended to be used
--   with the <a>withLogFunc</a> function.
data LogOptions
fromStrictBytes :: ByteString -> LByteString
toStrictBytes :: LByteString -> ByteString
sappend :: Semigroup s => s -> s -> s
type UVector = Vector
type SVector = Vector
type GVector = Vector
type LByteString = ByteString
type LText = Text

-- | Helper function to force an action to run in <a>IO</a>. Especially
--   useful for overly general contexts, like hspec tests.
asIO :: () => IO a -> IO a

-- | Run the second value if the first value returns <a>False</a>
unlessM :: Monad m => m Bool -> m () -> m ()

-- | Run the second value if the first value returns <a>True</a>
whenM :: Monad m => m Bool -> m () -> m ()

-- | Strip out duplicates
nubOrd :: Ord a => [a] -> [a]

-- | Extend <a>foldMap</a> to allow side effects.
--   
--   Internally, this is implemented using a strict left fold. This is used
--   for performance reasons. It also necessitates that this function has a
--   <tt>Monad</tt> constraint and not just an <tt>Applicative</tt>
--   constraint. For more information, see
--   <a>https://github.com/commercialhaskell/rio/pull/99#issuecomment-394179757</a>.
foldMapM :: (Monad m, Monoid w, Foldable t) => (a -> m w) -> t a -> m w

-- | <pre>
--   <a>forMaybeM</a> <a>==</a> <a>flip</a> <a>mapMaybeM</a>
--   </pre>
forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b]

-- | Monadic <a>mapMaybe</a>.
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]

-- | <pre>
--   <a>forMaybeA</a> <a>==</a> <a>flip</a> <a>mapMaybeA</a>
--   </pre>
forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b]

-- | Applicative <a>mapMaybe</a>.
mapMaybeA :: Applicative f => (a -> f (Maybe b)) -> [a] -> f [b]

-- | Get a <a>First</a> value with a default fallback
fromFirst :: () => a -> First a -> a

-- | Apply a function to a <a>Left</a> constructor
mapLeft :: () => (a1 -> a2) -> Either a1 b -> Either a2 b

-- | Read a file in UTF8 encoding, throwing an exception on invalid
--   character encoding.
--   
--   This function will use OS-specific line ending handling.
readFileUtf8 :: MonadIO m => FilePath -> m Text

-- | Same as <a>writeFile</a>, but generalized to <a>MonadIO</a>
writeFileBinary :: MonadIO m => FilePath -> ByteString -> m ()

-- | Same as <a>readFile</a>, but generalized to <a>MonadIO</a>
readFileBinary :: MonadIO m => FilePath -> m ByteString
hPutBuilder :: MonadIO m => Handle -> Builder -> m ()

-- | Write a file in UTF8 encoding
--   
--   This function will use OS-specific line ending handling.
writeFileUtf8 :: MonadIO m => FilePath -> Text -> m ()

-- | Lazily get the contents of a file. Unlike <a>readFile</a>, this
--   ensures that if an exception is thrown, the file handle is closed
--   immediately.
withLazyFile :: MonadUnliftIO m => FilePath -> (ByteString -> m a) -> m a
yieldThread :: MonadIO m => m ()
view :: MonadReader s m => Getting a s a -> m a

-- | Write the given <a>Utf8Builder</a> value to a file.
writeFileUtf8Builder :: MonadIO m => FilePath -> Utf8Builder -> m ()

-- | Convert a <a>Utf8Builder</a> value into a lazy <a>Text</a>.
utf8BuilderToLazyText :: Utf8Builder -> Text

-- | Convert a <a>Utf8Builder</a> value into a strict <a>Text</a>.
utf8BuilderToText :: Utf8Builder -> Text

-- | Convert a <a>ByteString</a> into a <a>Utf8Builder</a>.
--   
--   <i>NOTE</i> This function performs no checks to ensure that the data
--   is, in fact, UTF8 encoded. If you provide non-UTF8 data, later
--   functions may fail.
displayBytesUtf8 :: ByteString -> Utf8Builder

-- | Use the <a>Show</a> instance for a value to convert it to a
--   <a>Utf8Builder</a>.
displayShow :: Show a => a -> Utf8Builder

-- | A builder of binary data, with the invariant that the underlying data
--   is supposed to be UTF-8 encoded.
newtype Utf8Builder
Utf8Builder :: Builder -> Utf8Builder
[getUtf8Builder] :: Utf8Builder -> Builder

-- | A typeclass for values which can be converted to a <a>Utf8Builder</a>.
--   The intention of this typeclass is to provide a human-friendly display
--   of the data.
class Display a
display :: Display a => a -> Utf8Builder

-- | Display data as <a>Text</a>, which will also be used for
--   <a>display</a> if it is not overriden.
textDisplay :: Display a => a -> Text

-- | Boxed vectors, supporting efficient slicing.
data Vector a
class (Vector Vector a, MVector MVector a) => Unbox a

-- | A set of values. A set cannot contain duplicate values.
data HashSet a

-- | Lifted version of <a>myThreadId</a>.
myThreadId :: MonadIO m => m ThreadId

-- | Lifted version of <a>threadDelay</a>.
threadDelay :: MonadIO m => Int -> m ()

-- | Lifted version of <a>threadWaitRead</a>.
threadWaitRead :: MonadIO m => Fd -> m ()

-- | Lifted version of <a>threadWaitWrite</a>.
threadWaitWrite :: MonadIO m => Fd -> m ()

-- | Lifted version of <a>isCurrentThreadBound</a>.
isCurrentThreadBound :: MonadIO m => m Bool

-- | An exception type for representing Unicode encoding errors.
data UnicodeException

-- | Could not decode a byte sequence because it was invalid under the
--   given encoding, or ran out of input in mid-decode.
DecodeError :: String -> Maybe Word8 -> UnicodeException

-- | Tried to encode a character that could not be represented under the
--   given encoding, or ran out of input in mid-encode.
EncodeError :: String -> Maybe Char -> UnicodeException

-- | Replace an invalid input byte with the Unicode replacement character
--   U+FFFD.
lenientDecode :: OnDecodeError

-- | Decode a <a>ByteString</a> containing UTF-8 encoded text.
--   
--   <b>NOTE</b>: The replacement character returned by
--   <a>OnDecodeError</a> MUST be within the BMP plane; surrogate code
--   points will automatically be remapped to the replacement char
--   <tt>U+FFFD</tt> (<i>since 0.11.3.0</i>), whereas code points beyond
--   the BMP will throw an <a>error</a> (<i>since 1.2.3.1</i>); For earlier
--   versions of <tt>text</tt> using those unsupported code points would
--   result in undefined behavior.
decodeUtf8With :: OnDecodeError -> ByteString -> Text

-- | Decode a <a>ByteString</a> containing UTF-8 encoded text.
--   
--   If the input contains any invalid UTF-8 data, the relevant exception
--   will be returned, otherwise the decoded text.
decodeUtf8' :: ByteString -> Either UnicodeException Text

-- | Encode text to a ByteString <a>Builder</a> using UTF-8 encoding.
encodeUtf8Builder :: Text -> Builder

-- | Encode text using UTF-8 encoding.
encodeUtf8 :: Text -> ByteString

-- | The <a>Store</a> typeclass provides efficient serialization and
--   deserialization to raw pointer addresses.
--   
--   The <a>peek</a> and <a>poke</a> methods should be defined such that
--   <tt> decodeEx (encode x) == x </tt>.
class Store a

module Stack.Options.Utils

-- | If argument is True, hides the option from usage and help
hideMods :: Bool -> Mod f a

-- | Allows adjust global options depending on their context Note: This was
--   being used to remove ambibuity between the local and global
--   implementation of stack init --resolver option. Now that stack init
--   has no local --resolver this is not being used anymore but the code is
--   kept for any similar future use cases.
data GlobalOptsContext

-- | Global options before subcommand name
OuterGlobalOpts :: GlobalOptsContext

-- | Global options following any other subcommand
OtherCmdGlobalOpts :: GlobalOptsContext
BuildCmdGlobalOpts :: GlobalOptsContext
GhciCmdGlobalOpts :: GlobalOptsContext
instance GHC.Classes.Eq Stack.Options.Utils.GlobalOptsContext
instance GHC.Show.Show Stack.Options.Utils.GlobalOptsContext

module Stack.Options.LogLevelParser

-- | Parser for a logging level.
logLevelOptsParser :: Bool -> Maybe LogLevel -> Parser (Maybe LogLevel)

module Stack.Ghci.Script
data GhciScript

-- | A valid Haskell module name.
data ModuleName
cmdAdd :: Set (Either ModuleName (Path Abs File)) -> GhciScript
cmdCdGhc :: Path Abs Dir -> GhciScript
cmdModule :: Set ModuleName -> GhciScript
scriptToLazyByteString :: GhciScript -> LByteString
scriptToBuilder :: GhciScript -> Builder
scriptToFile :: Path Abs File -> GhciScript -> IO ()
instance GHC.Show.Show Stack.Ghci.Script.GhciCommand
instance GHC.Base.Semigroup Stack.Ghci.Script.GhciScript
instance GHC.Base.Monoid Stack.Ghci.Script.GhciScript

module Stack.FileWatch
fileWatch :: Handle -> ((Set (Path Abs File) -> IO ()) -> IO ()) -> IO ()
fileWatchPoll :: Handle -> ((Set (Path Abs File) -> IO ()) -> IO ()) -> IO ()


-- | Finding files.
module Path.Find

-- | Find the location of a file matching the given predicate.
findFileUp :: (MonadIO m, MonadThrow m) => Path Abs Dir -> (Path Abs File -> Bool) -> Maybe (Path Abs Dir) -> m (Maybe (Path Abs File))

-- | Find the location of a directory matching the given predicate.
findDirUp :: (MonadIO m, MonadThrow m) => Path Abs Dir -> (Path Abs Dir -> Bool) -> Maybe (Path Abs Dir) -> m (Maybe (Path Abs Dir))

-- | Find files matching predicate below a root directory.
--   
--   NOTE: this skips symbolic directory links, to avoid loops. This may
--   not make sense for all uses of file finding.
--   
--   TODO: write one of these that traverses symbolic links but efficiently
--   ignores loops.
findFiles :: Path Abs Dir -> (Path Abs File -> Bool) -> (Path Abs Dir -> Bool) -> IO [Path Abs File]

-- | <tt>findInParents f path</tt> applies <tt>f</tt> to <tt>path</tt> and
--   its <a>parent</a>s until it finds a <a>Just</a> or reaches the root
--   directory.
findInParents :: MonadIO m => (Path Abs Dir -> m (Maybe a)) -> Path Abs Dir -> m (Maybe a)


-- | Simple interface to complicated program arguments.
--   
--   This is a "fork" of the <tt>optparse-simple</tt> package that has some
--   workarounds for optparse-applicative issues that become problematic
--   with programs that have many options and subcommands. Because it makes
--   the interface more complex, these workarounds are not suitable for
--   pushing upstream to optparse-applicative.
module Options.Applicative.Complicated

-- | Add a command to the options dispatcher.
addCommand :: String -> String -> String -> (a -> b) -> Parser c -> Parser a -> ExceptT b (Writer (Mod CommandFields (b, c))) ()

-- | Add a command that takes sub-commands to the options dispatcher.
addSubCommands :: Monoid c => String -> String -> String -> Parser c -> ExceptT b (Writer (Mod CommandFields (b, c))) () -> ExceptT b (Writer (Mod CommandFields (b, c))) ()

-- | Generate and execute a complicated options parser.
complicatedOptions :: Monoid a => Version -> Maybe String -> String -> String -> String -> String -> Parser a -> Maybe (ParserFailure ParserHelp -> [String] -> IO (a, (b, a))) -> ExceptT b (Writer (Mod CommandFields (b, a))) () -> IO (a, b)

-- | Generate a complicated options parser.
complicatedParser :: Monoid a => String -> Parser a -> ExceptT b (Writer (Mod CommandFields (b, a))) () -> Parser (a, (b, a))


-- | Extra functions for optparse-applicative.
module Options.Applicative.Builder.Extra

-- | Enable/disable flags for a <a>Bool</a>.
boolFlags :: Bool -> String -> String -> Mod FlagFields Bool -> Parser Bool

-- | Enable/disable flags for a <a>Bool</a>, without a default case (to
--   allow chaining with <a>&lt;|&gt;</a>).
boolFlagsNoDefault :: String -> String -> Mod FlagFields Bool -> Parser Bool

-- | Enable/disable flags for a <tt>(<a>Maybe</a> <a>Bool</a>)</tt>.
maybeBoolFlags :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (Maybe Bool)

-- | Like <a>maybeBoolFlags</a>, but parsing a <a>First</a>.
firstBoolFlags :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (First Bool)

-- | Enable/disable flags for any type.
enableDisableFlags :: a -> a -> a -> String -> String -> Mod FlagFields a -> Parser a

-- | Enable/disable flags for any type, without a default (to allow
--   chaining with <a>&lt;|&gt;</a>)
enableDisableFlagsNoDefault :: a -> a -> String -> String -> Mod FlagFields a -> Parser a

-- | Show an extra help option (e.g. <tt>--docker-help</tt> shows help for
--   all <tt>--docker*</tt> args).
--   
--   To actually have that help appear, use <a>execExtraHelp</a> before
--   executing the main parser.
extraHelpOption :: Bool -> String -> String -> String -> Parser (a -> a)

-- | Display extra help if extra help option passed in arguments.
--   
--   Since optparse-applicative doesn't allow an arbitrary IO action for an
--   <a>abortOption</a>, this was the best way I found that doesn't require
--   manually formatting the help.
execExtraHelp :: [String] -> String -> Parser a -> String -> IO ()

-- | <a>option</a>, specialized to <a>Text</a>.
textOption :: Mod OptionFields Text -> Parser Text

-- | <a>argument</a>, specialized to <a>Text</a>.
textArgument :: Mod ArgumentFields Text -> Parser Text

-- | Like <a>optional</a>, but returning a <a>First</a>.
optionalFirst :: Alternative f => f a -> f (First a)
absFileOption :: Mod OptionFields (Path Abs File) -> Parser (Path Abs File)
relFileOption :: Mod OptionFields (Path Rel File) -> Parser (Path Rel File)
absDirOption :: Mod OptionFields (Path Abs Dir) -> Parser (Path Abs Dir)
relDirOption :: Mod OptionFields (Path Rel Dir) -> Parser (Path Rel Dir)

-- | Like <a>eitherReader</a>, but accepting any <tt><a>Show</a> e</tt> on
--   the <a>Left</a>.
eitherReader' :: Show e => (String -> Either e a) -> ReadM a
fileCompleter :: Completer
fileExtCompleter :: [String] -> Completer
dirCompleter :: Completer
data PathCompleterOpts
PathCompleterOpts :: Bool -> Bool -> Maybe FilePath -> (FilePath -> Bool) -> (FilePath -> Bool) -> PathCompleterOpts
[pcoAbsolute] :: PathCompleterOpts -> Bool
[pcoRelative] :: PathCompleterOpts -> Bool
[pcoRootDir] :: PathCompleterOpts -> Maybe FilePath
[pcoFileFilter] :: PathCompleterOpts -> FilePath -> Bool
[pcoDirFilter] :: PathCompleterOpts -> FilePath -> Bool
defaultPathCompleterOpts :: PathCompleterOpts
pathCompleterWith :: PathCompleterOpts -> Completer
unescapeBashArg :: String -> String

module Stack.Options.SolverParser

-- | Parser for <tt>solverCmd</tt>
solverOptsParser :: Parser Bool


-- | Tag a Store instance with structural version info to ensure we're
--   reading a compatible format.
module Data.Store.VersionTagged
versionedEncodeFile :: Data a => VersionConfig a -> Q Exp
versionedDecodeOrLoad :: Data a => VersionConfig a -> Q Exp
versionedDecodeFile :: Data a => VersionConfig a -> Q Exp
storeVersionConfig :: String -> String -> VersionConfig a

module Data.Monoid.Map

-- | Utility newtype wrapper to make make Map's Monoid also use the
--   element's Monoid.
newtype MonoidMap k a
MonoidMap :: Map k a -> MonoidMap k a
instance GHC.Base.Functor (Data.Monoid.Map.MonoidMap k)
instance GHC.Generics.Generic (Data.Monoid.Map.MonoidMap k a)
instance (GHC.Show.Show k, GHC.Show.Show a) => GHC.Show.Show (Data.Monoid.Map.MonoidMap k a)
instance (GHC.Classes.Ord k, GHC.Read.Read k, GHC.Read.Read a) => GHC.Read.Read (Data.Monoid.Map.MonoidMap k a)
instance (GHC.Classes.Ord k, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Monoid.Map.MonoidMap k a)
instance (GHC.Classes.Eq k, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Monoid.Map.MonoidMap k a)
instance (GHC.Classes.Ord k, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Data.Monoid.Map.MonoidMap k a)
instance (GHC.Classes.Ord k, GHC.Base.Semigroup a) => GHC.Base.Monoid (Data.Monoid.Map.MonoidMap k a)

module Data.IORef.RunOnce
runOnce :: (MonadUnliftIO m, MonadIO n) => m a -> m (n a)


-- | More readable combinators for writing parsers.
module Data.Attoparsec.Combinators

-- | Concatenate two parsers.
appending :: (Applicative f, Semigroup a) => f a -> f a -> f a

-- | Alternative parsers.
alternating :: Alternative f => f a -> f a -> f a

-- | Pure something.
pured :: (Applicative g, Applicative f) => g a -> g (f a)

-- | Concatting the result of an action.
concating :: (Monoid m, Applicative f) => f [m] -> f m


-- | Parsing of stack command line arguments
module Data.Attoparsec.Args

-- | Mode for parsing escape characters.
data EscapingMode
Escaping :: EscapingMode
NoEscaping :: EscapingMode

-- | A basic argument parser. It supports space-separated text, and string
--   quotation with identity escaping: x -&gt; x.
argsParser :: EscapingMode -> Parser [String]

-- | Parse arguments using <a>argsParser</a>.
parseArgs :: EscapingMode -> Text -> Either String [String]

-- | Parse using <a>argsParser</a> from a string.
parseArgsFromString :: EscapingMode -> String -> Either String [String]
instance GHC.Enum.Enum Data.Attoparsec.Args.EscapingMode
instance GHC.Classes.Eq Data.Attoparsec.Args.EscapingMode
instance GHC.Show.Show Data.Attoparsec.Args.EscapingMode


-- | Accepting arguments to be passed through to a sub-process.
module Options.Applicative.Args

-- | An argument which accepts a list of arguments e.g.
--   <tt>--ghc-options="-X P.hs "this""</tt>.
argsArgument :: Mod ArgumentFields [String] -> Parser [String]

-- | An option which accepts a list of arguments e.g. <tt>--ghc-options="-X
--   P.hs "this""</tt>.
argsOption :: Mod OptionFields [String] -> Parser [String]

-- | An option which accepts a command and a list of arguments e.g.
--   <tt>--exec "echo hello world"</tt>
cmdOption :: Mod OptionFields (String, [String]) -> Parser (String, [String])


-- | Extensions to Aeson parsing of objects.
module Data.Aeson.Extended

-- | Like <a>decodeFileStrict'</a> but returns an error message when
--   decoding fails.
eitherDecodeFileStrict' :: FromJSON a => FilePath -> IO (Either String a)

-- | Like <a>decodeStrict'</a> but returns an error message when decoding
--   fails.
eitherDecodeStrict' :: FromJSON a => ByteString -> Either String a

-- | Like <a>decode'</a> but returns an error message when decoding fails.
eitherDecode' :: FromJSON a => ByteString -> Either String a

-- | Like <a>decodeFileStrict</a> but returns an error message when
--   decoding fails.
eitherDecodeFileStrict :: FromJSON a => FilePath -> IO (Either String a)

-- | Like <a>decodeStrict</a> but returns an error message when decoding
--   fails.
eitherDecodeStrict :: FromJSON a => ByteString -> Either String a

-- | Like <a>decode</a> but returns an error message when decoding fails.
eitherDecode :: FromJSON a => ByteString -> Either String a

-- | Efficiently deserialize a JSON value from a file. If this fails due to
--   incomplete or invalid input, <a>Nothing</a> is returned.
--   
--   The input file's content must consist solely of a JSON document, with
--   no trailing data except for whitespace.
--   
--   This function parses and performs conversion immediately. See
--   <a>json'</a> for details.
decodeFileStrict' :: FromJSON a => FilePath -> IO (Maybe a)

-- | Efficiently deserialize a JSON value from a strict <a>ByteString</a>.
--   If this fails due to incomplete or invalid input, <a>Nothing</a> is
--   returned.
--   
--   The input must consist solely of a JSON document, with no trailing
--   data except for whitespace.
--   
--   This function parses and performs conversion immediately. See
--   <a>json'</a> for details.
decodeStrict' :: FromJSON a => ByteString -> Maybe a

-- | Efficiently deserialize a JSON value from a lazy <a>ByteString</a>. If
--   this fails due to incomplete or invalid input, <a>Nothing</a> is
--   returned.
--   
--   The input must consist solely of a JSON document, with no trailing
--   data except for whitespace.
--   
--   This function parses and performs conversion immediately. See
--   <a>json'</a> for details.
decode' :: FromJSON a => ByteString -> Maybe a

-- | Efficiently deserialize a JSON value from a file. If this fails due to
--   incomplete or invalid input, <a>Nothing</a> is returned.
--   
--   The input file's content must consist solely of a JSON document, with
--   no trailing data except for whitespace.
--   
--   This function parses immediately, but defers conversion. See
--   <a>json</a> for details.
decodeFileStrict :: FromJSON a => FilePath -> IO (Maybe a)

-- | Efficiently deserialize a JSON value from a strict <a>ByteString</a>.
--   If this fails due to incomplete or invalid input, <a>Nothing</a> is
--   returned.
--   
--   The input must consist solely of a JSON document, with no trailing
--   data except for whitespace.
--   
--   This function parses immediately, but defers conversion. See
--   <a>json</a> for details.
decodeStrict :: FromJSON a => ByteString -> Maybe a

-- | Efficiently deserialize a JSON value from a lazy <a>ByteString</a>. If
--   this fails due to incomplete or invalid input, <a>Nothing</a> is
--   returned.
--   
--   The input must consist solely of a JSON document, with no trailing
--   data except for whitespace.
--   
--   This function parses immediately, but defers conversion. See
--   <a>json</a> for details.
decode :: FromJSON a => ByteString -> Maybe a

-- | Efficiently serialize a JSON value as a lazy <a>ByteString</a> and
--   write it to a file.
encodeFile :: ToJSON a => FilePath -> a -> IO ()

-- | Efficiently serialize a JSON value as a lazy <a>ByteString</a>.
--   
--   This is implemented in terms of the <a>ToJSON</a> class's
--   <a>toEncoding</a> method.
encode :: ToJSON a => a -> ByteString

-- | Encode a <a>Foldable</a> as a JSON array.
foldable :: (Foldable t, ToJSON a) => t a -> Encoding
type GToJSON = GToJSON Value
type GToEncoding = GToJSON Encoding

-- | Lift the standard <a>toEncoding</a> function through the type
--   constructor.
toEncoding2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Encoding

-- | Lift the standard <a>toJSON</a> function through the type constructor.
toJSON2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Value

-- | Lift the standard <a>toEncoding</a> function through the type
--   constructor.
toEncoding1 :: (ToJSON1 f, ToJSON a) => f a -> Encoding

-- | Lift the standard <a>toJSON</a> function through the type constructor.
toJSON1 :: (ToJSON1 f, ToJSON a) => f a -> Value

-- | A configurable generic JSON encoder. This function applied to
--   <a>defaultOptions</a> is used as the default for <a>liftToEncoding</a>
--   when the type is an instance of <a>Generic1</a>.
genericLiftToEncoding :: (Generic1 f, GToJSON Encoding One (Rep1 f)) => Options -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding

-- | A configurable generic JSON encoder. This function applied to
--   <a>defaultOptions</a> is used as the default for <a>toEncoding</a>
--   when the type is an instance of <a>Generic</a>.
genericToEncoding :: (Generic a, GToJSON Encoding Zero (Rep a)) => Options -> a -> Encoding

-- | A configurable generic JSON creator. This function applied to
--   <a>defaultOptions</a> is used as the default for <a>liftToJSON</a>
--   when the type is an instance of <a>Generic1</a>.
genericLiftToJSON :: (Generic1 f, GToJSON Value One (Rep1 f)) => Options -> (a -> Value) -> ([a] -> Value) -> f a -> Value

-- | A configurable generic JSON creator. This function applied to
--   <a>defaultOptions</a> is used as the default for <a>toJSON</a> when
--   the type is an instance of <a>Generic</a>.
genericToJSON :: (Generic a, GToJSON Value Zero (Rep a)) => Options -> a -> Value

-- | A <a>ToArgs</a> value either stores nothing (for <a>ToJSON</a>) or it
--   stores the two function arguments that encode occurrences of the type
--   parameter (for <a>ToJSON1</a>).
data ToArgs res arity a
[NoToArgs] :: forall res arity a. () => ToArgs res Zero a
[To1Args] :: forall res arity a. () => (a -> res) -> ([a] -> res) -> ToArgs res One a

-- | A type that can be converted to JSON.
--   
--   Instances in general <i>must</i> specify <a>toJSON</a> and
--   <i>should</i> (but don't need to) specify <a>toEncoding</a>.
--   
--   An example type and instance:
--   
--   <pre>
--   -- Allow ourselves to write <a>Text</a> literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance <a>ToJSON</a> Coord where
--     <a>toJSON</a> (Coord x y) = <a>object</a> ["x" <a>.=</a> x, "y" <a>.=</a> y]
--   
--     <a>toEncoding</a> (Coord x y) = <tt>pairs</tt> ("x" <a>.=</a> x <a>&lt;&gt;</a> "y" <a>.=</a> y)
--   </pre>
--   
--   Instead of manually writing your <a>ToJSON</a> instance, there are two
--   options to do it automatically:
--   
--   <ul>
--   <li><a>Data.Aeson.TH</a> provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.</li>
--   <li>The compiler can provide a default generic implementation for
--   <a>toJSON</a>.</li>
--   </ul>
--   
--   To use the second, simply add a <tt>deriving <a>Generic</a></tt>
--   clause to your datatype and declare a <a>ToJSON</a> instance. If you
--   require nothing other than <a>defaultOptions</a>, it is sufficient to
--   write (and this is the only alternative where the default
--   <a>toJSON</a> implementation is sufficient):
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import <a>GHC.Generics</a>
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving <a>Generic</a>
--   
--   instance <a>ToJSON</a> Coord where
--       <a>toEncoding</a> = <a>genericToEncoding</a> <a>defaultOptions</a>
--   </pre>
--   
--   If on the other hand you wish to customize the generic decoding, you
--   have to implement both methods:
--   
--   <pre>
--   customOptions = <a>defaultOptions</a>
--                   { <a>fieldLabelModifier</a> = <a>map</a> <a>toUpper</a>
--                   }
--   
--   instance <a>ToJSON</a> Coord where
--       <a>toJSON</a>     = <a>genericToJSON</a> customOptions
--       <a>toEncoding</a> = <a>genericToEncoding</a> customOptions
--   </pre>
--   
--   Previous versions of this library only had the <a>toJSON</a> method.
--   Adding <a>toEncoding</a> had two reasons:
--   
--   <ol>
--   <li>toEncoding is more efficient for the common case that the output
--   of <a>toJSON</a> is directly serialized to a <tt>ByteString</tt>.
--   Further, expressing either method in terms of the other would be
--   non-optimal.</li>
--   <li>The choice of defaults allows a smooth transition for existing
--   users: Existing instances that do not define <a>toEncoding</a> still
--   compile and have the correct semantics. This is ensured by making the
--   default implementation of <a>toEncoding</a> use <a>toJSON</a>. This
--   produces correct results, but since it performs an intermediate
--   conversion to a <a>Value</a>, it will be less efficient than directly
--   emitting an <a>Encoding</a>. (this also means that specifying nothing
--   more than <tt>instance ToJSON Coord</tt> would be sufficient as a
--   generically decoding instance, but there probably exists no good
--   reason to not specify <a>toEncoding</a> in new instances.)</li>
--   </ol>
class ToJSON a

-- | Convert a Haskell value to a JSON-friendly intermediate type.
toJSON :: ToJSON a => a -> Value

-- | Encode a Haskell value as JSON.
--   
--   The default implementation of this method creates an intermediate
--   <a>Value</a> using <a>toJSON</a>. This provides source-level
--   compatibility for people upgrading from older versions of this
--   library, but obviously offers no performance advantage.
--   
--   To benefit from direct encoding, you <i>must</i> provide an
--   implementation for this method. The easiest way to do so is by having
--   your types implement <a>Generic</a> using the <tt>DeriveGeneric</tt>
--   extension, and then have GHC generate a method body as follows.
--   
--   <pre>
--   instance <a>ToJSON</a> Coord where
--       <a>toEncoding</a> = <a>genericToEncoding</a> <a>defaultOptions</a>
--   </pre>
toEncoding :: ToJSON a => a -> Encoding
toJSONList :: ToJSON a => [a] -> Value
toEncodingList :: ToJSON a => [a] -> Encoding

-- | A key-value pair for encoding a JSON object.
class KeyValue kv
(.=) :: (KeyValue kv, ToJSON v) => Text -> v -> kv
infixr 8 .=

-- | Typeclass for types that can be used as the key of a map-like
--   container (like <tt>Map</tt> or <tt>HashMap</tt>). For example, since
--   <a>Text</a> has a <a>ToJSONKey</a> instance and <a>Char</a> has a
--   <a>ToJSON</a> instance, we can encode a value of type <tt>Map</tt>
--   <a>Text</a> <a>Char</a>:
--   
--   <pre>
--   &gt;&gt;&gt; LBC8.putStrLn $ encode $ Map.fromList [("foo" :: Text, 'a')]
--   {"foo":"a"}
--   </pre>
--   
--   Since <a>Int</a> also has a <a>ToJSONKey</a> instance, we can
--   similarly write:
--   
--   <pre>
--   &gt;&gt;&gt; LBC8.putStrLn $ encode $ Map.fromList [(5 :: Int, 'a')]
--   {"5":"a"}
--   </pre>
--   
--   JSON documents only accept strings as object keys. For any type from
--   <tt>base</tt> that has a natural textual representation, it can be
--   expected that its <a>ToJSONKey</a> instance will choose that
--   representation.
--   
--   For data types that lack a natural textual representation, an
--   alternative is provided. The map-like container is represented as a
--   JSON array instead of a JSON object. Each value in the array is an
--   array with exactly two values. The first is the key and the second is
--   the value.
--   
--   For example, values of type '[Text]' cannot be encoded to a string, so
--   a <tt>Map</tt> with keys of type '[Text]' is encoded as follows:
--   
--   <pre>
--   &gt;&gt;&gt; LBC8.putStrLn $ encode $ Map.fromList [(["foo","bar","baz" :: Text], 'a')]
--   [[["foo","bar","baz"],"a"]]
--   </pre>
--   
--   The default implementation of <a>ToJSONKey</a> chooses this method of
--   encoding a key, using the <a>ToJSON</a> instance of the type.
--   
--   To use your own data type as the key in a map, all that is needed is
--   to write a <a>ToJSONKey</a> (and possibly a <tt>FromJSONKey</tt>)
--   instance for it. If the type cannot be trivially converted to and from
--   <a>Text</a>, it is recommended that <a>ToJSONKeyValue</a> is used.
--   Since the default implementations of the typeclass methods can build
--   this from a <a>ToJSON</a> instance, there is nothing that needs to be
--   written:
--   
--   <pre>
--   data Foo = Foo { fooAge :: Int, fooName :: Text }
--     deriving (Eq,Ord,Generic)
--   instance ToJSON Foo
--   instance ToJSONKey Foo
--   </pre>
--   
--   That's it. We can now write:
--   
--   <pre>
--   &gt;&gt;&gt; let m = Map.fromList [(Foo 4 "bar",'a'),(Foo 6 "arg",'b')]
--   
--   &gt;&gt;&gt; LBC8.putStrLn $ encode m
--   [[{"fooName":"bar","fooAge":4},"a"],[{"fooName":"arg","fooAge":6},"b"]]
--   </pre>
--   
--   The next case to consider is if we have a type that is a newtype
--   wrapper around <a>Text</a>. The recommended approach is to use
--   generalized newtype deriving:
--   
--   <pre>
--   newtype RecordId = RecordId { getRecordId :: Text}
--     deriving (Eq,Ord,ToJSONKey)
--   </pre>
--   
--   Then we may write:
--   
--   <pre>
--   &gt;&gt;&gt; LBC8.putStrLn $ encode $ Map.fromList [(RecordId "abc",'a')]
--   {"abc":"a"}
--   </pre>
--   
--   Simple sum types are a final case worth considering. Suppose we have:
--   
--   <pre>
--   data Color = Red | Green | Blue
--     deriving (Show,Read,Eq,Ord)
--   </pre>
--   
--   It is possible to get the <a>ToJSONKey</a> instance for free as we did
--   with <tt>Foo</tt>. However, in this case, we have a natural way to go
--   to and from <a>Text</a> that does not require any escape sequences.
--   So, in this example, <a>ToJSONKeyText</a> will be used instead of
--   <a>ToJSONKeyValue</a>. The <a>Show</a> instance can be used to help
--   write <a>ToJSONKey</a>:
--   
--   <pre>
--   instance ToJSONKey Color where
--     toJSONKey = ToJSONKeyText f g
--       where f = Text.pack . show
--             g = text . Text.pack . show
--             -- text function is from Data.Aeson.Encoding
--   </pre>
--   
--   The situation of needing to turning function <tt>a -&gt; Text</tt>
--   into a <a>ToJSONKeyFunction</a> is common enough that a special
--   combinator is provided for it. The above instance can be rewritten as:
--   
--   <pre>
--   instance ToJSONKey Color where
--     toJSONKey = toJSONKeyText (Text.pack . show)
--   </pre>
--   
--   The performance of the above instance can be improved by not using
--   <a>Value</a> as an intermediate step when converting to <a>Text</a>.
--   One option for improving performance would be to use template haskell
--   machinery from the <tt>text-show</tt> package. However, even with the
--   approach, the <a>Encoding</a> (a wrapper around a bytestring builder)
--   is generated by encoding the <a>Text</a> to a <tt>ByteString</tt>, an
--   intermediate step that could be avoided. The fastest possible
--   implementation would be:
--   
--   <pre>
--   -- Assuming that OverloadedStrings is enabled
--   instance ToJSONKey Color where
--     toJSONKey = ToJSONKeyText f g
--       where f x = case x of {Red -&gt; "Red";Green -&gt;"Green";Blue -&gt; "Blue"}
--             g x = case x of {Red -&gt; text "Red";Green -&gt; text "Green";Blue -&gt; text "Blue"}
--             -- text function is from Data.Aeson.Encoding
--   </pre>
--   
--   This works because GHC can lift the encoded values out of the case
--   statements, which means that they are only evaluated once. This
--   approach should only be used when there is a serious need to maximize
--   performance.
class ToJSONKey a

-- | Strategy for rendering the key for a map-like container.
toJSONKey :: ToJSONKey a => ToJSONKeyFunction a

-- | This is similar in spirit to the <tt>showsList</tt> method of
--   <a>Show</a>. It makes it possible to give <a>Value</a> keys special
--   treatment without using <tt>OverlappingInstances</tt>. End users
--   should always be able to use the default implementation of this
--   method.
toJSONKeyList :: ToJSONKey a => ToJSONKeyFunction [a]
data ToJSONKeyFunction a

-- | key is encoded to string, produces object
ToJSONKeyText :: !a -> Text -> !a -> Encoding' Text -> ToJSONKeyFunction a

-- | key is encoded to value, produces array
ToJSONKeyValue :: !a -> Value -> !a -> Encoding -> ToJSONKeyFunction a

-- | Lifting of the <a>ToJSON</a> class to unary type constructors.
--   
--   Instead of manually writing your <a>ToJSON1</a> instance, there are
--   two options to do it automatically:
--   
--   <ul>
--   <li><a>Data.Aeson.TH</a> provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.</li>
--   <li>The compiler can provide a default generic implementation for
--   <a>toJSON1</a>.</li>
--   </ul>
--   
--   To use the second, simply add a <tt>deriving <a>Generic1</a></tt>
--   clause to your datatype and declare a <a>ToJSON1</a> instance for your
--   datatype without giving definitions for <a>liftToJSON</a> or
--   <a>liftToEncoding</a>.
--   
--   For example:
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import <a>GHC.Generics</a>
--   
--   data Pair = Pair { pairFst :: a, pairSnd :: b } deriving <a>Generic1</a>
--   
--   instance <a>ToJSON</a> a =&gt; <a>ToJSON1</a> (Pair a)
--   </pre>
--   
--   If the default implementation doesn't give exactly the results you
--   want, you can customize the generic encoding with only a tiny amount
--   of effort, using <a>genericLiftToJSON</a> and
--   <a>genericLiftToEncoding</a> with your preferred <a>Options</a>:
--   
--   <pre>
--   customOptions = <a>defaultOptions</a>
--                   { <a>fieldLabelModifier</a> = <a>map</a> <a>toUpper</a>
--                   }
--   
--   instance <a>ToJSON</a> a =&gt; <a>ToJSON1</a> (Pair a) where
--       <a>liftToJSON</a>     = <a>genericLiftToJSON</a> customOptions
--       <a>liftToEncoding</a> = <a>genericLiftToEncoding</a> customOptions
--   </pre>
--   
--   See also <a>ToJSON</a>.
class ToJSON1 (f :: Type -> Type)
liftToJSON :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> f a -> Value
liftToJSONList :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> [f a] -> Value
liftToEncoding :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding
liftToEncodingList :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding

-- | Lifting of the <a>ToJSON</a> class to binary type constructors.
--   
--   Instead of manually writing your <a>ToJSON2</a> instance,
--   <a>Data.Aeson.TH</a> provides Template Haskell functions which will
--   derive an instance at compile time.
--   
--   The compiler cannot provide a default generic implementation for
--   <a>liftToJSON2</a>, unlike <a>toJSON</a> and <a>liftToJSON</a>.
class ToJSON2 (f :: Type -> Type -> Type)
liftToJSON2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value
liftToJSONList2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value
liftToEncoding2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding
liftToEncodingList2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding

-- | Encode a series of key/value pairs, separated by commas.
pairs :: Series -> Encoding

-- | Acquire the underlying bytestring builder.
fromEncoding :: Encoding' tag -> Builder

-- | Often used synonym for <a>Encoding'</a>.
type Encoding = Encoding' Value

-- | A series of values that, when encoded, should be separated by commas.
--   Since 0.11.0.0, the <tt>.=</tt> operator is overloaded to create
--   either <tt>(Text, Value)</tt> or <a>Series</a>. You can use Series
--   when encoding directly to a bytestring builder as in the following
--   example:
--   
--   <pre>
--   toEncoding (Person name age) = pairs ("name" .= name &lt;&gt; "age" .= age)
--   </pre>
data Series

-- | Helper for use in combination with <a>.:?</a> to provide default
--   values for optional JSON object fields.
--   
--   This combinator is most useful if the key and value can be absent from
--   an object without affecting its validity and we know a default value
--   to assign in that case. If the key and value are mandatory, use
--   <a>.:</a> instead.
--   
--   Example usage:
--   
--   <pre>
--   v1 &lt;- o <a>.:?</a> "opt_field_with_dfl" .!= "default_val"
--   v2 &lt;- o <a>.:</a>  "mandatory_field"
--   v3 &lt;- o <a>.:?</a> "opt_field2"
--   </pre>
(.!=) :: () => Parser (Maybe a) -> a -> Parser a

-- | Retrieve the value associated with the given key of an <a>Object</a>.
--   The result is <a>Nothing</a> if the key is not present or
--   <tt>empty</tt> if the value cannot be converted to the desired type.
--   
--   This differs from <a>.:?</a> by attempting to parse <a>Null</a> the
--   same as any other JSON value, instead of interpreting it as
--   <a>Nothing</a>.
(.:!) :: FromJSON a => Object -> Text -> Parser (Maybe a)

-- | Convert a value from JSON, failing if the types do not match.
fromJSON :: FromJSON a => Value -> Result a

-- | Decode a nested JSON-encoded string.
withEmbeddedJSON :: () => String -> (Value -> Parser a) -> Value -> Parser a

-- | <tt><a>withBool</a> expected f value</tt> applies <tt>f</tt> to the
--   <a>Value</a> when <tt>value</tt> is a <a>Value</a> and fails using
--   <tt><a>typeMismatch</a> expected</tt> otherwise.
withBool :: () => String -> (Bool -> Parser a) -> Value -> Parser a

-- | <tt><a>withScientific</a> expected f value</tt> applies <tt>f</tt> to
--   the <a>Scientific</a> number when <tt>value</tt> is a <a>Number</a>
--   and fails using <tt><a>typeMismatch</a> expected</tt> otherwise. .
--   <i>Warning</i>: If you are converting from a scientific to an
--   unbounded type such as <a>Integer</a> you may want to add a
--   restriction on the size of the exponent (see
--   <a>withBoundedScientific</a>) to prevent malicious input from filling
--   up the memory of the target system.
withScientific :: () => String -> (Scientific -> Parser a) -> Value -> Parser a

-- | <tt><a>withArray</a> expected f value</tt> applies <tt>f</tt> to the
--   <a>Array</a> when <tt>value</tt> is an <a>Array</a> and fails using
--   <tt><a>typeMismatch</a> expected</tt> otherwise.
withArray :: () => String -> (Array -> Parser a) -> Value -> Parser a

-- | <tt><a>withText</a> expected f value</tt> applies <tt>f</tt> to the
--   <a>Text</a> when <tt>value</tt> is a <a>Value</a> and fails using
--   <tt><a>typeMismatch</a> expected</tt> otherwise.
withText :: () => String -> (Text -> Parser a) -> Value -> Parser a

-- | <tt><a>withObject</a> expected f value</tt> applies <tt>f</tt> to the
--   <a>Object</a> when <tt>value</tt> is an <a>Object</a> and fails using
--   <tt><a>typeMismatch</a> expected</tt> otherwise.
withObject :: () => String -> (Object -> Parser a) -> Value -> Parser a

-- | Lift the standard <a>parseJSON</a> function through the type
--   constructor.
parseJSON2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Value -> Parser (f a b)

-- | Lift the standard <a>parseJSON</a> function through the type
--   constructor.
parseJSON1 :: (FromJSON1 f, FromJSON a) => Value -> Parser (f a)

-- | A configurable generic JSON decoder. This function applied to
--   <a>defaultOptions</a> is used as the default for <a>liftParseJSON</a>
--   when the type is an instance of <a>Generic1</a>.
genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a)

-- | A configurable generic JSON decoder. This function applied to
--   <a>defaultOptions</a> is used as the default for <a>parseJSON</a> when
--   the type is an instance of <a>Generic</a>.
genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a

-- | Class of generic representation types that can be converted from JSON.
class GFromJSON arity (f :: Type -> Type)

-- | This method (applied to <a>defaultOptions</a>) is used as the default
--   generic implementation of <a>parseJSON</a> (if the <tt>arity</tt> is
--   <a>Zero</a>) or <a>liftParseJSON</a> (if the <tt>arity</tt> is
--   <a>One</a>).
gParseJSON :: GFromJSON arity f => Options -> FromArgs arity a -> Value -> Parser (f a)

-- | A <a>FromArgs</a> value either stores nothing (for <a>FromJSON</a>) or
--   it stores the two function arguments that decode occurrences of the
--   type parameter (for <a>FromJSON1</a>).
data FromArgs arity a
[NoFromArgs] :: forall arity a. () => FromArgs Zero a
[From1Args] :: forall arity a. () => (Value -> Parser a) -> (Value -> Parser [a]) -> FromArgs One a

-- | A type that can be converted from JSON, with the possibility of
--   failure.
--   
--   In many cases, you can get the compiler to generate parsing code for
--   you (see below). To begin, let's cover writing an instance by hand.
--   
--   There are various reasons a conversion could fail. For example, an
--   <a>Object</a> could be missing a required key, an <a>Array</a> could
--   be of the wrong size, or a value could be of an incompatible type.
--   
--   The basic ways to signal a failed conversion are as follows:
--   
--   <ul>
--   <li><tt>empty</tt> and <tt>mzero</tt> work, but are terse and
--   uninformative;</li>
--   <li><a>fail</a> yields a custom error message;</li>
--   <li><a>typeMismatch</a> produces an informative message for cases when
--   the value encountered is not of the expected type.</li>
--   </ul>
--   
--   An example type and instance using <a>typeMismatch</a>:
--   
--   <pre>
--   -- Allow ourselves to write <a>Text</a> literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance <a>FromJSON</a> Coord where
--       <a>parseJSON</a> (<a>Object</a> v) = Coord
--           <a>&lt;$&gt;</a> v <a>.:</a> "x"
--           <a>&lt;*&gt;</a> v <a>.:</a> "y"
--   
--       -- We do not expect a non-<a>Object</a> value here.
--       -- We could use <tt>mzero</tt> to fail, but <a>typeMismatch</a>
--       -- gives a much more informative error message.
--       <a>parseJSON</a> invalid    = <a>typeMismatch</a> "Coord" invalid
--   </pre>
--   
--   For this common case of only being concerned with a single type of
--   JSON value, the functions <a>withObject</a>, <tt>withNumber</tt>, etc.
--   are provided. Their use is to be preferred when possible, since they
--   are more terse. Using <a>withObject</a>, we can rewrite the above
--   instance (assuming the same language extension and data type) as:
--   
--   <pre>
--   instance <a>FromJSON</a> Coord where
--       <a>parseJSON</a> = <a>withObject</a> "Coord" $ \v -&gt; Coord
--           <a>&lt;$&gt;</a> v <a>.:</a> "x"
--           <a>&lt;*&gt;</a> v <a>.:</a> "y"
--   </pre>
--   
--   Instead of manually writing your <a>FromJSON</a> instance, there are
--   two options to do it automatically:
--   
--   <ul>
--   <li><a>Data.Aeson.TH</a> provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.</li>
--   <li>The compiler can provide a default generic implementation for
--   <a>parseJSON</a>.</li>
--   </ul>
--   
--   To use the second, simply add a <tt>deriving <a>Generic</a></tt>
--   clause to your datatype and declare a <a>FromJSON</a> instance for
--   your datatype without giving a definition for <a>parseJSON</a>.
--   
--   For example, the previous example can be simplified to just:
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import <a>GHC.Generics</a>
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving <a>Generic</a>
--   
--   instance <a>FromJSON</a> Coord
--   </pre>
--   
--   The default implementation will be equivalent to <tt>parseJSON =
--   <a>genericParseJSON</a> <a>defaultOptions</a></tt>; If you need
--   different options, you can customize the generic decoding by defining:
--   
--   <pre>
--   customOptions = <a>defaultOptions</a>
--                   { <a>fieldLabelModifier</a> = <a>map</a> <a>toUpper</a>
--                   }
--   
--   instance <a>FromJSON</a> Coord where
--       <a>parseJSON</a> = <a>genericParseJSON</a> customOptions
--   </pre>
class FromJSON a
parseJSON :: FromJSON a => Value -> Parser a
parseJSONList :: FromJSON a => Value -> Parser [a]

-- | Read the docs for <tt>ToJSONKey</tt> first. This class is a conversion
--   in the opposite direction. If you have a newtype wrapper around
--   <a>Text</a>, the recommended way to define instances is with
--   generalized newtype deriving:
--   
--   <pre>
--   newtype SomeId = SomeId { getSomeId :: Text }
--     deriving (Eq,Ord,Hashable,FromJSONKey)
--   </pre>
class FromJSONKey a

-- | Strategy for parsing the key of a map-like container.
fromJSONKey :: FromJSONKey a => FromJSONKeyFunction a

-- | This is similar in spirit to the <a>readList</a> method of
--   <a>Read</a>. It makes it possible to give <a>Value</a> keys special
--   treatment without using <tt>OverlappingInstances</tt>. End users
--   should always be able to use the default implementation of this
--   method.
fromJSONKeyList :: FromJSONKey a => FromJSONKeyFunction [a]

-- | This type is related to <tt>ToJSONKeyFunction</tt>. If
--   <a>FromJSONKeyValue</a> is used in the <a>FromJSONKey</a> instance,
--   then <tt>ToJSONKeyValue</tt> should be used in the <tt>ToJSONKey</tt>
--   instance. The other three data constructors for this type all
--   correspond to <tt>ToJSONKeyText</tt>. Strictly speaking,
--   <a>FromJSONKeyTextParser</a> is more powerful than
--   <a>FromJSONKeyText</a>, which is in turn more powerful than
--   <a>FromJSONKeyCoerce</a>. For performance reasons, these exist as
--   three options instead of one.
data FromJSONKeyFunction a

-- | uses <a>coerce</a> (<a>unsafeCoerce</a> in older GHCs)
FromJSONKeyCoerce :: !CoerceText a -> FromJSONKeyFunction a

-- | conversion from <a>Text</a> that always succeeds
FromJSONKeyText :: !Text -> a -> FromJSONKeyFunction a

-- | conversion from <a>Text</a> that may fail
FromJSONKeyTextParser :: !Text -> Parser a -> FromJSONKeyFunction a

-- | conversion for non-textual keys
FromJSONKeyValue :: !Value -> Parser a -> FromJSONKeyFunction a

-- | Lifting of the <a>FromJSON</a> class to unary type constructors.
--   
--   Instead of manually writing your <a>FromJSON1</a> instance, there are
--   two options to do it automatically:
--   
--   <ul>
--   <li><a>Data.Aeson.TH</a> provides Template Haskell functions which
--   will derive an instance at compile time. The generated instance is
--   optimized for your type so it will probably be more efficient than the
--   following option.</li>
--   <li>The compiler can provide a default generic implementation for
--   <a>liftParseJSON</a>.</li>
--   </ul>
--   
--   To use the second, simply add a <tt>deriving <a>Generic1</a></tt>
--   clause to your datatype and declare a <a>FromJSON1</a> instance for
--   your datatype without giving a definition for <a>liftParseJSON</a>.
--   
--   For example:
--   
--   <pre>
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import <a>GHC.Generics</a>
--   
--   data Pair a b = Pair { pairFst :: a, pairSnd :: b } deriving <a>Generic1</a>
--   
--   instance <a>FromJSON</a> a =&gt; <a>FromJSON1</a> (Pair a)
--   </pre>
--   
--   If the default implementation doesn't give exactly the results you
--   want, you can customize the generic decoding with only a tiny amount
--   of effort, using <a>genericLiftParseJSON</a> with your preferred
--   <a>Options</a>:
--   
--   <pre>
--   customOptions = <a>defaultOptions</a>
--                   { <a>fieldLabelModifier</a> = <a>map</a> <a>toUpper</a>
--                   }
--   
--   instance <a>FromJSON</a> a =&gt; <a>FromJSON1</a> (Pair a) where
--       <a>liftParseJSON</a> = <a>genericLiftParseJSON</a> customOptions
--   </pre>
class FromJSON1 (f :: Type -> Type)
liftParseJSON :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a)
liftParseJSONList :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a]

-- | Lifting of the <a>FromJSON</a> class to binary type constructors.
--   
--   Instead of manually writing your <a>FromJSON2</a> instance,
--   <a>Data.Aeson.TH</a> provides Template Haskell functions which will
--   derive an instance at compile time.
class FromJSON2 (f :: Type -> Type -> Type)
liftParseJSON2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b)
liftParseJSONList2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [f a b]

-- | Parse a top-level JSON value.
--   
--   This is a strict version of <a>json</a> which avoids building up
--   thunks during parsing; it performs all conversions immediately. Prefer
--   this version if most of the JSON data needs to be accessed.
--   
--   This function is an alias for <a>value'</a>. In aeson 0.8 and earlier,
--   it parsed only object or array types, in conformance with the
--   now-obsolete RFC 4627.
json' :: Parser Value

-- | Parse a top-level JSON value.
--   
--   The conversion of a parsed value to a Haskell value is deferred until
--   the Haskell value is needed. This may improve performance if only a
--   subset of the results of conversions are needed, but at a cost in
--   thunk allocation.
--   
--   This function is an alias for <a>value</a>. In aeson 0.8 and earlier,
--   it parsed only object or array types, in conformance with the
--   now-obsolete RFC 4627.
json :: Parser Value

-- | Better version of <a>camelTo</a>. Example where it works better:
--   
--   <pre>
--   camelTo '_' 'CamelAPICase' == "camel_apicase"
--   camelTo2 '_' 'CamelAPICase' == "camel_api_case"
--   </pre>
camelTo2 :: Char -> String -> String

-- | Default <a>TaggedObject</a> <a>SumEncoding</a> options:
--   
--   <pre>
--   defaultTaggedObject = <a>TaggedObject</a>
--                         { <a>tagFieldName</a>      = "tag"
--                         , <a>contentsFieldName</a> = "contents"
--                         }
--   </pre>
defaultTaggedObject :: SumEncoding

-- | Default encoding <a>Options</a>:
--   
--   <pre>
--   <a>Options</a>
--   { <a>fieldLabelModifier</a>      = id
--   , <a>constructorTagModifier</a>  = id
--   , <a>allNullaryToStringTag</a>   = True
--   , <a>omitNothingFields</a>       = False
--   , <a>sumEncoding</a>             = <a>defaultTaggedObject</a>
--   , <a>unwrapUnaryRecords</a>      = False
--   , <a>tagSingleConstructors</a>   = False
--   }
--   </pre>
defaultOptions :: Options

-- | Create a <a>Value</a> from a list of name/value <a>Pair</a>s. If
--   duplicate keys arise, earlier keys and their associated values win.
object :: [Pair] -> Value

-- | The result of running a <a>Parser</a>.
data Result a
Error :: String -> Result a
Success :: a -> Result a

-- | A JSON "object" (key/value map).
type Object = HashMap Text Value

-- | A JSON "array" (sequence).
type Array = Vector Value

-- | A JSON value represented as a Haskell value.
data Value
Object :: !Object -> Value
Array :: !Array -> Value
String :: !Text -> Value
Number :: !Scientific -> Value
Bool :: !Bool -> Value
Null :: Value

-- | A newtype wrapper for <a>UTCTime</a> that uses the same non-standard
--   serialization format as Microsoft .NET, whose <a>System.DateTime</a>
--   type is by default serialized to JSON as in the following example:
--   
--   <pre>
--   /Date(1302547608878)/
--   </pre>
--   
--   The number represents milliseconds since the Unix epoch.
newtype DotNetTime
DotNetTime :: UTCTime -> DotNetTime

-- | Acquire the underlying value.
[fromDotNetTime] :: DotNetTime -> UTCTime

-- | Options that specify how to encode/decode your datatype to/from JSON.
--   
--   Options can be set using record syntax on <a>defaultOptions</a> with
--   the fields below.
data Options

-- | Specifies how to encode constructors of a sum datatype.
data SumEncoding

-- | A constructor will be encoded to an object with a field
--   <a>tagFieldName</a> which specifies the constructor tag (modified by
--   the <a>constructorTagModifier</a>). If the constructor is a record the
--   encoded record fields will be unpacked into this object. So make sure
--   that your record doesn't have a field with the same label as the
--   <a>tagFieldName</a>. Otherwise the tag gets overwritten by the encoded
--   value of that field! If the constructor is not a record the encoded
--   constructor contents will be stored under the <a>contentsFieldName</a>
--   field.
TaggedObject :: String -> String -> SumEncoding
[tagFieldName] :: SumEncoding -> String
[contentsFieldName] :: SumEncoding -> String

-- | Constructor names won't be encoded. Instead only the contents of the
--   constructor will be encoded as if the type had a single constructor.
--   JSON encodings have to be disjoint for decoding to work properly.
--   
--   When decoding, constructors are tried in the order of definition. If
--   some encodings overlap, the first one defined will succeed.
--   
--   <i>Note:</i> Nullary constructors are encoded as strings (using
--   <a>constructorTagModifier</a>). Having a nullary constructor alongside
--   a single field constructor that encodes to a string leads to
--   ambiguity.
--   
--   <i>Note:</i> Only the last error is kept when decoding, so in the case
--   of malformed JSON, only an error for the last constructor will be
--   reported.
UntaggedValue :: SumEncoding

-- | A constructor will be encoded to an object with a single field named
--   after the constructor tag (modified by the
--   <a>constructorTagModifier</a>) which maps to the encoded contents of
--   the constructor.
ObjectWithSingleField :: SumEncoding

-- | A constructor will be encoded to a 2-element array where the first
--   element is the tag of the constructor (modified by the
--   <a>constructorTagModifier</a>) and the second element the encoded
--   contents of the constructor.
TwoElemArray :: SumEncoding

-- | A type-level indicator that <tt>ToJSON</tt> or <tt>FromJSON</tt> is
--   being derived generically.
data Zero

-- | A type-level indicator that <tt>ToJSON1</tt> or <tt>FromJSON1</tt> is
--   being derived generically.
data One

-- | Extends <tt>.:</tt> warning to include field name.
(.:) :: FromJSON a => Object -> Text -> Parser a

-- | Extends <tt>.:?</tt> warning to include field name.
(.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a)

-- | Warning output from <a>WarningParser</a>.
data JSONWarning
JSONUnrecognizedFields :: String -> [Text] -> JSONWarning
JSONGeneralWarning :: !Text -> JSONWarning

-- | JSON parser that warns about unexpected fields in objects.
type WarningParser a = WriterT WarningParserMonoid Parser a
data WithJSONWarnings a
WithJSONWarnings :: a -> [JSONWarning] -> WithJSONWarnings a

-- | <a>WarningParser</a> version of <a>withObject</a>.
withObjectWarnings :: String -> (Object -> WarningParser a) -> Value -> Parser (WithJSONWarnings a)

-- | Handle warnings in a sub-object.
jsonSubWarnings :: WarningParser (WithJSONWarnings a) -> WarningParser a

-- | Handle warnings in a <tt>Traversable</tt> of sub-objects.
jsonSubWarningsT :: Traversable t => WarningParser (t (WithJSONWarnings a)) -> WarningParser (t a)

-- | Handle warnings in a <tt>Maybe Traversable</tt> of sub-objects.
jsonSubWarningsTT :: (Traversable t, Traversable u) => WarningParser (u (t (WithJSONWarnings a))) -> WarningParser (u (t a))

-- | Log JSON warnings.
logJSONWarnings :: (MonadReader env m, HasLogFunc env, HasCallStack, MonadIO m) => FilePath -> [JSONWarning] -> m ()
noJSONWarnings :: a -> WithJSONWarnings a

-- | Tell warning parser about an expected field, so it doesn't warn about
--   it.
tellJSONField :: Text -> WarningParser ()

-- | Convert a <a>WarningParser</a> to a <a>Parser</a>.
unWarningParser :: WarningParser a -> Parser a

-- | <a>WarningParser</a> version of <tt>.:</tt>.
(..:) :: FromJSON a => Object -> Text -> WarningParser a

-- | <a>WarningParser</a> version of <tt>.:?</tt>.
(..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a)

-- | <a>WarningParser</a> version of <tt>.!=</tt>.
(..!=) :: WarningParser (Maybe a) -> a -> WarningParser a
instance GHC.Generics.Generic Data.Aeson.Extended.WarningParserMonoid
instance GHC.Show.Show a => GHC.Show.Show (Data.Aeson.Extended.WithJSONWarnings a)
instance GHC.Generics.Generic (Data.Aeson.Extended.WithJSONWarnings a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Aeson.Extended.WithJSONWarnings a)
instance GHC.Classes.Eq Data.Aeson.Extended.JSONWarning
instance GHC.Base.Semigroup Data.Aeson.Extended.WarningParserMonoid
instance GHC.Base.Monoid Data.Aeson.Extended.WarningParserMonoid
instance Data.String.IsString Data.Aeson.Extended.WarningParserMonoid
instance GHC.Base.Functor Data.Aeson.Extended.WithJSONWarnings
instance GHC.Base.Monoid a => GHC.Base.Semigroup (Data.Aeson.Extended.WithJSONWarnings a)
instance GHC.Base.Monoid a => GHC.Base.Monoid (Data.Aeson.Extended.WithJSONWarnings a)
instance GHC.Show.Show Data.Aeson.Extended.JSONWarning
instance Data.String.IsString Data.Aeson.Extended.JSONWarning

module Stack.StaticBytes
data Bytes8
data Bytes16
data Bytes32
data Bytes64
data Bytes128
class DynamicBytes dbytes
class StaticBytes sbytes
data StaticBytesException
NotEnoughBytes :: StaticBytesException
TooManyBytes :: StaticBytesException
toStaticExact :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> Either StaticBytesException sbytes
toStaticPad :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> Either StaticBytesException sbytes
toStaticTruncate :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> Either StaticBytesException sbytes
toStaticPadTruncate :: (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> sbytes
fromStatic :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => sbytes -> dbytes
instance GHC.Classes.Eq Stack.StaticBytes.StaticBytesException
instance GHC.Show.Show Stack.StaticBytes.StaticBytesException
instance Data.Store.Impl.Store Stack.StaticBytes.Bytes128
instance Data.Data.Data Stack.StaticBytes.Bytes128
instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes128
instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes128
instance GHC.Generics.Generic Stack.StaticBytes.Bytes128
instance GHC.Classes.Ord Stack.StaticBytes.Bytes128
instance GHC.Classes.Eq Stack.StaticBytes.Bytes128
instance GHC.Show.Show Stack.StaticBytes.Bytes128
instance Data.Store.Impl.Store Stack.StaticBytes.Bytes64
instance Data.Data.Data Stack.StaticBytes.Bytes64
instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes64
instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes64
instance GHC.Generics.Generic Stack.StaticBytes.Bytes64
instance GHC.Classes.Ord Stack.StaticBytes.Bytes64
instance GHC.Classes.Eq Stack.StaticBytes.Bytes64
instance GHC.Show.Show Stack.StaticBytes.Bytes64
instance Data.Store.Impl.Store Stack.StaticBytes.Bytes32
instance Data.Data.Data Stack.StaticBytes.Bytes32
instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes32
instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes32
instance GHC.Generics.Generic Stack.StaticBytes.Bytes32
instance GHC.Classes.Ord Stack.StaticBytes.Bytes32
instance GHC.Classes.Eq Stack.StaticBytes.Bytes32
instance GHC.Show.Show Stack.StaticBytes.Bytes32
instance Data.Store.Impl.Store Stack.StaticBytes.Bytes16
instance Data.Data.Data Stack.StaticBytes.Bytes16
instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes16
instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes16
instance GHC.Generics.Generic Stack.StaticBytes.Bytes16
instance GHC.Classes.Ord Stack.StaticBytes.Bytes16
instance GHC.Classes.Eq Stack.StaticBytes.Bytes16
instance GHC.Show.Show Stack.StaticBytes.Bytes16
instance Data.Store.Impl.Store Stack.StaticBytes.Bytes8
instance Data.Data.Data Stack.StaticBytes.Bytes8
instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes8
instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes8
instance GHC.Generics.Generic Stack.StaticBytes.Bytes8
instance GHC.Classes.Ord Stack.StaticBytes.Bytes8
instance GHC.Classes.Eq Stack.StaticBytes.Bytes8
instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes8
instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes16
instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes32
instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes64
instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes128
instance GHC.Show.Show Stack.StaticBytes.Bytes8
instance Stack.StaticBytes.DynamicBytes Data.ByteString.Internal.ByteString
instance (word8 Data.Type.Equality.~ GHC.Word.Word8) => Stack.StaticBytes.DynamicBytes (Data.Vector.Storable.Vector word8)
instance (word8 Data.Type.Equality.~ GHC.Word.Word8) => Stack.StaticBytes.DynamicBytes (Data.Vector.Primitive.Vector word8)
instance (word8 Data.Type.Equality.~ GHC.Word.Word8) => Stack.StaticBytes.DynamicBytes (Data.Vector.Unboxed.Base.Vector word8)
instance GHC.Exception.Type.Exception Stack.StaticBytes.StaticBytesException
instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes128
instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes64
instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes32
instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes16
instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes8

module Stack.Types.CompilerBuild
data CompilerBuild
CompilerBuildStandard :: CompilerBuild
CompilerBuildSpecialized :: String -> CompilerBuild

-- | Descriptive name for compiler build
compilerBuildName :: CompilerBuild -> String

-- | Suffix to use for filenames/directories constructed with compiler
--   build
compilerBuildSuffix :: CompilerBuild -> String

-- | Parse compiler build from a String.
parseCompilerBuild :: MonadThrow m => String -> m CompilerBuild
instance GHC.Show.Show Stack.Types.CompilerBuild.CompilerBuild
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.CompilerBuild.CompilerBuild

module Stack.Options.GhcBuildParser

-- | GHC build parser
ghcBuildParser :: Bool -> Parser CompilerBuild


-- | Names for flags.
module Stack.Types.FlagName

-- | A flag name.
data FlagName

-- | A parse fail.
newtype FlagNameParseFail
FlagNameParseFail :: Text -> FlagNameParseFail

-- | Attoparsec parser for a flag name
flagNameParser :: Parser FlagName

-- | Convenient way to parse a flag name from a <a>Text</a>.
parseFlagName :: MonadThrow m => Text -> m FlagName

-- | Convenience function for parsing from a <a>Value</a>
parseFlagNameFromString :: MonadThrow m => String -> m FlagName

-- | Produce a string representation of a flag name.
flagNameString :: FlagName -> String

-- | Produce a string representation of a flag name.
flagNameText :: FlagName -> Text

-- | Convert from a Cabal flag name.
fromCabalFlagName :: FlagName -> FlagName

-- | Convert to a Cabal flag name.
toCabalFlagName :: FlagName -> FlagName

-- | Make a flag name.
mkFlagName :: String -> Q Exp
instance Data.Aeson.Types.ToJSON.ToJSONKey Stack.Types.FlagName.FlagName
instance Control.DeepSeq.NFData Stack.Types.FlagName.FlagName
instance Data.Store.Impl.Store Stack.Types.FlagName.FlagName
instance Data.Hashable.Class.Hashable Stack.Types.FlagName.FlagName
instance GHC.Generics.Generic Stack.Types.FlagName.FlagName
instance Data.Data.Data Stack.Types.FlagName.FlagName
instance GHC.Classes.Eq Stack.Types.FlagName.FlagName
instance GHC.Classes.Ord Stack.Types.FlagName.FlagName
instance Language.Haskell.TH.Syntax.Lift Stack.Types.FlagName.FlagName
instance GHC.Show.Show Stack.Types.FlagName.FlagName
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.FlagName.FlagName
instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.FlagName.FlagName
instance GHC.Exception.Type.Exception Stack.Types.FlagName.FlagNameParseFail
instance GHC.Show.Show Stack.Types.FlagName.FlagNameParseFail


-- | A ghc-pkg id.
module Stack.Types.GhcPkgId

-- | A ghc-pkg package identifier.
data GhcPkgId

-- | A parser for a package-version-hash pair.
ghcPkgIdParser :: Parser GhcPkgId

-- | Convenient way to parse a package name from a <a>Text</a>.
parseGhcPkgId :: MonadThrow m => Text -> m GhcPkgId

-- | Get a string representation of GHC package id.
ghcPkgIdString :: GhcPkgId -> String
instance GHC.Generics.Generic Stack.Types.GhcPkgId.GhcPkgId
instance Data.Data.Data Stack.Types.GhcPkgId.GhcPkgId
instance GHC.Classes.Ord Stack.Types.GhcPkgId.GhcPkgId
instance GHC.Classes.Eq Stack.Types.GhcPkgId.GhcPkgId
instance Data.Hashable.Class.Hashable Stack.Types.GhcPkgId.GhcPkgId
instance Control.DeepSeq.NFData Stack.Types.GhcPkgId.GhcPkgId
instance Data.Store.Impl.Store Stack.Types.GhcPkgId.GhcPkgId
instance GHC.Show.Show Stack.Types.GhcPkgId.GhcPkgId
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.GhcPkgId.GhcPkgId
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.GhcPkgId.GhcPkgId
instance GHC.Show.Show Stack.Types.GhcPkgId.GhcPkgIdParseFail
instance GHC.Exception.Type.Exception Stack.Types.GhcPkgId.GhcPkgIdParseFail

module Stack.Types.Image

-- | Image options. Currently only Docker image options.
newtype ImageOpts
ImageOpts :: [ImageDockerOpts] -> ImageOpts

-- | One or more stanzas for docker image settings.
[imgDockers] :: ImageOpts -> [ImageDockerOpts]
data ImageDockerOpts
ImageDockerOpts :: !Maybe String -> !Maybe [String] -> !Map FilePath (Path Abs Dir) -> !Maybe String -> !Maybe [Path Rel File] -> ImageDockerOpts

-- | Maybe have a docker base image name. (Although we will not be able to
--   create any Docker images without this.)
[imgDockerBase] :: ImageDockerOpts -> !Maybe String

-- | Maybe have a specific ENTRYPOINT list that will be used to create
--   images.
[imgDockerEntrypoints] :: ImageDockerOpts -> !Maybe [String]

-- | Maybe have some static project content to include in a specific
--   directory in all the images.
[imgDockerAdd] :: ImageDockerOpts -> !Map FilePath (Path Abs Dir)

-- | Maybe have a name for the image we are creating
[imgDockerImageName] :: ImageDockerOpts -> !Maybe String

-- | Filenames of executables to add (if Nothing, add them all)
[imgDockerExecutables] :: ImageDockerOpts -> !Maybe [Path Rel File]
newtype ImageOptsMonoid
ImageOptsMonoid :: [ImageDockerOpts] -> ImageOptsMonoid
[imgMonoidDockers] :: ImageOptsMonoid -> [ImageDockerOpts]
imgArgName :: Text
imgDockerOldArgName :: Text
imgDockersArgName :: Text
imgDockerBaseArgName :: Text
imgDockerAddArgName :: Text
imgDockerEntrypointsArgName :: Text
imgDockerImageNameArgName :: Text
imgDockerExecutablesArgName :: Text
instance GHC.Generics.Generic Stack.Types.Image.ImageOptsMonoid
instance GHC.Show.Show Stack.Types.Image.ImageOptsMonoid
instance GHC.Show.Show Stack.Types.Image.ImageOpts
instance GHC.Show.Show Stack.Types.Image.ImageDockerOpts
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Image.ImageOptsMonoid)
instance GHC.Base.Semigroup Stack.Types.Image.ImageOptsMonoid
instance GHC.Base.Monoid Stack.Types.Image.ImageOptsMonoid
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Image.ImageDockerOpts)


-- | Nix types.
module Stack.Types.Nix

-- | Nix configuration. Parameterize by resolver type to avoid cyclic
--   dependency.
data NixOpts
NixOpts :: !Bool -> !Bool -> ![Text] -> !Maybe FilePath -> ![Text] -> !Bool -> NixOpts
[nixEnable] :: NixOpts -> !Bool
[nixPureShell] :: NixOpts -> !Bool

-- | The system packages to be installed in the environment before it runs
[nixPackages] :: NixOpts -> ![Text]

-- | The path of a file containing preconfiguration of the environment (e.g
--   shell.nix)
[nixInitFile] :: NixOpts -> !Maybe FilePath

-- | Options to be given to the nix-shell command line
[nixShellOptions] :: NixOpts -> ![Text]

-- | Should we register gc roots so running nix-collect-garbage doesn't
--   remove nix dependencies
[nixAddGCRoots] :: NixOpts -> !Bool

-- | An uninterpreted representation of nix options. Configurations may be
--   "cascaded" using mappend (left-biased).
data NixOptsMonoid
NixOptsMonoid :: !First Bool -> !First Bool -> !First [Text] -> !First FilePath -> !First [Text] -> !First [Text] -> !First Bool -> NixOptsMonoid

-- | Is using nix-shell enabled?
[nixMonoidEnable] :: NixOptsMonoid -> !First Bool

-- | Should the nix-shell be pure
[nixMonoidPureShell] :: NixOptsMonoid -> !First Bool

-- | System packages to use (given to nix-shell)
[nixMonoidPackages] :: NixOptsMonoid -> !First [Text]

-- | The path of a file containing preconfiguration of the environment (e.g
--   shell.nix)
[nixMonoidInitFile] :: NixOptsMonoid -> !First FilePath

-- | Options to be given to the nix-shell command line
[nixMonoidShellOptions] :: NixOptsMonoid -> !First [Text]

-- | Override parts of NIX_PATH (notably <tt>nixpkgs</tt>)
[nixMonoidPath] :: NixOptsMonoid -> !First [Text]

-- | Should we register gc roots so running nix-collect-garbage doesn't
--   remove nix dependencies
[nixMonoidAddGCRoots] :: NixOptsMonoid -> !First Bool

-- | Nix enable argument name.
nixEnableArgName :: Text

-- | Nix run in pure shell argument name.
nixPureShellArgName :: Text

-- | Nix packages (build inputs) argument name.
nixPackagesArgName :: Text

-- | shell.nix file path argument name.
nixInitFileArgName :: Text

-- | Extra options for the nix-shell command argument name.
nixShellOptsArgName :: Text

-- | NIX_PATH override argument name
nixPathArgName :: Text

-- | Add GC roots arg name
nixAddGCRootsArgName :: Text
instance GHC.Generics.Generic Stack.Types.Nix.NixOptsMonoid
instance GHC.Show.Show Stack.Types.Nix.NixOptsMonoid
instance GHC.Classes.Eq Stack.Types.Nix.NixOptsMonoid
instance GHC.Show.Show Stack.Types.Nix.NixOpts
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Nix.NixOptsMonoid)
instance GHC.Base.Semigroup Stack.Types.Nix.NixOptsMonoid
instance GHC.Base.Monoid Stack.Types.Nix.NixOptsMonoid


-- | Names for packages.
module Stack.Types.PackageName

-- | A package name.
data PackageName

-- | A parse fail.
data PackageNameParseFail
PackageNameParseFail :: Text -> PackageNameParseFail
CabalFileNameParseFail :: FilePath -> PackageNameParseFail
CabalFileNameInvalidPackageName :: FilePath -> PackageNameParseFail

-- | Attoparsec parser for a package name
packageNameParser :: Parser PackageName

-- | Parse a package name from a <a>Text</a>.
parsePackageName :: MonadThrow m => Text -> m PackageName

-- | Parse a package name from a <a>Value</a>.
parsePackageNameFromString :: MonadThrow m => String -> m PackageName

-- | Produce a string representation of a package name.
packageNameString :: PackageName -> String

-- | Produce a string representation of a package name.
packageNameText :: PackageName -> Text

-- | Convert from a Cabal package name.
fromCabalPackageName :: PackageName -> PackageName

-- | Convert to a Cabal package name.
toCabalPackageName :: PackageName -> PackageName

-- | Parse a package name from a file path.
parsePackageNameFromFilePath :: MonadThrow m => Path a File -> m PackageName

-- | Make a package name.
mkPackageName :: String -> Q Exp

-- | An argument which accepts a template name of the format
--   <tt>foo.hsfiles</tt>.
packageNameArgument :: Mod ArgumentFields PackageName -> Parser PackageName
instance Data.Aeson.Types.ToJSON.ToJSONKey Stack.Types.PackageName.PackageName
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageName.PackageName
instance Data.Store.Impl.Store Stack.Types.PackageName.PackageName
instance Control.DeepSeq.NFData Stack.Types.PackageName.PackageName
instance Data.Hashable.Class.Hashable Stack.Types.PackageName.PackageName
instance GHC.Generics.Generic Stack.Types.PackageName.PackageName
instance Data.Data.Data Stack.Types.PackageName.PackageName
instance GHC.Classes.Ord Stack.Types.PackageName.PackageName
instance GHC.Classes.Eq Stack.Types.PackageName.PackageName
instance Language.Haskell.TH.Syntax.Lift Stack.Types.PackageName.PackageName
instance GHC.Show.Show Stack.Types.PackageName.PackageName
instance RIO.Prelude.Display.Display Stack.Types.PackageName.PackageName
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageName.PackageName
instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.PackageName.PackageName
instance GHC.Exception.Type.Exception Stack.Types.PackageName.PackageNameParseFail
instance GHC.Show.Show Stack.Types.PackageName.PackageNameParseFail

module Stack.Types.NamedComponent

-- | A single, fully resolved component of a package
data NamedComponent
CLib :: NamedComponent
CInternalLib :: !Text -> NamedComponent
CExe :: !Text -> NamedComponent
CTest :: !Text -> NamedComponent
CBench :: !Text -> NamedComponent
renderComponent :: NamedComponent -> Text
renderPkgComponents :: [(PackageName, NamedComponent)] -> Text
renderPkgComponent :: (PackageName, NamedComponent) -> Text
exeComponents :: Set NamedComponent -> Set Text
testComponents :: Set NamedComponent -> Set Text
benchComponents :: Set NamedComponent -> Set Text
internalLibComponents :: Set NamedComponent -> Set Text
isCLib :: NamedComponent -> Bool
isCInternalLib :: NamedComponent -> Bool
isCExe :: NamedComponent -> Bool
isCTest :: NamedComponent -> Bool
isCBench :: NamedComponent -> Bool
instance GHC.Classes.Ord Stack.Types.NamedComponent.NamedComponent
instance GHC.Classes.Eq Stack.Types.NamedComponent.NamedComponent
instance GHC.Show.Show Stack.Types.NamedComponent.NamedComponent


-- | Configuration options for building.
module Stack.Types.Config.Build

-- | Build options that is interpreted by the build command. This is built
--   up from BuildOptsCLI and BuildOptsMonoid
data BuildOpts
BuildOpts :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !HaddockOpts -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe Bool -> !Maybe Bool -> !Bool -> !Bool -> !TestOpts -> !Bool -> !BenchmarkOpts -> !Bool -> !Bool -> !Bool -> ![Text] -> !Bool -> BuildOpts
[boptsLibProfile] :: BuildOpts -> !Bool
[boptsExeProfile] :: BuildOpts -> !Bool
[boptsLibStrip] :: BuildOpts -> !Bool
[boptsExeStrip] :: BuildOpts -> !Bool

-- | Build haddocks?
[boptsHaddock] :: BuildOpts -> !Bool

-- | Options to pass to haddock
[boptsHaddockOpts] :: BuildOpts -> !HaddockOpts

-- | Open haddocks in the browser?
[boptsOpenHaddocks] :: BuildOpts -> !Bool

-- | Build haddocks for dependencies?
[boptsHaddockDeps] :: BuildOpts -> !Maybe Bool

-- | Build haddocks for all symbols and packages, like <tt>cabal haddock
--   --internal</tt>
[boptsHaddockInternal] :: BuildOpts -> !Bool

-- | Build hyperlinked source if possible. Fallback to <tt>hscolour</tt>.
--   Disable for no sources.
[boptsHaddockHyperlinkSource] :: BuildOpts -> !Bool

-- | Install executables to user path after building?
[boptsInstallExes] :: BuildOpts -> !Bool

-- | Install executables to compiler tools path after building?
[boptsInstallCompilerTool] :: BuildOpts -> !Bool

-- | Fetch all packages immediately ^ Watch files for changes and
--   automatically rebuild
[boptsPreFetch] :: BuildOpts -> !Bool

-- | Keep building/running after failure
[boptsKeepGoing] :: BuildOpts -> !Maybe Bool

-- | Keep intermediate files and build directories
[boptsKeepTmpFiles] :: BuildOpts -> !Maybe Bool

-- | Force treating all local packages as having dirty files
[boptsForceDirty] :: BuildOpts -> !Bool

-- | Turn on tests for local targets
[boptsTests] :: BuildOpts -> !Bool

-- | Additional test arguments
[boptsTestOpts] :: BuildOpts -> !TestOpts

-- | Turn on benchmarks for local targets
[boptsBenchmarks] :: BuildOpts -> !Bool

-- | Additional test arguments ^ Commands (with arguments) to run after a
--   successful build ^ Only perform the configure step when building
[boptsBenchmarkOpts] :: BuildOpts -> !BenchmarkOpts

-- | Perform the configure step even if already configured
[boptsReconfigure] :: BuildOpts -> !Bool

-- | Ask Cabal to be verbose in its builds
[boptsCabalVerbose] :: BuildOpts -> !Bool

-- | Whether to enable split-objs.
[boptsSplitObjs] :: BuildOpts -> !Bool

-- | Which components to skip when building
[boptsSkipComponents] :: BuildOpts -> ![Text]

-- | Should we use the interleaved GHC output when building multiple
--   packages?
[boptsInterleavedOutput] :: BuildOpts -> !Bool

-- | Command sum type for conditional arguments.
data BuildCommand
Build :: BuildCommand
Test :: BuildCommand
Haddock :: BuildCommand
Bench :: BuildCommand
Install :: BuildCommand
defaultBuildOpts :: BuildOpts
defaultBuildOptsCLI :: BuildOptsCLI

-- | Build options that may only be specified from the CLI
data BuildOptsCLI
BuildOptsCLI :: ![Text] -> !Bool -> ![Text] -> !Map (Maybe PackageName) (Map FlagName Bool) -> !BuildSubset -> !FileWatchOpts -> ![(String, [String])] -> !Bool -> !BuildCommand -> !Bool -> BuildOptsCLI
[boptsCLITargets] :: BuildOptsCLI -> ![Text]
[boptsCLIDryrun] :: BuildOptsCLI -> !Bool
[boptsCLIGhcOptions] :: BuildOptsCLI -> ![Text]
[boptsCLIFlags] :: BuildOptsCLI -> !Map (Maybe PackageName) (Map FlagName Bool)
[boptsCLIBuildSubset] :: BuildOptsCLI -> !BuildSubset
[boptsCLIFileWatch] :: BuildOptsCLI -> !FileWatchOpts
[boptsCLIExec] :: BuildOptsCLI -> ![(String, [String])]
[boptsCLIOnlyConfigure] :: BuildOptsCLI -> !Bool
[boptsCLICommand] :: BuildOptsCLI -> !BuildCommand
[boptsCLIInitialBuildSteps] :: BuildOptsCLI -> !Bool

-- | Build options that may be specified in the stack.yaml or from the CLI
data BuildOptsMonoid
BuildOptsMonoid :: !Any -> !Any -> !Any -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !HaddockOptsMonoid -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !TestOptsMonoid -> !First Bool -> !BenchmarkOptsMonoid -> !First Bool -> !First Bool -> !First Bool -> ![Text] -> !First Bool -> BuildOptsMonoid
[buildMonoidTrace] :: BuildOptsMonoid -> !Any
[buildMonoidProfile] :: BuildOptsMonoid -> !Any
[buildMonoidNoStrip] :: BuildOptsMonoid -> !Any
[buildMonoidLibProfile] :: BuildOptsMonoid -> !First Bool
[buildMonoidExeProfile] :: BuildOptsMonoid -> !First Bool
[buildMonoidLibStrip] :: BuildOptsMonoid -> !First Bool
[buildMonoidExeStrip] :: BuildOptsMonoid -> !First Bool
[buildMonoidHaddock] :: BuildOptsMonoid -> !First Bool
[buildMonoidHaddockOpts] :: BuildOptsMonoid -> !HaddockOptsMonoid
[buildMonoidOpenHaddocks] :: BuildOptsMonoid -> !First Bool
[buildMonoidHaddockDeps] :: BuildOptsMonoid -> !First Bool
[buildMonoidHaddockInternal] :: BuildOptsMonoid -> !First Bool
[buildMonoidHaddockHyperlinkSource] :: BuildOptsMonoid -> !First Bool
[buildMonoidInstallExes] :: BuildOptsMonoid -> !First Bool
[buildMonoidInstallCompilerTool] :: BuildOptsMonoid -> !First Bool
[buildMonoidPreFetch] :: BuildOptsMonoid -> !First Bool
[buildMonoidKeepGoing] :: BuildOptsMonoid -> !First Bool
[buildMonoidKeepTmpFiles] :: BuildOptsMonoid -> !First Bool
[buildMonoidForceDirty] :: BuildOptsMonoid -> !First Bool
[buildMonoidTests] :: BuildOptsMonoid -> !First Bool
[buildMonoidTestOpts] :: BuildOptsMonoid -> !TestOptsMonoid
[buildMonoidBenchmarks] :: BuildOptsMonoid -> !First Bool
[buildMonoidBenchmarkOpts] :: BuildOptsMonoid -> !BenchmarkOptsMonoid
[buildMonoidReconfigure] :: BuildOptsMonoid -> !First Bool
[buildMonoidCabalVerbose] :: BuildOptsMonoid -> !First Bool
[buildMonoidSplitObjs] :: BuildOptsMonoid -> !First Bool
[buildMonoidSkipComponents] :: BuildOptsMonoid -> ![Text]
[buildMonoidInterleavedOutput] :: BuildOptsMonoid -> !First Bool

-- | Options for the <tt>FinalAction</tt> <tt>DoTests</tt>
data TestOpts
TestOpts :: !Bool -> ![String] -> !Bool -> !Bool -> TestOpts

-- | Whether successful tests will be run gain
[toRerunTests] :: TestOpts -> !Bool

-- | Arguments passed to the test program
[toAdditionalArgs] :: TestOpts -> ![String]

-- | Generate a code coverage report
[toCoverage] :: TestOpts -> !Bool

-- | Disable running of tests
[toDisableRun] :: TestOpts -> !Bool
defaultTestOpts :: TestOpts
data TestOptsMonoid
TestOptsMonoid :: !First Bool -> ![String] -> !First Bool -> !First Bool -> TestOptsMonoid
[toMonoidRerunTests] :: TestOptsMonoid -> !First Bool
[toMonoidAdditionalArgs] :: TestOptsMonoid -> ![String]
[toMonoidCoverage] :: TestOptsMonoid -> !First Bool
[toMonoidDisableRun] :: TestOptsMonoid -> !First Bool

-- | Haddock Options
newtype HaddockOpts
HaddockOpts :: [String] -> HaddockOpts

-- | Arguments passed to haddock program
[hoAdditionalArgs] :: HaddockOpts -> [String]
defaultHaddockOpts :: HaddockOpts
newtype HaddockOptsMonoid
HaddockOptsMonoid :: [String] -> HaddockOptsMonoid
[hoMonoidAdditionalArgs] :: HaddockOptsMonoid -> [String]

-- | Options for the <tt>FinalAction</tt> <tt>DoBenchmarks</tt>
data BenchmarkOpts
BenchmarkOpts :: !Maybe String -> !Bool -> BenchmarkOpts

-- | Arguments passed to the benchmark program
[beoAdditionalArgs] :: BenchmarkOpts -> !Maybe String

-- | Disable running of benchmarks
[beoDisableRun] :: BenchmarkOpts -> !Bool
defaultBenchmarkOpts :: BenchmarkOpts
data BenchmarkOptsMonoid
BenchmarkOptsMonoid :: !First String -> !First Bool -> BenchmarkOptsMonoid
[beoMonoidAdditionalArgs] :: BenchmarkOptsMonoid -> !First String
[beoMonoidDisableRun] :: BenchmarkOptsMonoid -> !First Bool
data FileWatchOpts
NoFileWatch :: FileWatchOpts
FileWatch :: FileWatchOpts
FileWatchPoll :: FileWatchOpts

-- | Which subset of packages to build
data BuildSubset
BSAll :: BuildSubset

-- | Only install packages in the snapshot database, skipping packages
--   intended for the local database.
BSOnlySnapshot :: BuildSubset
BSOnlyDependencies :: BuildSubset
instance GHC.Show.Show Stack.Types.Config.Build.BuildOptsCLI
instance GHC.Classes.Eq Stack.Types.Config.Build.FileWatchOpts
instance GHC.Show.Show Stack.Types.Config.Build.FileWatchOpts
instance GHC.Generics.Generic Stack.Types.Config.Build.BuildOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.BuildOptsMonoid
instance GHC.Generics.Generic Stack.Types.Config.Build.BenchmarkOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.BenchmarkOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.BuildOpts
instance GHC.Show.Show Stack.Types.Config.Build.BenchmarkOpts
instance GHC.Classes.Eq Stack.Types.Config.Build.BenchmarkOpts
instance GHC.Generics.Generic Stack.Types.Config.Build.HaddockOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.HaddockOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.HaddockOpts
instance GHC.Classes.Eq Stack.Types.Config.Build.HaddockOpts
instance GHC.Generics.Generic Stack.Types.Config.Build.TestOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.TestOptsMonoid
instance GHC.Show.Show Stack.Types.Config.Build.TestOpts
instance GHC.Classes.Eq Stack.Types.Config.Build.TestOpts
instance GHC.Classes.Eq Stack.Types.Config.Build.BuildSubset
instance GHC.Show.Show Stack.Types.Config.Build.BuildSubset
instance GHC.Show.Show Stack.Types.Config.Build.BuildCommand
instance GHC.Classes.Eq Stack.Types.Config.Build.BuildCommand
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.BuildOptsMonoid)
instance GHC.Base.Semigroup Stack.Types.Config.Build.BuildOptsMonoid
instance GHC.Base.Monoid Stack.Types.Config.Build.BuildOptsMonoid
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.BenchmarkOptsMonoid)
instance GHC.Base.Semigroup Stack.Types.Config.Build.BenchmarkOptsMonoid
instance GHC.Base.Monoid Stack.Types.Config.Build.BenchmarkOptsMonoid
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.HaddockOptsMonoid)
instance GHC.Base.Semigroup Stack.Types.Config.Build.HaddockOptsMonoid
instance GHC.Base.Monoid Stack.Types.Config.Build.HaddockOptsMonoid
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.TestOptsMonoid)
instance GHC.Base.Semigroup Stack.Types.Config.Build.TestOptsMonoid
instance GHC.Base.Monoid Stack.Types.Config.Build.TestOptsMonoid

module Stack.Options.PackageParser

-- | Parser for package:[-]flag
readFlag :: ReadM (Map (Maybe PackageName) (Map FlagName Bool))


module Stack.Types.Sig

-- | A GPG signature.
newtype Signature
Signature :: ByteString -> Signature

-- | The GPG fingerprint.
data Fingerprint
mkFingerprint :: Text -> Fingerprint

-- | Exceptions
data SigException
GPGFingerprintException :: String -> SigException
GPGNotFoundException :: SigException
GPGSignException :: String -> SigException
GPGVerifyException :: String -> SigException
SigInvalidSDistTarBall :: SigException
SigNoProjectRootException :: SigException
SigServiceException :: String -> SigException
instance GHC.Classes.Eq a => GHC.Classes.Eq (Stack.Types.Sig.Aeson a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Stack.Types.Sig.Aeson a)
instance GHC.Classes.Ord Stack.Types.Sig.Fingerprint
instance GHC.Classes.Eq Stack.Types.Sig.Fingerprint
instance GHC.Classes.Eq Stack.Types.Sig.Signature
instance GHC.Classes.Ord Stack.Types.Sig.Signature
instance GHC.Exception.Type.Exception Stack.Types.Sig.SigException
instance GHC.Show.Show Stack.Types.Sig.SigException
instance Data.Aeson.Types.FromJSON.FromJSON (Stack.Types.Sig.Aeson Stack.Types.PackageName.PackageName)
instance GHC.Show.Show Stack.Types.Sig.Fingerprint
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Sig.Fingerprint
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Sig.Fingerprint
instance Data.String.IsString Stack.Types.Sig.Fingerprint
instance GHC.Show.Show Stack.Types.Sig.Signature


module Stack.Sig.GPG

-- | Sign a file path with GPG, returning the <tt>Signature</tt>.
gpgSign :: HasLogFunc env => Path Abs File -> RIO env Signature

-- | Verify the <tt>Signature</tt> of a file path returning the
--   <tt>Fingerprint</tt>.
gpgVerify :: (MonadIO m, MonadThrow m) => Signature -> Path Abs File -> m Fingerprint


-- | Template name handling.
module Stack.Types.TemplateName

-- | A template name.
data TemplateName

-- | Details for how to access a template from a remote repo.
data RepoTemplatePath
RepoTemplatePath :: RepoService -> Text -> Text -> RepoTemplatePath
[rtpService] :: RepoTemplatePath -> RepoService
[rtpUser] :: RepoTemplatePath -> Text
[rtpTemplate] :: RepoTemplatePath -> Text

-- | Services from which templates can be retrieved from a repository.
data RepoService
Github :: RepoService
Gitlab :: RepoService
Bitbucket :: RepoService
data TemplatePath

-- | an absolute path on the filesystem
AbsPath :: Path Abs File -> TemplatePath

-- | a relative path on the filesystem, or relative to the template
--   repository
RelPath :: Path Rel File -> TemplatePath

-- | a full URL
UrlPath :: String -> TemplatePath
RepoPath :: RepoTemplatePath -> TemplatePath

-- | Make a template name.
mkTemplateName :: String -> Q Exp

-- | Get a text representation of the template name.
templateName :: TemplateName -> Text

-- | Get the path of the template.
templatePath :: TemplateName -> TemplatePath

-- | Parse a template name from a string.
parseTemplateNameFromString :: String -> Either String TemplateName

-- | Parses a template path of the form <tt>user/template</tt>, given a
--   service
parseRepoPathWithService :: RepoService -> Text -> Maybe RepoTemplatePath

-- | An argument which accepts a template name of the format
--   <tt>foo.hsfiles</tt> or <tt>foo</tt>, ultimately normalized to
--   <tt>foo</tt>.
templateNameArgument :: Mod ArgumentFields TemplateName -> Parser TemplateName

-- | An argument which accepts a <tt>key:value</tt> pair for specifying
--   parameters.
templateParamArgument :: Mod OptionFields (Text, Text) -> Parser (Text, Text)
instance GHC.Show.Show Stack.Types.TemplateName.TemplateName
instance GHC.Classes.Eq Stack.Types.TemplateName.TemplateName
instance GHC.Classes.Ord Stack.Types.TemplateName.TemplateName
instance GHC.Show.Show Stack.Types.TemplateName.TemplatePath
instance GHC.Classes.Ord Stack.Types.TemplateName.TemplatePath
instance GHC.Classes.Eq Stack.Types.TemplateName.TemplatePath
instance GHC.Show.Show Stack.Types.TemplateName.RepoTemplatePath
instance GHC.Classes.Ord Stack.Types.TemplateName.RepoTemplatePath
instance GHC.Classes.Eq Stack.Types.TemplateName.RepoTemplatePath
instance GHC.Show.Show Stack.Types.TemplateName.RepoService
instance GHC.Classes.Ord Stack.Types.TemplateName.RepoService
instance GHC.Classes.Eq Stack.Types.TemplateName.RepoService
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.TemplateName.TemplateName

module Stack.Types.Urls
data Urls
Urls :: !Text -> !Text -> !Text -> Urls
[urlsLatestSnapshot] :: Urls -> !Text
[urlsLtsBuildPlans] :: Urls -> !Text
[urlsNightlyBuildPlans] :: Urls -> !Text
data UrlsMonoid
UrlsMonoid :: !First Text -> !First Text -> !First Text -> UrlsMonoid
[urlsMonoidLatestSnapshot] :: UrlsMonoid -> !First Text
[urlsMonoidLtsBuildPlans] :: UrlsMonoid -> !First Text
[urlsMonoidNightlyBuildPlans] :: UrlsMonoid -> !First Text
instance GHC.Generics.Generic Stack.Types.Urls.UrlsMonoid
instance GHC.Show.Show Stack.Types.Urls.UrlsMonoid
instance GHC.Show.Show Stack.Types.Urls.Urls
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Urls.UrlsMonoid)
instance GHC.Base.Semigroup Stack.Types.Urls.UrlsMonoid
instance GHC.Base.Monoid Stack.Types.Urls.UrlsMonoid
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Urls.Urls)

module Stack.Config.Urls
urlsFromMonoid :: UrlsMonoid -> Urls


-- | Versions for packages.
module Stack.Types.Version

-- | A package version.
data Version
data VersionRange
newtype IntersectingVersionRange
IntersectingVersionRange :: VersionRange -> IntersectingVersionRange
[getIntersectingVersionRange] :: IntersectingVersionRange -> VersionRange
data VersionCheck
MatchMinor :: VersionCheck
MatchExact :: VersionCheck
NewerMinor :: VersionCheck

-- | Attoparsec parser for a package version.
versionParser :: Parser Version

-- | Convenient way to parse a package version from a <a>Text</a>.
parseVersion :: MonadThrow m => Text -> m Version

-- | Migration function.
parseVersionFromString :: MonadThrow m => String -> m Version

-- | Get a string representation of a package version.
versionString :: Version -> String

-- | Get a string representation of a package version.
versionText :: Version -> Text

-- | Convert to a Cabal version.
toCabalVersion :: Version -> Version

-- | Convert from a Cabal version.
fromCabalVersion :: Version -> Version

-- | Make a package version.
mkVersion :: String -> Q Exp

-- | Display a version range
versionRangeText :: VersionRange -> Text

-- | Check if a version is within a version range.
withinRange :: Version -> VersionRange -> Bool

-- | A modified intersection which also simplifies, for better display.
intersectVersionRanges :: VersionRange -> VersionRange -> VersionRange

-- | Returns the first two components, defaulting to 0 if not present
toMajorVersion :: Version -> Version

-- | Given a version range and a set of versions, find the latest version
--   from the set that is within the range.
latestApplicableVersion :: VersionRange -> Set Version -> Maybe Version
checkVersion :: VersionCheck -> Version -> Version -> Bool

-- | Get the next major version number for the given version
nextMajorVersion :: Version -> Version

-- | A Package upgrade; Latest or a specific version.
data UpgradeTo
Specific :: Version -> UpgradeTo
Latest :: UpgradeTo

-- | Get minor version (excludes any patchlevel)
minorVersion :: Version -> Version

-- | Current Stack version
stackVersion :: Version

-- | Current Stack minor version (excludes patchlevel)
stackMinorVersion :: Version
instance GHC.Classes.Ord Stack.Types.Version.VersionCheck
instance GHC.Classes.Eq Stack.Types.Version.VersionCheck
instance GHC.Show.Show Stack.Types.Version.VersionCheck
instance GHC.Show.Show Stack.Types.Version.IntersectingVersionRange
instance GHC.Show.Show Stack.Types.Version.UpgradeTo
instance Control.DeepSeq.NFData Stack.Types.Version.Version
instance Data.Store.Impl.Store Stack.Types.Version.Version
instance GHC.Generics.Generic Stack.Types.Version.Version
instance Data.Data.Data Stack.Types.Version.Version
instance GHC.Classes.Ord Stack.Types.Version.Version
instance GHC.Classes.Eq Stack.Types.Version.Version
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Version.VersionCheck
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Version.VersionCheck
instance GHC.Base.Semigroup Stack.Types.Version.IntersectingVersionRange
instance GHC.Base.Monoid Stack.Types.Version.IntersectingVersionRange
instance Data.Hashable.Class.Hashable Stack.Types.Version.Version
instance Language.Haskell.TH.Syntax.Lift Stack.Types.Version.Version
instance GHC.Show.Show Stack.Types.Version.Version
instance RIO.Prelude.Display.Display Stack.Types.Version.Version
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Version.Version
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Version.Version
instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.Version.Version
instance GHC.Exception.Type.Exception Stack.Types.Version.VersionParseFail
instance GHC.Show.Show Stack.Types.Version.VersionParseFail


-- | Package identifier (name-version).
module Stack.Types.PackageIdentifier

-- | A pkg-ver combination.
data PackageIdentifier
PackageIdentifier :: !PackageName -> !Version -> PackageIdentifier

-- | Get the name part of the identifier.
[packageIdentifierName] :: PackageIdentifier -> !PackageName

-- | Get the version part of the identifier.
[packageIdentifierVersion] :: PackageIdentifier -> !Version

-- | A <a>PackageIdentifier</a> combined with optionally specified Hackage
--   cabal file revision.
data PackageIdentifierRevision
PackageIdentifierRevision :: !PackageIdentifier -> !CabalFileInfo -> PackageIdentifierRevision
[pirIdent] :: PackageIdentifierRevision -> !PackageIdentifier
[pirRevision] :: PackageIdentifierRevision -> !CabalFileInfo

-- | A cryptographic hash of a Cabal file.
data CabalHash

-- | Generate a <a>CabalHash</a> value from a base16-encoded SHA256 hash.
mkCabalHashFromSHA256 :: Text -> Either SomeException CabalHash

-- | Compute a <a>CabalHash</a> value from a cabal file's contents.
computeCabalHash :: ByteString -> CabalHash
showCabalHash :: CabalHash -> Text

-- | Information on the contents of a cabal file
data CabalFileInfo

-- | Take the latest revision of the cabal file available. This isn't
--   reproducible at all, but the running assumption (not necessarily true)
--   is that cabal file revisions do not change semantics of the build.
CFILatest :: CabalFileInfo

-- | Identify by contents of the cabal file itself
CFIHash :: !Maybe Int -> !CabalHash -> CabalFileInfo

-- | Identify by revision number, with 0 being the original and counting
--   upward.
CFIRevision :: !Word -> CabalFileInfo

-- | Convert from a package identifier to a tuple.
toTuple :: PackageIdentifier -> (PackageName, Version)

-- | Convert from a tuple to a package identifier.
fromTuple :: (PackageName, Version) -> PackageIdentifier

-- | Convenient way to parse a package identifier from a <a>Text</a>.
parsePackageIdentifier :: MonadThrow m => Text -> m PackageIdentifier

-- | Convenience function for parsing from a <a>Value</a>.
parsePackageIdentifierFromString :: MonadThrow m => String -> m PackageIdentifier

-- | Parse a <a>PackageIdentifierRevision</a>
parsePackageIdentifierRevision :: MonadThrow m => Text -> m PackageIdentifierRevision

-- | A parser for a package-version pair.
packageIdentifierParser :: Parser PackageIdentifier

-- | Get a string representation of the package identifier; name-ver.
packageIdentifierString :: PackageIdentifier -> String

-- | Get a string representation of the package identifier with revision;
--   name-ver[@hashtype:hash[,size]].
packageIdentifierRevisionString :: PackageIdentifierRevision -> String

-- | Get a Text representation of the package identifier; name-ver.
packageIdentifierText :: PackageIdentifier -> Text
toCabalPackageIdentifier :: PackageIdentifier -> PackageIdentifier
fromCabalPackageIdentifier :: PackageIdentifier -> PackageIdentifier

-- | A SHA256 hash, stored in a static size for more efficient
--   serialization with store.
data StaticSHA256

-- | Generate a <a>StaticSHA256</a> value from a base16-encoded SHA256
--   hash.
mkStaticSHA256FromText :: Text -> Either SomeException StaticSHA256

-- | Generate a <a>StaticSHA256</a> value from the contents of a file.
mkStaticSHA256FromFile :: MonadIO m => Path Abs File -> m StaticSHA256
mkStaticSHA256FromDigest :: Digest SHA256 -> StaticSHA256

-- | Convert a <a>StaticSHA256</a> into a base16-encoded SHA256 hash.
staticSHA256ToText :: StaticSHA256 -> Text

-- | Convert a <a>StaticSHA256</a> into a base16-encoded SHA256 hash.
staticSHA256ToBase16 :: StaticSHA256 -> ByteString
staticSHA256ToRaw :: StaticSHA256 -> ByteString
instance Data.Data.Data Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance GHC.Generics.Generic Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance GHC.Classes.Ord Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance GHC.Classes.Eq Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance Data.Data.Data Stack.Types.PackageIdentifier.CabalFileInfo
instance GHC.Classes.Ord Stack.Types.PackageIdentifier.CabalFileInfo
instance GHC.Classes.Eq Stack.Types.PackageIdentifier.CabalFileInfo
instance GHC.Show.Show Stack.Types.PackageIdentifier.CabalFileInfo
instance GHC.Generics.Generic Stack.Types.PackageIdentifier.CabalFileInfo
instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.CabalHash
instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.CabalHash
instance GHC.Classes.Ord Stack.Types.PackageIdentifier.CabalHash
instance Data.Data.Data Stack.Types.PackageIdentifier.CabalHash
instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.CabalHash
instance GHC.Classes.Eq Stack.Types.PackageIdentifier.CabalHash
instance GHC.Show.Show Stack.Types.PackageIdentifier.CabalHash
instance GHC.Generics.Generic Stack.Types.PackageIdentifier.CabalHash
instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.StaticSHA256
instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.StaticSHA256
instance GHC.Classes.Ord Stack.Types.PackageIdentifier.StaticSHA256
instance Data.Data.Data Stack.Types.PackageIdentifier.StaticSHA256
instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.StaticSHA256
instance GHC.Classes.Eq Stack.Types.PackageIdentifier.StaticSHA256
instance GHC.Show.Show Stack.Types.PackageIdentifier.StaticSHA256
instance GHC.Generics.Generic Stack.Types.PackageIdentifier.StaticSHA256
instance Data.Data.Data Stack.Types.PackageIdentifier.PackageIdentifier
instance GHC.Generics.Generic Stack.Types.PackageIdentifier.PackageIdentifier
instance GHC.Classes.Ord Stack.Types.PackageIdentifier.PackageIdentifier
instance GHC.Classes.Eq Stack.Types.PackageIdentifier.PackageIdentifier
instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance GHC.Show.Show Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIdentifier.PackageIdentifierRevision
instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.CabalFileInfo
instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.CabalFileInfo
instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.CabalFileInfo
instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.PackageIdentifier
instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.PackageIdentifier
instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.PackageIdentifier
instance GHC.Show.Show Stack.Types.PackageIdentifier.PackageIdentifier
instance RIO.Prelude.Display.Display Stack.Types.PackageIdentifier.PackageIdentifier
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageIdentifier.PackageIdentifier
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIdentifier.PackageIdentifier
instance GHC.Show.Show Stack.Types.PackageIdentifier.PackageIdentifierParseFail
instance GHC.Exception.Type.Exception Stack.Types.PackageIdentifier.PackageIdentifierParseFail

module Stack.Types.PackageIndex
data PackageDownload
PackageDownload :: !StaticSHA256 -> !ByteString -> !Word64 -> PackageDownload
[pdSHA256] :: PackageDownload -> !StaticSHA256
[pdUrl] :: PackageDownload -> !ByteString
[pdSize] :: PackageDownload -> !Word64

-- | Hackage Security provides a different JSON format, we'll have our own
--   JSON parser for it.
newtype HSPackageDownload
HSPackageDownload :: PackageDownload -> HSPackageDownload
[unHSPackageDownload] :: HSPackageDownload -> PackageDownload

-- | Cached information about packages in an index. We have a mapping from
--   package name to a version map. Within the version map, we map from the
--   version to information on an individual version. Each version has
--   optional download information (about the package's tarball itself),
--   and cabal file information. The cabal file information is a non-empty
--   list of all cabal file revisions. Each file revision indicates the
--   hash of the contents of the cabal file, and the offset into the index
--   tarball.
--   
--   The reason for each <a>Version</a> mapping to a two element list of
--   <a>CabalHash</a>es is because some older Stackage snapshots have CRs
--   in their cabal files. For compatibility with these older snapshots,
--   both hashes are stored: the first element of the two element list
--   being the original hash, and the (potential) second element with the
--   CRs stripped. [Note: This is was initially stored as a two element
--   list, and cannot be easily packed into more explict ADT or newtype
--   because of some template-haskell that would need to be modified as
--   well: the <tt>versionedDecodeOrLoad</tt> function call found in the
--   <tt>getPackageCaches</tt> function in <a>PackageIndex</a>.]
--   
--   It's assumed that cabal files appear in the index tarball in the
--   correct revision order.
newtype PackageCache index
PackageCache :: HashMap PackageName (HashMap Version (index, Maybe PackageDownload, NonEmpty ([CabalHash], OffsetSize))) -> PackageCache index

-- | offset in bytes into the 01-index.tar file for the .cabal file
--   contents, and size in bytes of the .cabal file
data OffsetSize
OffsetSize :: !Int64 -> !Int64 -> OffsetSize

-- | Information on a single package index
data PackageIndex
PackageIndex :: !IndexName -> !Text -> !IndexType -> !Text -> !Bool -> PackageIndex
[indexName] :: PackageIndex -> !IndexName

-- | URL for the tarball or, in the case of Hackage Security, the root of
--   the directory
[indexLocation] :: PackageIndex -> !Text
[indexType] :: PackageIndex -> !IndexType

-- | URL prefix for downloading packages
[indexDownloadPrefix] :: PackageIndex -> !Text

-- | Require that hashes and package size information be available for
--   packages in this index
[indexRequireHashes] :: PackageIndex -> !Bool

-- | Unique name for a package index
newtype IndexName
IndexName :: ByteString -> IndexName
[unIndexName] :: IndexName -> ByteString
indexNameText :: IndexName -> Text
data IndexType
ITHackageSecurity :: !HackageSecurity -> IndexType
ITVanilla :: IndexType
data HackageSecurity
HackageSecurity :: ![Text] -> !Int -> HackageSecurity
[hsKeyIds] :: HackageSecurity -> ![Text]
[hsKeyThreshold] :: HackageSecurity -> !Int
instance GHC.Show.Show Stack.Types.PackageIndex.PackageIndex
instance GHC.Classes.Ord Stack.Types.PackageIndex.IndexType
instance GHC.Classes.Eq Stack.Types.PackageIndex.IndexType
instance GHC.Show.Show Stack.Types.PackageIndex.IndexType
instance GHC.Classes.Ord Stack.Types.PackageIndex.HackageSecurity
instance GHC.Classes.Eq Stack.Types.PackageIndex.HackageSecurity
instance GHC.Show.Show Stack.Types.PackageIndex.HackageSecurity
instance Data.Store.Impl.Store Stack.Types.PackageIndex.IndexName
instance Data.Hashable.Class.Hashable Stack.Types.PackageIndex.IndexName
instance GHC.Classes.Ord Stack.Types.PackageIndex.IndexName
instance GHC.Classes.Eq Stack.Types.PackageIndex.IndexName
instance GHC.Show.Show Stack.Types.PackageIndex.IndexName
instance Control.DeepSeq.NFData index => Control.DeepSeq.NFData (Stack.Types.PackageIndex.PackageCache index)
instance Data.Store.Impl.Store index => Data.Store.Impl.Store (Stack.Types.PackageIndex.PackageCache index)
instance Data.Data.Data index => Data.Data.Data (Stack.Types.PackageIndex.PackageCache index)
instance GHC.Show.Show index => GHC.Show.Show (Stack.Types.PackageIndex.PackageCache index)
instance GHC.Classes.Eq index => GHC.Classes.Eq (Stack.Types.PackageIndex.PackageCache index)
instance GHC.Generics.Generic (Stack.Types.PackageIndex.PackageCache index)
instance Data.Data.Data Stack.Types.PackageIndex.PackageDownload
instance GHC.Classes.Eq Stack.Types.PackageIndex.PackageDownload
instance GHC.Generics.Generic Stack.Types.PackageIndex.PackageDownload
instance GHC.Show.Show Stack.Types.PackageIndex.PackageDownload
instance Data.Data.Data Stack.Types.PackageIndex.OffsetSize
instance GHC.Show.Show Stack.Types.PackageIndex.OffsetSize
instance GHC.Classes.Eq Stack.Types.PackageIndex.OffsetSize
instance GHC.Generics.Generic Stack.Types.PackageIndex.OffsetSize
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.PackageIndex.PackageIndex)
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.HackageSecurity
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageIndex.IndexName
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.IndexName
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.HSPackageDownload
instance GHC.Base.Semigroup (Stack.Types.PackageIndex.PackageCache index)
instance GHC.Base.Monoid (Stack.Types.PackageIndex.PackageCache index)
instance Data.Store.Impl.Store Stack.Types.PackageIndex.PackageDownload
instance Control.DeepSeq.NFData Stack.Types.PackageIndex.PackageDownload
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.PackageDownload
instance Data.Store.Impl.Store Stack.Types.PackageIndex.OffsetSize
instance Control.DeepSeq.NFData Stack.Types.PackageIndex.OffsetSize

module Stack.Types.PackageDump

-- | Cached information on whether package have profiling libraries and
--   haddocks.
newtype InstalledCache
InstalledCache :: IORef InstalledCacheInner -> InstalledCache
newtype InstalledCacheInner
InstalledCacheInner :: Map GhcPkgId InstalledCacheEntry -> InstalledCacheInner

-- | Cached information on whether a package has profiling libraries and
--   haddocks.
data InstalledCacheEntry
InstalledCacheEntry :: !Bool -> !Bool -> !Bool -> !PackageIdentifier -> InstalledCacheEntry
[installedCacheProfiling] :: InstalledCacheEntry -> !Bool
[installedCacheHaddock] :: InstalledCacheEntry -> !Bool
[installedCacheSymbols] :: InstalledCacheEntry -> !Bool
[installedCacheIdent] :: InstalledCacheEntry -> !PackageIdentifier
installedCacheVC :: VersionConfig InstalledCacheInner
instance Data.Data.Data Stack.Types.PackageDump.InstalledCacheInner
instance GHC.Show.Show Stack.Types.PackageDump.InstalledCacheInner
instance GHC.Classes.Eq Stack.Types.PackageDump.InstalledCacheInner
instance GHC.Generics.Generic Stack.Types.PackageDump.InstalledCacheInner
instance Data.Store.Impl.Store Stack.Types.PackageDump.InstalledCacheInner
instance Data.Data.Data Stack.Types.PackageDump.InstalledCacheEntry
instance GHC.Show.Show Stack.Types.PackageDump.InstalledCacheEntry
instance GHC.Generics.Generic Stack.Types.PackageDump.InstalledCacheEntry
instance GHC.Classes.Eq Stack.Types.PackageDump.InstalledCacheEntry
instance Data.Store.Impl.Store Stack.Types.PackageDump.InstalledCacheEntry

module Control.Concurrent.Execute
data ActionType

-- | Action for building a package's library and executables. If
--   <tt>taskAllInOne</tt> is <a>True</a>, then this will also build
--   benchmarks and tests. It is <a>False</a> when then library's
--   benchmarks or test-suites have cyclic dependencies.
ATBuild :: ActionType

-- | Task for building the package's benchmarks and test-suites. Requires
--   that the library was already built.
ATBuildFinal :: ActionType

-- | Task for running the package's test-suites.
ATRunTests :: ActionType

-- | Task for running the package's benchmarks.
ATRunBenchmarks :: ActionType
data ActionId
ActionId :: !PackageIdentifier -> !ActionType -> ActionId
data ActionContext
ActionContext :: !Set ActionId -> [Action] -> !Concurrency -> ActionContext

-- | Does not include the current action
[acRemaining] :: ActionContext -> !Set ActionId

-- | Actions which depend on the current action
[acDownstream] :: ActionContext -> [Action]

-- | Whether this action may be run concurrently with others
[acConcurrency] :: ActionContext -> !Concurrency
data Action
Action :: !ActionId -> !Set ActionId -> !ActionContext -> IO () -> !Concurrency -> Action
[actionId] :: Action -> !ActionId
[actionDeps] :: Action -> !Set ActionId
[actionDo] :: Action -> !ActionContext -> IO ()
[actionConcurrency] :: Action -> !Concurrency
data Concurrency
ConcurrencyAllowed :: Concurrency
ConcurrencyDisallowed :: Concurrency
runActions :: Int -> Bool -> [Action] -> (TVar Int -> TVar (Set ActionId) -> IO ()) -> IO [SomeException]
instance GHC.Classes.Eq Control.Concurrent.Execute.Concurrency
instance GHC.Classes.Ord Control.Concurrent.Execute.ActionId
instance GHC.Classes.Eq Control.Concurrent.Execute.ActionId
instance GHC.Show.Show Control.Concurrent.Execute.ActionId
instance GHC.Classes.Ord Control.Concurrent.Execute.ActionType
instance GHC.Classes.Eq Control.Concurrent.Execute.ActionType
instance GHC.Show.Show Control.Concurrent.Execute.ActionType
instance GHC.Exception.Type.Exception Control.Concurrent.Execute.ExecuteException
instance GHC.Show.Show Control.Concurrent.Execute.ExecuteException

module Stack.Types.Compiler

-- | Variety of compiler to use.
data WhichCompiler
Ghc :: WhichCompiler
Ghcjs :: WhichCompiler

-- | Whether the compiler version given is the wanted version (what the
--   stack.yaml file, snapshot file, or --resolver argument request), or
--   the actual installed GHC. Depending on the matching requirements,
--   these values could be different.
data CVType
CVWanted :: CVType
CVActual :: CVType

-- | Specifies a compiler and its version number(s).
--   
--   Note that despite having this datatype, stack isn't in a hurry to
--   support compilers other than GHC.
data CompilerVersion (cvType :: CVType)
GhcVersion :: {-# UNPACK #-} !Version -> CompilerVersion
GhcjsVersion :: {-# UNPACK #-} !Version -> {-# UNPACK #-} !Version -> CompilerVersion
actualToWanted :: CompilerVersion  'CVActual -> CompilerVersion  'CVWanted
wantedToActual :: CompilerVersion  'CVWanted -> CompilerVersion  'CVActual
parseCompilerVersion :: Text -> Maybe (CompilerVersion a)
compilerVersionText :: CompilerVersion a -> Text
compilerVersionString :: CompilerVersion a -> String
whichCompiler :: CompilerVersion a -> WhichCompiler
isWantedCompiler :: VersionCheck -> CompilerVersion  'CVWanted -> CompilerVersion  'CVActual -> Bool
getGhcVersion :: CompilerVersion a -> Version
compilerExeName :: WhichCompiler -> String
haddockExeName :: WhichCompiler -> String
instance Data.Typeable.Internal.Typeable cvType => Data.Data.Data (Stack.Types.Compiler.CompilerVersion cvType)
instance GHC.Classes.Ord (Stack.Types.Compiler.CompilerVersion cvType)
instance GHC.Classes.Eq (Stack.Types.Compiler.CompilerVersion cvType)
instance GHC.Show.Show (Stack.Types.Compiler.CompilerVersion cvType)
instance GHC.Generics.Generic (Stack.Types.Compiler.CompilerVersion cvType)
instance GHC.Classes.Ord Stack.Types.Compiler.WhichCompiler
instance GHC.Classes.Eq Stack.Types.Compiler.WhichCompiler
instance GHC.Show.Show Stack.Types.Compiler.WhichCompiler
instance Data.Store.Impl.Store (Stack.Types.Compiler.CompilerVersion a)
instance Control.DeepSeq.NFData (Stack.Types.Compiler.CompilerVersion a)
instance RIO.Prelude.Display.Display (Stack.Types.Compiler.CompilerVersion a)
instance Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.Compiler.CompilerVersion a)
instance Data.Aeson.Types.FromJSON.FromJSON (Stack.Types.Compiler.CompilerVersion a)
instance Data.Aeson.Types.FromJSON.FromJSONKey (Stack.Types.Compiler.CompilerVersion a)

module Stack.Types.Resolver
type Resolver = ResolverWith (Either Request FilePath)
data IsLoaded
Loaded :: IsLoaded
NotLoaded :: IsLoaded
type LoadedResolver = ResolverWith SnapshotHash

-- | How we resolve which dependencies to install given a set of packages.
data ResolverWith customContents

-- | Use an official snapshot from the Stackage project, either an LTS
--   Haskell or Stackage Nightly.
ResolverStackage :: !SnapName -> ResolverWith customContents

-- | Require a specific compiler version, but otherwise provide no build
--   plan. Intended for use cases where end user wishes to specify all
--   upstream dependencies manually, such as using a dependency solver.
ResolverCompiler :: !CompilerVersion  'CVWanted -> ResolverWith customContents

-- | A custom resolver based on the given location (as a raw URL or
--   filepath). If <tt>customContents</tt> is a <tt>Either Request
--   FilePath</tt>, it represents the parsed location value (with filepaths
--   resolved relative to the directory containing the file referring to
--   the custom snapshot). Once it has been loaded from disk, it will be
--   replaced with a <tt>SnapshotHash</tt> value, which is used to store
--   cached files.
ResolverCustom :: !Text -> !customContents -> ResolverWith customContents

-- | Parse a <tt>Resolver</tt> from a <tt>Text</tt>
parseResolverText :: Text -> ResolverWith ()

-- | Either an actual resolver value, or an abstract description of one
--   (e.g., latest nightly).
data AbstractResolver
ARLatestNightly :: AbstractResolver
ARLatestLTS :: AbstractResolver
ARLatestLTSMajor :: !Int -> AbstractResolver
ARResolver :: !ResolverWith () -> AbstractResolver
ARGlobal :: AbstractResolver
readAbstractResolver :: ReadM AbstractResolver

-- | Convert a Resolver into its <tt>Text</tt> representation for human
--   presentation. When possible, you should prefer
--   <tt>sdResolverName</tt>, as it will handle the human-friendly name
--   inside a custom snapshot.
resolverRawName :: ResolverWith a -> Text

-- | The name of an LTS Haskell or Stackage Nightly snapshot.
data SnapName
LTS :: !Int -> !Int -> SnapName
Nightly :: !Day -> SnapName

-- | Most recent Nightly and newest LTS version per major release.
data Snapshots
Snapshots :: !Day -> !IntMap Int -> Snapshots
[snapshotsNightly] :: Snapshots -> !Day
[snapshotsLts] :: Snapshots -> !IntMap Int

-- | Convert a <a>SnapName</a> into its short representation, e.g.
--   <tt>lts-2.8</tt>, <tt>nightly-2015-03-05</tt>.
renderSnapName :: SnapName -> Text

-- | Parse the short representation of a <a>SnapName</a>.
parseSnapName :: MonadThrow m => Text -> m SnapName
data SnapshotHash

-- | Return the first 12 characters of the hash as a B64URL-encoded string.
trimmedSnapshotHash :: SnapshotHash -> Text

-- | Return the raw bytes in the hash
snapshotHashToBS :: SnapshotHash -> ByteString

-- | Create a new SnapshotHash by SHA256 hashing the given contents
snapshotHashFromBS :: ByteString -> SnapshotHash

-- | Create a new SnapshotHash from the given digest
snapshotHashFromDigest :: Digest SHA256 -> SnapshotHash
parseCustomLocation :: MonadThrow m => Maybe (Path Abs Dir) -> ResolverWith () -> m Resolver
instance GHC.Classes.Eq Stack.Types.Resolver.SnapshotHash
instance Data.Data.Data Stack.Types.Resolver.SnapshotHash
instance GHC.Show.Show Stack.Types.Resolver.SnapshotHash
instance GHC.Generics.Generic Stack.Types.Resolver.SnapshotHash
instance GHC.Show.Show Stack.Types.Resolver.Snapshots
instance GHC.Show.Show Stack.Types.Resolver.AbstractResolver
instance Data.Traversable.Traversable Stack.Types.Resolver.ResolverWith
instance Data.Foldable.Foldable Stack.Types.Resolver.ResolverWith
instance GHC.Base.Functor Stack.Types.Resolver.ResolverWith
instance GHC.Classes.Eq customContents => GHC.Classes.Eq (Stack.Types.Resolver.ResolverWith customContents)
instance Data.Data.Data customContents => Data.Data.Data (Stack.Types.Resolver.ResolverWith customContents)
instance GHC.Show.Show customContents => GHC.Show.Show (Stack.Types.Resolver.ResolverWith customContents)
instance GHC.Generics.Generic (Stack.Types.Resolver.ResolverWith customContents)
instance GHC.Classes.Eq Stack.Types.Resolver.SnapName
instance Data.Data.Data Stack.Types.Resolver.SnapName
instance GHC.Show.Show Stack.Types.Resolver.SnapName
instance GHC.Generics.Generic Stack.Types.Resolver.SnapName
instance Data.Store.Impl.Store Stack.Types.Resolver.LoadedResolver
instance Control.DeepSeq.NFData Stack.Types.Resolver.LoadedResolver
instance Data.Store.Impl.Store Stack.Types.Resolver.SnapshotHash
instance Control.DeepSeq.NFData Stack.Types.Resolver.SnapshotHash
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Resolver.Snapshots
instance GHC.Exception.Type.Exception Stack.Types.Resolver.BuildPlanTypesException
instance GHC.Show.Show Stack.Types.Resolver.BuildPlanTypesException
instance Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.Resolver.ResolverWith a)
instance (a Data.Type.Equality.~ ()) => Data.Aeson.Types.FromJSON.FromJSON (Stack.Types.Resolver.ResolverWith a)
instance Data.Store.Impl.Store Stack.Types.Resolver.SnapName
instance Control.DeepSeq.NFData Stack.Types.Resolver.SnapName
instance RIO.Prelude.Display.Display Stack.Types.Resolver.SnapName

module Stack.Options.ResolverParser

-- | Parser for the resolver
abstractResolverOptsParser :: Bool -> Parser AbstractResolver
compilerOptsParser :: Bool -> Parser (CompilerVersion  'CVWanted)
readCompilerVersion :: ReadM (CompilerVersion  'CVWanted)


-- | Constants used throughout the project.
module Stack.Constants

-- | Path where build plans are stored.
buildPlanDir :: Path Abs Dir -> Path Abs Dir

-- | Path where binary caches of the build plans are stored.
buildPlanCacheDir :: Path Abs Dir -> Path Abs Dir

-- | Extensions for anything that can be a Haskell module.
haskellModuleExts :: [Text]

-- | The filename used for the stack config file.
stackDotYaml :: Path Rel File

-- | Environment variable used to override the '.stack-work' relative dir.
stackWorkEnvVar :: String

-- | Environment variable used to override the '~/.stack' location.
stackRootEnvVar :: String

-- | Option name for the global stack root.
stackRootOptionName :: String

-- | Deprecated option name for the global stack root.
--   
--   Deprecated since stack-1.1.0.
--   
--   TODO: Remove occurences of this variable and use
--   <a>stackRootOptionName</a> only after an appropriate deprecation
--   period.
deprecatedStackRootOptionName :: String

-- | Environment variable used to indicate stack is running in container.
inContainerEnvVar :: String

-- | Environment variable used to indicate stack is running in container.
--   although we already have STACK_IN_NIX_EXTRA_ARGS that is set in the
--   same conditions, it can happen that STACK_IN_NIX_EXTRA_ARGS is set to
--   empty.
inNixShellEnvVar :: String

-- | Name of the <tt>stack</tt> program.
stackProgName :: String

-- | Name of the <tt>stack</tt> program, uppercased
stackProgNameUpper :: String
wiredInPackages :: HashSet PackageName
ghcjsBootPackages :: HashSet PackageName

-- | Just to avoid repetition and magic strings.
cabalPackageName :: PackageName

-- | Deprecated implicit global project directory used when outside of a
--   project.
implicitGlobalProjectDirDeprecated :: Path Abs Dir -> Path Abs Dir

-- | Implicit global project directory used when outside of a project.
--   Normally, <tt>getImplicitGlobalProjectDir</tt> should be used instead.
implicitGlobalProjectDir :: Path Abs Dir -> Path Abs Dir

-- | Deprecated default global config path.
defaultUserConfigPathDeprecated :: Path Abs Dir -> Path Abs File

-- | Default global config path. Normally,
--   <tt>getDefaultUserConfigPath</tt> should be used instead.
defaultUserConfigPath :: Path Abs Dir -> Path Abs File

-- | Deprecated default global config path. Note that this will be
--   <tt>Nothing</tt> on Windows, which is by design.
defaultGlobalConfigPathDeprecated :: Maybe (Path Abs File)

-- | Default global config path. Normally,
--   <tt>getDefaultGlobalConfigPath</tt> should be used instead. Note that
--   this will be <tt>Nothing</tt> on Windows, which is by design.
defaultGlobalConfigPath :: Maybe (Path Abs File)

-- | Environment variable that stores a variant to append to
--   platform-specific directory names. Used to ensure incompatible
--   binaries aren't shared between Docker builds and host
platformVariantEnvVar :: String

-- | Provides --ghc-options for <a>Ghc</a>, and similarly, --ghcjs-options
--   for <a>Ghcjs</a>.
compilerOptionsCabalFlag :: WhichCompiler -> String

-- | The flag to pass to GHC when we want to force its output to be
--   colorized.
ghcColorForceFlag :: String

-- | The minimum allowed terminal width. Used for pretty-printing.
minTerminalWidth :: Int

-- | The maximum allowed terminal width. Used for pretty-printing.
maxTerminalWidth :: Int

-- | The default terminal width. Used for pretty-printing when we can't
--   automatically detect it and when the user doesn't supply one.
defaultTerminalWidth :: Int

-- | True if using Windows OS.
osIsWindows :: Bool


-- | Docker types.
module Stack.Types.Docker

-- | Docker configuration.
data DockerOpts
DockerOpts :: !Bool -> !String -> !Bool -> !Maybe String -> !Maybe String -> !Bool -> !Bool -> !Bool -> !Maybe String -> ![String] -> ![Mount] -> ![String] -> !Path Abs File -> !Maybe DockerStackExe -> !Maybe Bool -> !VersionRange -> DockerOpts

-- | Is using Docker enabled?
[dockerEnable] :: DockerOpts -> !Bool

-- | Exact Docker image tag or ID. Overrides docker-repo-*/tag.
[dockerImage] :: DockerOpts -> !String

-- | Does registry require login for pulls?
[dockerRegistryLogin] :: DockerOpts -> !Bool

-- | Optional username for Docker registry.
[dockerRegistryUsername] :: DockerOpts -> !Maybe String

-- | Optional password for Docker registry.
[dockerRegistryPassword] :: DockerOpts -> !Maybe String

-- | Automatically pull new images.
[dockerAutoPull] :: DockerOpts -> !Bool

-- | Whether to run a detached container
[dockerDetach] :: DockerOpts -> !Bool

-- | Create a persistent container (don't remove it when finished). Implied
--   by <a>dockerDetach</a>.
[dockerPersist] :: DockerOpts -> !Bool

-- | Container name to use, only makes sense from command-line with
--   <a>dockerPersist</a> or <a>dockerDetach</a>.
[dockerContainerName] :: DockerOpts -> !Maybe String

-- | Arguments to pass directly to <tt>docker run</tt>.
[dockerRunArgs] :: DockerOpts -> ![String]

-- | Volumes to mount in the container.
[dockerMount] :: DockerOpts -> ![Mount]

-- | Environment variables to set in the container.
[dockerEnv] :: DockerOpts -> ![String]

-- | Location of image usage database.
[dockerDatabasePath] :: DockerOpts -> !Path Abs File

-- | Location of container-compatible stack executable
[dockerStackExe] :: DockerOpts -> !Maybe DockerStackExe

-- | Set in-container user to match host's
[dockerSetUser] :: DockerOpts -> !Maybe Bool

-- | Require a version of Docker within this range.
[dockerRequireDockerVersion] :: DockerOpts -> !VersionRange

-- | An uninterpreted representation of docker options. Configurations may
--   be "cascaded" using mappend (left-biased).
data DockerOptsMonoid
DockerOptsMonoid :: !Any -> !First Bool -> !First DockerMonoidRepoOrImage -> !First Bool -> !First String -> !First String -> !First Bool -> !First Bool -> !First Bool -> !First String -> ![String] -> ![Mount] -> ![String] -> !First (Path Abs File) -> !First DockerStackExe -> !First Bool -> !IntersectingVersionRange -> DockerOptsMonoid

-- | Should Docker be defaulted to enabled (does <tt>docker:</tt> section
--   exist in the config)?
[dockerMonoidDefaultEnable] :: DockerOptsMonoid -> !Any

-- | Is using Docker enabled?
[dockerMonoidEnable] :: DockerOptsMonoid -> !First Bool

-- | Docker repository name (e.g. <tt>fpco/stack-build</tt> or
--   <tt>fpco/stack-full:lts-2.8</tt>)
[dockerMonoidRepoOrImage] :: DockerOptsMonoid -> !First DockerMonoidRepoOrImage

-- | Does registry require login for pulls?
[dockerMonoidRegistryLogin] :: DockerOptsMonoid -> !First Bool

-- | Optional username for Docker registry.
[dockerMonoidRegistryUsername] :: DockerOptsMonoid -> !First String

-- | Optional password for Docker registry.
[dockerMonoidRegistryPassword] :: DockerOptsMonoid -> !First String

-- | Automatically pull new images.
[dockerMonoidAutoPull] :: DockerOptsMonoid -> !First Bool

-- | Whether to run a detached container
[dockerMonoidDetach] :: DockerOptsMonoid -> !First Bool

-- | Create a persistent container (don't remove it when finished). Implied
--   by <a>dockerDetach</a>.
[dockerMonoidPersist] :: DockerOptsMonoid -> !First Bool

-- | Container name to use, only makes sense from command-line with
--   <a>dockerPersist</a> or <a>dockerDetach</a>.
[dockerMonoidContainerName] :: DockerOptsMonoid -> !First String

-- | Arguments to pass directly to <tt>docker run</tt>
[dockerMonoidRunArgs] :: DockerOptsMonoid -> ![String]

-- | Volumes to mount in the container
[dockerMonoidMount] :: DockerOptsMonoid -> ![Mount]

-- | Environment variables to set in the container
[dockerMonoidEnv] :: DockerOptsMonoid -> ![String]

-- | Location of image usage database.
[dockerMonoidDatabasePath] :: DockerOptsMonoid -> !First (Path Abs File)

-- | Location of container-compatible stack executable
[dockerMonoidStackExe] :: DockerOptsMonoid -> !First DockerStackExe

-- | Set in-container user to match host's
[dockerMonoidSetUser] :: DockerOptsMonoid -> !First Bool

-- | See: <a>dockerRequireDockerVersion</a>
[dockerMonoidRequireDockerVersion] :: DockerOptsMonoid -> !IntersectingVersionRange

-- | Where to get the <tt>stack</tt> executable to run in Docker containers
data DockerStackExe

-- | Download from official bindist
DockerStackExeDownload :: DockerStackExe

-- | Host's <tt>stack</tt> (linux-x86_64 only)
DockerStackExeHost :: DockerStackExe

-- | Docker image's <tt>stack</tt> (versions must match)
DockerStackExeImage :: DockerStackExe

-- | Executable at given path
DockerStackExePath :: Path Abs File -> DockerStackExe

-- | Parse <a>DockerStackExe</a>.
parseDockerStackExe :: MonadThrow m => String -> m DockerStackExe

-- | Docker volume mount.
data Mount
Mount :: String -> String -> Mount

-- | Options for Docker repository or image.
data DockerMonoidRepoOrImage
DockerMonoidRepo :: String -> DockerMonoidRepoOrImage
DockerMonoidImage :: String -> DockerMonoidRepoOrImage

-- | Newtype for non-orphan FromJSON instance.
newtype VersionRangeJSON
VersionRangeJSON :: VersionRange -> VersionRangeJSON
[unVersionRangeJSON] :: VersionRangeJSON -> VersionRange

-- | Exceptions thrown by Stack.Docker.
data StackDockerException

-- | Docker must be enabled to use the command.
DockerMustBeEnabledException :: StackDockerException

-- | Command must be run on host OS (not in a container).
OnlyOnHostException :: StackDockerException

-- | <tt>docker inspect</tt> failed.
InspectFailedException :: String -> StackDockerException

-- | Image does not exist.
NotPulledException :: String -> StackDockerException

-- | Input to <tt>docker cleanup</tt> has invalid command.
InvalidCleanupCommandException :: String -> StackDockerException

-- | Invalid output from <tt>docker images</tt>.
InvalidImagesOutputException :: String -> StackDockerException

-- | Invalid output from <tt>docker ps</tt>.
InvalidPSOutputException :: String -> StackDockerException

-- | Invalid output from <tt>docker inspect</tt>.
InvalidInspectOutputException :: String -> StackDockerException

-- | Could not pull a Docker image.
PullFailedException :: String -> StackDockerException

-- | Installed version of <tt>docker</tt> below minimum version.
DockerTooOldException :: Version -> Version -> StackDockerException

-- | Installed version of <tt>docker</tt> is prohibited.
DockerVersionProhibitedException :: [Version] -> Version -> StackDockerException

-- | Installed version of <tt>docker</tt> is out of range specified in
--   config file.
BadDockerVersionException :: VersionRange -> Version -> StackDockerException

-- | Invalid output from <tt>docker --version</tt>.
InvalidVersionOutputException :: StackDockerException

-- | Version of <tt>stack</tt> on host is too old for version in image.
HostStackTooOldException :: Version -> Maybe Version -> StackDockerException

-- | Version of <tt>stack</tt> in container/image is too old for version on
--   host.
ContainerStackTooOldException :: Version -> Version -> StackDockerException

-- | Can't determine the project root (where to put docker sandbox).
CannotDetermineProjectRootException :: StackDockerException

-- | <tt>docker --version</tt> failed.
DockerNotInstalledException :: StackDockerException

-- | Using host stack-exe on unsupported platform.
UnsupportedStackExeHostPlatformException :: StackDockerException

-- | <tt>stack-exe</tt> option fails to parse.
DockerStackExeParseException :: String -> StackDockerException

-- | Docker enable argument name.
dockerEnableArgName :: Text

-- | Docker repo arg argument name.
dockerRepoArgName :: Text

-- | Docker image argument name.
dockerImageArgName :: Text

-- | Docker registry login argument name.
dockerRegistryLoginArgName :: Text

-- | Docker registry username argument name.
dockerRegistryUsernameArgName :: Text

-- | Docker registry password argument name.
dockerRegistryPasswordArgName :: Text

-- | Docker auto-pull argument name.
dockerAutoPullArgName :: Text

-- | Docker detach argument name.
dockerDetachArgName :: Text

-- | Docker run args argument name.
dockerRunArgsArgName :: Text

-- | Docker mount argument name.
dockerMountArgName :: Text

-- | Docker environment variable argument name.
dockerEnvArgName :: Text

-- | Docker container name argument name.
dockerContainerNameArgName :: Text

-- | Docker persist argument name.
dockerPersistArgName :: Text

-- | Docker database path argument name.
dockerDatabasePathArgName :: Text

-- | Docker database path argument name.
dockerStackExeArgName :: Text

-- | Value for <tt>--docker-stack-exe=download</tt>
dockerStackExeDownloadVal :: String

-- | Value for <tt>--docker-stack-exe=host</tt>
dockerStackExeHostVal :: String

-- | Value for <tt>--docker-stack-exe=image</tt>
dockerStackExeImageVal :: String

-- | Docker <tt>set-user</tt> argument name
dockerSetUserArgName :: Text

-- | Docker <tt>require-version</tt> argument name
dockerRequireDockerVersionArgName :: Text

-- | Argument name used to pass docker entrypoint data (only used
--   internally)
dockerEntrypointArgName :: String

-- | Command-line argument for "docker"
dockerCmdName :: String
dockerHelpOptName :: String

-- | Command-line argument for <tt>docker pull</tt>.
dockerPullCmdName :: String

-- | Command-line argument for <tt>docker cleanup</tt>.
dockerCleanupCmdName :: String

-- | Command-line option for <tt>--internal-re-exec-version</tt>.
reExecArgName :: String

-- | Platform that Docker containers run
dockerContainerPlatform :: Platform
instance GHC.Generics.Generic Stack.Types.Docker.DockerOptsMonoid
instance GHC.Show.Show Stack.Types.Docker.DockerOptsMonoid
instance GHC.Show.Show Stack.Types.Docker.DockerMonoidRepoOrImage
instance GHC.Show.Show Stack.Types.Docker.DockerOpts
instance GHC.Show.Show Stack.Types.Docker.DockerStackExe
instance GHC.Exception.Type.Exception Stack.Types.Docker.StackDockerException
instance GHC.Show.Show Stack.Types.Docker.StackDockerException
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Docker.DockerOptsMonoid)
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Docker.VersionRangeJSON
instance GHC.Base.Semigroup Stack.Types.Docker.DockerOptsMonoid
instance GHC.Base.Monoid Stack.Types.Docker.DockerOptsMonoid
instance GHC.Read.Read Stack.Types.Docker.Mount
instance GHC.Show.Show Stack.Types.Docker.Mount
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Docker.Mount
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Docker.DockerStackExe


-- | This module implements parsing of additional arguments embedded in a
--   comment when stack is invoked as a script interpreter
--   
--   <h3>Specifying arguments in script interpreter mode</h3>
--   
--   <tt><i>stack</i></tt> can execute a Haskell source file using
--   <tt><i>runghc</i></tt> and if required it can also install and setup
--   the compiler and any package dependencies automatically.
--   
--   For using a Haskell source file as an executable script on a Unix like
--   OS, the first line of the file must specify <tt>stack</tt> as the
--   interpreter using a shebang directive e.g.
--   
--   <pre>
--   #!/usr/bin/env stack
--   </pre>
--   
--   Additional arguments can be specified in a haskell comment following
--   the <tt>#!</tt> line. The contents inside the comment must be a single
--   valid stack command line, starting with <tt>stack</tt> as the command
--   and followed by the options to use for executing this file.
--   
--   The comment must be on the line immediately following the <tt>#!</tt>
--   line. The comment must start in the first column of the line. When
--   using a block style comment the command can be split on multiple
--   lines.
--   
--   Here is an example of a single line comment:
--   
--   <pre>
--   #!/usr/bin/env stack
--   -- stack --resolver lts-3.14 --install-ghc runghc --package random
--   </pre>
--   
--   Here is an example of a multi line block comment:
--   
--   <pre>
--   #!/usr/bin/env stack
--   {- stack
--     --resolver lts-3.14
--     --install-ghc
--     runghc
--     --package random
--   -}
--   </pre>
--   
--   When the <tt>#!</tt> line is not present, the file can still be
--   executed using <tt>stack &lt;file name&gt;</tt> command if the file
--   starts with a valid stack interpreter comment. This can be used to
--   execute the file on Windows for example.
--   
--   Nested block comments are not supported.
module Data.Attoparsec.Interpreter

-- | Parser to extract the stack command line embedded inside a comment
--   after validating the placement and formatting rules for a valid
--   interpreter specification.
interpreterArgsParser :: Bool -> String -> Parser String

-- | Extract stack arguments from a correctly placed and correctly
--   formatted comment when it is being used as an interpreter
getInterpreterArgs :: String -> IO [String]

module Stack.Types.VersionIntervals
data VersionIntervals
toVersionRange :: VersionIntervals -> VersionRange
fromVersionRange :: VersionRange -> VersionIntervals
withinIntervals :: Version -> VersionIntervals -> Bool
unionVersionIntervals :: VersionIntervals -> VersionIntervals -> VersionIntervals
intersectVersionIntervals :: VersionIntervals -> VersionIntervals -> VersionIntervals
instance Data.Data.Data Stack.Types.VersionIntervals.VersionIntervals
instance GHC.Classes.Eq Stack.Types.VersionIntervals.VersionIntervals
instance GHC.Show.Show Stack.Types.VersionIntervals.VersionIntervals
instance GHC.Generics.Generic Stack.Types.VersionIntervals.VersionIntervals
instance Data.Data.Data Stack.Types.VersionIntervals.VersionInterval
instance GHC.Classes.Eq Stack.Types.VersionIntervals.VersionInterval
instance GHC.Show.Show Stack.Types.VersionIntervals.VersionInterval
instance GHC.Generics.Generic Stack.Types.VersionIntervals.VersionInterval
instance Data.Data.Data Stack.Types.VersionIntervals.Bound
instance GHC.Classes.Eq Stack.Types.VersionIntervals.Bound
instance GHC.Show.Show Stack.Types.VersionIntervals.Bound
instance GHC.Generics.Generic Stack.Types.VersionIntervals.Bound
instance Data.Store.Impl.Store Stack.Types.VersionIntervals.VersionIntervals
instance Control.DeepSeq.NFData Stack.Types.VersionIntervals.VersionIntervals
instance Data.Store.Impl.Store Stack.Types.VersionIntervals.VersionInterval
instance Control.DeepSeq.NFData Stack.Types.VersionIntervals.VersionInterval
instance Data.Store.Impl.Store Stack.Types.VersionIntervals.Bound
instance Control.DeepSeq.NFData Stack.Types.VersionIntervals.Bound


-- | Shared types for various stackage packages.
module Stack.Types.BuildPlan

-- | A definition of a snapshot. This could be a Stackage snapshot or
--   something custom. It does not include information on the global
--   package database, this is added later.
--   
--   It may seem more logic to attach flags, options, etc, directly with
--   the desired package. However, this isn't possible yet: our definition
--   may contain tarballs or Git repos, and we don't actually know the
--   package names contained there. Therefore, we capture all of this
--   additional information by package name, and later in the snapshot load
--   step we will resolve the contents of tarballs and repos, figure out
--   package names, and assigned values appropriately.
data SnapshotDef
SnapshotDef :: !Either (CompilerVersion  'CVWanted) SnapshotDef -> !LoadedResolver -> !Text -> ![PackageLocationIndex Subdirs] -> !Set PackageName -> !Map PackageName (Map FlagName Bool) -> !Map PackageName Bool -> !Map PackageName [Text] -> !Map PackageName (Maybe Version) -> SnapshotDef

-- | The snapshot to extend from. This is either a specific compiler, or a
--   <tt>SnapshotDef</tt> which gives us more information (like packages).
--   Ultimately, we'll end up with a <tt>CompilerVersion</tt>.
[sdParent] :: SnapshotDef -> !Either (CompilerVersion  'CVWanted) SnapshotDef

-- | The resolver that provides this definition.
[sdResolver] :: SnapshotDef -> !LoadedResolver

-- | A user-friendly way of referring to this resolver.
[sdResolverName] :: SnapshotDef -> !Text

-- | Where to grab all of the packages from.
[sdLocations] :: SnapshotDef -> ![PackageLocationIndex Subdirs]

-- | Packages present in the parent which should not be included here.
[sdDropPackages] :: SnapshotDef -> !Set PackageName

-- | Flag values to override from the defaults
[sdFlags] :: SnapshotDef -> !Map PackageName (Map FlagName Bool)

-- | Packages which should be hidden when registering. This will affect,
--   for example, the import parser in the script command. We use a
--   <a>Map</a> instead of just a <a>Set</a> to allow overriding the hidden
--   settings in a parent snapshot.
[sdHidden] :: SnapshotDef -> !Map PackageName Bool

-- | GHC options per package
[sdGhcOptions] :: SnapshotDef -> !Map PackageName [Text]

-- | Hints about which packages are available globally. When actually
--   building code, we trust the package database provided by GHC itself,
--   since it may be different based on platform or GHC install. However,
--   when we want to check the compatibility of a snapshot with some
--   codebase without installing GHC (e.g., during stack init), we would
--   use this field.
[sdGlobalHints] :: SnapshotDef -> !Map PackageName (Maybe Version)
snapshotDefVC :: VersionConfig SnapshotDef

-- | A relative file path including a unique string for the given snapshot.
sdRawPathName :: SnapshotDef -> String

-- | Where to get the contents of a package (including cabal file
--   revisions) from.
--   
--   A GADT may be more logical than the index parameter, but this plays
--   more nicely with Generic deriving.
data PackageLocation subdirs

-- | Note that we use <tt>FilePath</tt> and not <tt>Path</tt>s. The goal
--   is: first parse the value raw, and then use <tt>canonicalizePath</tt>
--   and <tt>parseAbsDir</tt>.
PLFilePath :: !FilePath -> PackageLocation subdirs
PLArchive :: !Archive subdirs -> PackageLocation subdirs

-- | Stored in a source control repository
PLRepo :: !Repo subdirs -> PackageLocation subdirs

-- | Add in the possibility of getting packages from the index (including
--   cabal file revisions). We have special handling of this case in many
--   places in the codebase, and therefore represent it with a separate
--   data type from <a>PackageLocation</a>.
data PackageLocationIndex subdirs

-- | Grab the package from the package index with the given version and
--   (optional) cabal file info to specify the correct revision.
PLIndex :: !PackageIdentifierRevision -> PackageLocationIndex subdirs
PLOther :: !PackageLocation subdirs -> PackageLocationIndex subdirs

-- | The type of a source control repository.
data RepoType
RepoGit :: RepoType
RepoHg :: RepoType
data Subdirs
DefaultSubdirs :: Subdirs
ExplicitSubdirs :: ![FilePath] -> Subdirs

-- | Information on packages stored in a source control repository.
data Repo subdirs
Repo :: !Text -> !Text -> !RepoType -> !subdirs -> Repo subdirs
[repoUrl] :: Repo subdirs -> !Text
[repoCommit] :: Repo subdirs -> !Text
[repoType] :: Repo subdirs -> !RepoType
[repoSubdirs] :: Repo subdirs -> !subdirs

-- | A package archive, could be from a URL or a local file path. Local
--   file path archives are assumed to be unchanging over time, and so are
--   allowed in custom snapshots.
data Archive subdirs
Archive :: !Text -> !subdirs -> !Maybe StaticSHA256 -> Archive subdirs
[archiveUrl] :: Archive subdirs -> !Text
[archiveSubdirs] :: Archive subdirs -> !subdirs
[archiveHash] :: Archive subdirs -> !Maybe StaticSHA256

-- | Name of an executable.
newtype ExeName
ExeName :: Text -> ExeName
[unExeName] :: ExeName -> Text

-- | A fully loaded snapshot combined , including information gleaned from
--   the global database and parsing cabal files.
--   
--   Invariant: a global package may not depend upon a snapshot package, a
--   snapshot may not depend upon a local or project, and all dependencies
--   must be satisfied.
data LoadedSnapshot
LoadedSnapshot :: !CompilerVersion  'CVActual -> !Map PackageName (LoadedPackageInfo GhcPkgId) -> !Map PackageName (LoadedPackageInfo (PackageLocationIndex FilePath)) -> LoadedSnapshot
[lsCompilerVersion] :: LoadedSnapshot -> !CompilerVersion  'CVActual
[lsGlobals] :: LoadedSnapshot -> !Map PackageName (LoadedPackageInfo GhcPkgId)
[lsPackages] :: LoadedSnapshot -> !Map PackageName (LoadedPackageInfo (PackageLocationIndex FilePath))
loadedSnapshotVC :: VersionConfig LoadedSnapshot

-- | Information on a single package for the <a>LoadedSnapshot</a> which
--   can be installed.
--   
--   Note that much of the information below (such as the package
--   dependencies or exposed modules) can be conditional in the cabal file,
--   which means it will vary based on flags, arch, and OS.
data LoadedPackageInfo loc
LoadedPackageInfo :: !Version -> !loc -> !Map FlagName Bool -> ![Text] -> !Map PackageName VersionIntervals -> !Set ModuleName -> !Bool -> LoadedPackageInfo loc

-- | This <i>must</i> match the version specified within <tt>rpiDef</tt>.
[lpiVersion] :: LoadedPackageInfo loc -> !Version

-- | Where to get the package from. This could be a few different things:
--   
--   <ul>
--   <li>For a global package, it will be the <tt>GhcPkgId</tt>. (If we end
--   up needing to rebuild this because we've changed a dependency, we will
--   take it from the package index with no <tt>CabalFileInfo</tt>.</li>
--   <li>For a dependency, it will be a <tt>PackageLocation</tt>.</li>
--   <li>For a project package, it will be a <tt>Path Abs Dir</tt>.</li>
--   </ul>
[lpiLocation] :: LoadedPackageInfo loc -> !loc

-- | Flags to build this package with.
[lpiFlags] :: LoadedPackageInfo loc -> !Map FlagName Bool

-- | GHC options to use when building this package.
[lpiGhcOptions] :: LoadedPackageInfo loc -> ![Text]

-- | All packages which must be built<i>copied</i>registered before this
--   package.
[lpiPackageDeps] :: LoadedPackageInfo loc -> !Map PackageName VersionIntervals

-- | Modules exposed by this package's library
[lpiExposedModules] :: LoadedPackageInfo loc -> !Set ModuleName

-- | Should this package be hidden in the database. Affects the script
--   interpreter's module name import parser.
[lpiHide] :: LoadedPackageInfo loc -> !Bool
newtype ModuleName
ModuleName :: ByteString -> ModuleName
[unModuleName] :: ModuleName -> ByteString
fromCabalModuleName :: ModuleName -> ModuleName
newtype ModuleInfo
ModuleInfo :: Map ModuleName (Set PackageName) -> ModuleInfo
[miModules] :: ModuleInfo -> Map ModuleName (Set PackageName)
moduleInfoVC :: VersionConfig ModuleInfo

-- | Modify the wanted compiler version in this snapshot. This is used when
--   overriding via the <tt>compiler</tt> value in a custom snapshot or
--   stack.yaml file. We do _not_ need to modify the snapshot's hash for
--   this: all binary caches of a snapshot are stored in a filepath that
--   encodes the actual compiler version in addition to the hash.
--   Therefore, modifications here will not lead to any invalid data.
setCompilerVersion :: CompilerVersion  'CVWanted -> SnapshotDef -> SnapshotDef

-- | Determined the desired compiler version for this <a>SnapshotDef</a>.
sdWantedCompilerVersion :: SnapshotDef -> CompilerVersion  'CVWanted
instance Data.Data.Data Stack.Types.BuildPlan.ModuleInfo
instance GHC.Generics.Generic Stack.Types.BuildPlan.ModuleInfo
instance GHC.Classes.Ord Stack.Types.BuildPlan.ModuleInfo
instance GHC.Classes.Eq Stack.Types.BuildPlan.ModuleInfo
instance GHC.Show.Show Stack.Types.BuildPlan.ModuleInfo
instance GHC.Classes.Eq Stack.Types.BuildPlan.LoadedSnapshot
instance Data.Data.Data Stack.Types.BuildPlan.LoadedSnapshot
instance GHC.Show.Show Stack.Types.BuildPlan.LoadedSnapshot
instance GHC.Generics.Generic Stack.Types.BuildPlan.LoadedSnapshot
instance GHC.Base.Functor Stack.Types.BuildPlan.LoadedPackageInfo
instance Data.Data.Data loc => Data.Data.Data (Stack.Types.BuildPlan.LoadedPackageInfo loc)
instance GHC.Classes.Eq loc => GHC.Classes.Eq (Stack.Types.BuildPlan.LoadedPackageInfo loc)
instance GHC.Show.Show loc => GHC.Show.Show (Stack.Types.BuildPlan.LoadedPackageInfo loc)
instance GHC.Generics.Generic (Stack.Types.BuildPlan.LoadedPackageInfo loc)
instance Data.Data.Data Stack.Types.BuildPlan.ModuleName
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.ModuleName
instance Data.Store.Impl.Store Stack.Types.BuildPlan.ModuleName
instance GHC.Generics.Generic Stack.Types.BuildPlan.ModuleName
instance GHC.Classes.Ord Stack.Types.BuildPlan.ModuleName
instance GHC.Classes.Eq Stack.Types.BuildPlan.ModuleName
instance GHC.Show.Show Stack.Types.BuildPlan.ModuleName
instance Data.Data.Data Stack.Types.BuildPlan.DepInfo
instance GHC.Classes.Eq Stack.Types.BuildPlan.DepInfo
instance GHC.Show.Show Stack.Types.BuildPlan.DepInfo
instance GHC.Generics.Generic Stack.Types.BuildPlan.DepInfo
instance GHC.Enum.Bounded Stack.Types.BuildPlan.Component
instance GHC.Enum.Enum Stack.Types.BuildPlan.Component
instance Data.Data.Data Stack.Types.BuildPlan.Component
instance GHC.Classes.Ord Stack.Types.BuildPlan.Component
instance GHC.Classes.Eq Stack.Types.BuildPlan.Component
instance GHC.Show.Show Stack.Types.BuildPlan.Component
instance GHC.Generics.Generic Stack.Types.BuildPlan.Component
instance Data.Data.Data Stack.Types.BuildPlan.ExeName
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.ExeName
instance Data.Store.Impl.Store Stack.Types.BuildPlan.ExeName
instance GHC.Generics.Generic Stack.Types.BuildPlan.ExeName
instance Data.String.IsString Stack.Types.BuildPlan.ExeName
instance Data.Hashable.Class.Hashable Stack.Types.BuildPlan.ExeName
instance GHC.Classes.Ord Stack.Types.BuildPlan.ExeName
instance GHC.Classes.Eq Stack.Types.BuildPlan.ExeName
instance GHC.Show.Show Stack.Types.BuildPlan.ExeName
instance GHC.Generics.Generic Stack.Types.BuildPlan.SnapshotDef
instance Data.Data.Data Stack.Types.BuildPlan.SnapshotDef
instance GHC.Classes.Eq Stack.Types.BuildPlan.SnapshotDef
instance GHC.Show.Show Stack.Types.BuildPlan.SnapshotDef
instance GHC.Base.Functor Stack.Types.BuildPlan.PackageLocationIndex
instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.PackageLocationIndex subdirs)
instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.PackageLocationIndex subdirs)
instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.PackageLocationIndex subdirs)
instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.PackageLocationIndex subdirs)
instance GHC.Generics.Generic (Stack.Types.BuildPlan.PackageLocationIndex subdirs)
instance GHC.Base.Functor Stack.Types.BuildPlan.PackageLocation
instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.PackageLocation subdirs)
instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.PackageLocation subdirs)
instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.PackageLocation subdirs)
instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.PackageLocation subdirs)
instance GHC.Generics.Generic (Stack.Types.BuildPlan.PackageLocation subdirs)
instance GHC.Base.Functor Stack.Types.BuildPlan.Repo
instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.Repo subdirs)
instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.Repo subdirs)
instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.Repo subdirs)
instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.Repo subdirs)
instance GHC.Generics.Generic (Stack.Types.BuildPlan.Repo subdirs)
instance Data.Data.Data Stack.Types.BuildPlan.Subdirs
instance GHC.Classes.Eq Stack.Types.BuildPlan.Subdirs
instance GHC.Show.Show Stack.Types.BuildPlan.Subdirs
instance GHC.Generics.Generic Stack.Types.BuildPlan.Subdirs
instance Data.Data.Data Stack.Types.BuildPlan.RepoType
instance GHC.Classes.Ord Stack.Types.BuildPlan.RepoType
instance GHC.Classes.Eq Stack.Types.BuildPlan.RepoType
instance GHC.Show.Show Stack.Types.BuildPlan.RepoType
instance GHC.Generics.Generic Stack.Types.BuildPlan.RepoType
instance GHC.Base.Functor Stack.Types.BuildPlan.Archive
instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.Archive subdirs)
instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.Archive subdirs)
instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.Archive subdirs)
instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.Archive subdirs)
instance GHC.Generics.Generic (Stack.Types.BuildPlan.Archive subdirs)
instance Data.Store.Impl.Store Stack.Types.BuildPlan.ModuleInfo
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.ModuleInfo
instance GHC.Base.Semigroup Stack.Types.BuildPlan.ModuleInfo
instance GHC.Base.Monoid Stack.Types.BuildPlan.ModuleInfo
instance Data.Store.Impl.Store Stack.Types.BuildPlan.LoadedSnapshot
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.LoadedSnapshot
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.LoadedPackageInfo a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.LoadedPackageInfo a)
instance Data.Store.Impl.Store Stack.Types.BuildPlan.DepInfo
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.DepInfo
instance GHC.Base.Semigroup Stack.Types.BuildPlan.DepInfo
instance GHC.Base.Monoid Stack.Types.BuildPlan.DepInfo
instance Data.Store.Impl.Store Stack.Types.BuildPlan.Component
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.Component
instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings (Stack.Types.BuildPlan.PackageLocation subdirs))
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.BuildPlan.GitHubRepo
instance Data.Store.Impl.Store Stack.Types.BuildPlan.SnapshotDef
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.SnapshotDef
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.PackageLocationIndex a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.PackageLocationIndex a)
instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.BuildPlan.PackageLocationIndex subdirs)
instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings (Stack.Types.BuildPlan.PackageLocationIndex subdirs))
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.PackageLocation a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.PackageLocation a)
instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.BuildPlan.PackageLocation subdirs)
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.Repo a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.Repo a)
instance Data.Store.Impl.Store Stack.Types.BuildPlan.Subdirs
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.Subdirs
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.BuildPlan.Subdirs
instance Data.Store.Impl.Store Stack.Types.BuildPlan.RepoType
instance Control.DeepSeq.NFData Stack.Types.BuildPlan.RepoType
instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.Archive a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.Archive a)


-- | Run external pagers (<tt>$PAGER</tt>, <tt>less</tt>, <tt>more</tt>)
--   and editors (<tt>$VISUAL</tt>, <tt>$EDITOR</tt>, <tt>nano</tt>,
--   <tt>pico</tt>, <tt>vi</tt>).
module System.Process.PagerEditor

-- | Run pager, providing a function that writes to the pager's input.
pageWriter :: (Handle -> IO ()) -> IO ()

-- | Run pager to display a lazy ByteString.
pageByteString :: LByteString -> IO ()

-- | Run pager to display a <a>Text</a>
pageText :: Text -> IO ()

-- | Run pager to display a ByteString-Builder.
pageBuilder :: Builder -> IO ()

-- | Run pager to display contents of a file.
pageFile :: FilePath -> IO ()

-- | Run pager to display a string.
pageString :: String -> IO ()

-- | Exception running pager.
data PagerException
PagerNotFound :: PagerException
PagerExitFailure :: FilePath -> Int -> PagerException

-- | Run editor to edit a file.
editFile :: FilePath -> IO ()

-- | Run editor, providing functions to write and read the file contents.
editReaderWriter :: forall a. String -> (Handle -> IO ()) -> (FilePath -> IO a) -> IO a

-- | Run editor on a ByteString.
editByteString :: String -> LByteString -> IO LByteString

-- | Run editor on a String.
editString :: String -> String -> IO String

-- | Exception running editor.
data EditorException
EditorNotFound :: EditorException
EditorExitFailure :: FilePath -> Int -> EditorException
instance GHC.Show.Show System.Process.PagerEditor.EditorException
instance GHC.Exception.Type.Exception System.Process.PagerEditor.EditorException
instance GHC.Show.Show System.Process.PagerEditor.PagerException
instance GHC.Exception.Type.Exception System.Process.PagerEditor.PagerException

module System.Terminal

-- | Get the width, in columns, of the terminal if we can.
getTerminalWidth :: IO (Maybe Int)
instance GHC.Show.Show System.Terminal.WindowWidth
instance GHC.Classes.Ord System.Terminal.WindowWidth
instance GHC.Classes.Eq System.Terminal.WindowWidth
instance Foreign.Storable.Storable System.Terminal.WindowWidth


-- | Run environment
module Stack.Types.Runner

-- | Monadic environment.
data Runner
Runner :: !Bool -> !Bool -> !Bool -> !LogFunc -> !Int -> !ProcessContext -> !IORef (Map PackageIdentifierRevision GenericPackageDescription, Map (Path Abs Dir) (GenericPackageDescription, Path Abs File)) -> Runner
[runnerReExec] :: Runner -> !Bool
[runnerTerminal] :: Runner -> !Bool
[runnerUseColor] :: Runner -> !Bool
[runnerLogFunc] :: Runner -> !LogFunc
[runnerTermWidth] :: Runner -> !Int
[runnerProcessContext] :: Runner -> !ProcessContext

-- | Cache of previously parsed cabal files.
--   
--   TODO: This is really an ugly hack to avoid spamming the user with
--   warnings when we parse cabal files multiple times and bypass
--   performance issues. Ideally: we would just design the system such that
--   it only ever parses a cabal file once. But for now, this is a decent
--   workaround. See:
--   <a>https://github.com/commercialhaskell/stack/issues/3591</a>.
[runnerParsedCabalFiles] :: Runner -> !IORef (Map PackageIdentifierRevision GenericPackageDescription, Map (Path Abs Dir) (GenericPackageDescription, Path Abs File))
class (HasProcessContext env, HasLogFunc env) => HasRunner env
runnerL :: HasRunner env => Lens' env Runner
terminalL :: HasRunner env => Lens' env Bool
useColorL :: HasRunner env => Lens' env Bool
reExecL :: HasRunner env => Lens' env Bool
data ColorWhen
ColorNever :: ColorWhen
ColorAlways :: ColorWhen
ColorAuto :: ColorWhen

-- | With a <a>Runner</a>, do the thing
withRunner :: MonadUnliftIO m => LogLevel -> Bool -> Bool -> ColorWhen -> Maybe Int -> Bool -> (Runner -> m a) -> m a
instance GHC.Generics.Generic Stack.Types.Runner.ColorWhen
instance GHC.Show.Show Stack.Types.Runner.ColorWhen
instance GHC.Classes.Eq Stack.Types.Runner.ColorWhen
instance Stack.Types.Runner.HasRunner Stack.Types.Runner.Runner
instance RIO.Process.HasProcessContext Stack.Types.Runner.Runner
instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Runner.Runner


-- | This version of the module is only for non-Windows (eg unix-like)
--   operating systems.
module Stack.DefaultColorWhen
defaultColorWhen :: IO ColorWhen


-- | Nix configuration
module Stack.Config.Nix

-- | Interprets NixOptsMonoid options.
nixOptsFromMonoid :: HasRunner env => NixOptsMonoid -> OS -> RIO env NixOpts
nixCompiler :: CompilerVersion a -> Either StringException Text
data StackNixException

-- | Nix can't be given packages and a shell file at the same time
NixCannotUseShellFileAndPackagesException :: StackNixException
instance GHC.Exception.Type.Exception Stack.Config.Nix.StackNixException
instance GHC.Show.Show Stack.Config.Nix.StackNixException


-- | This module re-exports some of the interface for
--   <a>Text.PrettyPrint.Annotated.Leijen</a> along with additional
--   definitions useful for stack.
--   
--   It defines a <a>Monoid</a> instance for <a>Doc</a>.
module Text.PrettyPrint.Leijen.Extended
class Display a where {
    type family Ann a;
    type Ann a = AnsiAnn;
}
display :: Display a => a -> Doc (Ann a)
display :: (Display a, Show a) => a -> Doc (Ann a)
type AnsiDoc = Doc AnsiAnn
newtype AnsiAnn
AnsiAnn :: [SGR] -> AnsiAnn
class HasAnsiAnn a
getAnsiAnn :: HasAnsiAnn a => a -> AnsiAnn
toAnsiDoc :: HasAnsiAnn a => Doc a -> AnsiDoc
hDisplayAnsi :: (Display a, HasAnsiAnn (Ann a), MonadIO m) => Handle -> Int -> a -> m ()
displayAnsi :: (Display a, HasAnsiAnn (Ann a)) => Int -> a -> Text
displayPlain :: Display a => Int -> a -> Text
renderDefault :: Int -> Doc a -> SimpleDoc a
black :: Doc AnsiAnn -> Doc AnsiAnn
red :: Doc AnsiAnn -> Doc AnsiAnn
green :: Doc AnsiAnn -> Doc AnsiAnn
yellow :: Doc AnsiAnn -> Doc AnsiAnn
blue :: Doc AnsiAnn -> Doc AnsiAnn
magenta :: Doc AnsiAnn -> Doc AnsiAnn
cyan :: Doc AnsiAnn -> Doc AnsiAnn
white :: Doc AnsiAnn -> Doc AnsiAnn
dullblack :: Doc AnsiAnn -> Doc AnsiAnn
dullred :: Doc AnsiAnn -> Doc AnsiAnn
dullgreen :: Doc AnsiAnn -> Doc AnsiAnn
dullyellow :: Doc AnsiAnn -> Doc AnsiAnn
dullblue :: Doc AnsiAnn -> Doc AnsiAnn
dullmagenta :: Doc AnsiAnn -> Doc AnsiAnn
dullcyan :: Doc AnsiAnn -> Doc AnsiAnn
dullwhite :: Doc AnsiAnn -> Doc AnsiAnn
onblack :: Doc AnsiAnn -> Doc AnsiAnn
onred :: Doc AnsiAnn -> Doc AnsiAnn
ongreen :: Doc AnsiAnn -> Doc AnsiAnn
onyellow :: Doc AnsiAnn -> Doc AnsiAnn
onblue :: Doc AnsiAnn -> Doc AnsiAnn
onmagenta :: Doc AnsiAnn -> Doc AnsiAnn
oncyan :: Doc AnsiAnn -> Doc AnsiAnn
onwhite :: Doc AnsiAnn -> Doc AnsiAnn
ondullblack :: Doc AnsiAnn -> Doc AnsiAnn
ondullred :: Doc AnsiAnn -> Doc AnsiAnn
ondullgreen :: Doc AnsiAnn -> Doc AnsiAnn
ondullyellow :: Doc AnsiAnn -> Doc AnsiAnn
ondullblue :: Doc AnsiAnn -> Doc AnsiAnn
ondullmagenta :: Doc AnsiAnn -> Doc AnsiAnn
ondullcyan :: Doc AnsiAnn -> Doc AnsiAnn
ondullwhite :: Doc AnsiAnn -> Doc AnsiAnn
bold :: Doc AnsiAnn -> Doc AnsiAnn
faint :: Doc AnsiAnn -> Doc AnsiAnn
normal :: Doc AnsiAnn -> Doc AnsiAnn

-- | The abstract data type <tt>Doc a</tt> represents pretty documents.
--   
--   <tt>Doc a</tt> is an instance of the <a>Show</a> class. <tt>(show
--   doc)</tt> pretty prints document <tt>doc</tt> with a page width of 100
--   characters and a ribbon width of 40 characters.
--   
--   <pre>
--   show (text "hello" &lt;$&gt; text "world")
--   </pre>
--   
--   Which would return the string "hello\nworld", i.e.
--   
--   <pre>
--   hello
--   world
--   </pre>
data Doc a

-- | The document <tt>(nest i x)</tt> renders document <tt>x</tt> with the
--   current indentation level increased by i (See also <a>hang</a>,
--   <a>align</a> and <a>indent</a>).
--   
--   <pre>
--   nest 2 (text "hello" &lt;$&gt; text "world") &lt;$&gt; text "!"
--   </pre>
--   
--   outputs as:
--   
--   <pre>
--   hello
--     world
--   !
--   </pre>
nest :: () => Int -> Doc a -> Doc a

-- | The <tt>line</tt> document advances to the next line and indents to
--   the current nesting level. Doc aument <tt>line</tt> behaves like
--   <tt>(text " ")</tt> if the line break is undone by <a>group</a>.
line :: () => Doc a

-- | The <tt>linebreak</tt> document advances to the next line and indents
--   to the current nesting level. Document <tt>linebreak</tt> behaves like
--   <a>empty</a> if the line break is undone by <a>group</a>.
linebreak :: () => Doc a

-- | The <tt>group</tt> combinator is used to specify alternative layouts.
--   The document <tt>(group x)</tt> undoes all line breaks in document
--   <tt>x</tt>. The resulting line is added to the current line if that
--   fits the page. Otherwise, the document <tt>x</tt> is rendered without
--   any changes.
group :: () => Doc a -> Doc a

-- | The document <tt>softline</tt> behaves like <a>space</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softline = group line
--   </pre>
softline :: () => Doc a

-- | The document <tt>softbreak</tt> behaves like <a>empty</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softbreak  = group linebreak
--   </pre>
softbreak :: () => Doc a

-- | The document <tt>(align x)</tt> renders document <tt>x</tt> with the
--   nesting level set to the current column. It is used for example to
--   implement <a>hang</a>.
--   
--   As an example, we will put a document right above another one,
--   regardless of the current nesting level:
--   
--   <pre>
--   x $$ y  = align (x &lt;$&gt; y)
--   </pre>
--   
--   <pre>
--   test    = text "hi" &lt;+&gt; (text "nice" $$ text "world")
--   </pre>
--   
--   which will be layed out as:
--   
--   <pre>
--   hi nice
--      world
--   </pre>
align :: () => Doc a -> Doc a

-- | The hang combinator implements hanging indentation. The document
--   <tt>(hang i x)</tt> renders document <tt>x</tt> with a nesting level
--   set to the current column plus <tt>i</tt>. The following example uses
--   hanging indentation for some text:
--   
--   <pre>
--   test  = hang 4 (fillSep (map text
--           (words "the hang combinator indents these words !")))
--   </pre>
--   
--   Which lays out on a page with a width of 20 characters as:
--   
--   <pre>
--   the hang combinator
--       indents these
--       words !
--   </pre>
--   
--   The <tt>hang</tt> combinator is implemented as:
--   
--   <pre>
--   hang i x  = align (nest i x)
--   </pre>
hang :: () => Int -> Doc a -> Doc a

-- | The document <tt>(indent i x)</tt> indents document <tt>x</tt> with
--   <tt>i</tt> spaces.
--   
--   <pre>
--   test  = indent 4 (fillSep (map text
--           (words "the indent combinator indents these words !")))
--   </pre>
--   
--   Which lays out with a page width of 20 as:
--   
--   <pre>
--   the indent
--   combinator
--   indents these
--   words !
--   </pre>
indent :: () => Int -> Doc a -> Doc a

-- | The document <tt>(encloseSep l r sep xs)</tt> concatenates the
--   documents <tt>xs</tt> separated by <tt>sep</tt> and encloses the
--   resulting document by <tt>l</tt> and <tt>r</tt>. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All separators are put in front of the elements.
--   For example, the combinator <a>list</a> can be defined with
--   <tt>encloseSep</tt>:
--   
--   <pre>
--   list xs = encloseSep lbracket rbracket comma xs
--   test    = text "list" &lt;+&gt; (list (map int [10,200,3000]))
--   </pre>
--   
--   Which is layed out with a page width of 20 as:
--   
--   <pre>
--   list [10,200,3000]
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   list [10
--        ,200
--        ,3000]
--   </pre>
encloseSep :: () => Doc a -> Doc a -> Doc a -> [Doc a] -> Doc a

-- | The document <tt>(x &lt;+&gt; y)</tt> concatenates document <tt>x</tt>
--   and <tt>y</tt> with a <tt>space</tt> in between. (infixr 6)
(<+>) :: () => Doc a -> Doc a -> Doc a
infixr 6 <+>

-- | The document <tt>(hsep xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with (<a>&lt;+&gt;</a>).
hsep :: () => [Doc a] -> Doc a

-- | The document <tt>(vsep xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;$&gt;)</tt>. If a <a>group</a> undoes the
--   line breaks inserted by <tt>vsep</tt>, all documents are separated
--   with a space.
--   
--   <pre>
--   someText = map text (words ("text to lay out"))
--   
--   test     = text "some" &lt;+&gt; vsep someText
--   </pre>
--   
--   This is layed out as:
--   
--   <pre>
--   some text
--   to
--   lay
--   out
--   </pre>
--   
--   The <a>align</a> combinator can be used to align the documents under
--   their first element
--   
--   <pre>
--   test     = text "some" &lt;+&gt; align (vsep someText)
--   </pre>
--   
--   Which is printed as:
--   
--   <pre>
--   some text
--        to
--        lay
--        out
--   </pre>
vsep :: () => [Doc a] -> Doc a

-- | The document <tt>(fillSep xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;+&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>line</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillSep xs  = foldr (&lt;/&gt;) empty xs
--   </pre>
fillSep :: () => [Doc a] -> Doc a

-- | The document <tt>(sep xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;+&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;$&gt;)</tt>.
--   
--   <pre>
--   sep xs  = group (vsep xs)
--   </pre>
sep :: () => [Doc a] -> Doc a

-- | The document <tt>(hcat xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt>.
hcat :: () => [Doc a] -> Doc a

-- | The document <tt>(vcat xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;$$&gt;)</tt>. If a <a>group</a> undoes the
--   line breaks inserted by <tt>vcat</tt>, all documents are directly
--   concatenated.
vcat :: () => [Doc a] -> Doc a

-- | The document <tt>(fillCat xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>linebreak</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillCat xs  = foldr (\&lt;\/\/\&gt;) empty xs
--   </pre>
fillCat :: () => [Doc a] -> Doc a

-- | The document <tt>(cat xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;$$&gt;)</tt>.
--   
--   <pre>
--   cat xs  = group (vcat xs)
--   </pre>
cat :: () => [Doc a] -> Doc a

-- | <tt>(punctuate p xs)</tt> concatenates all documents in <tt>xs</tt>
--   with document <tt>p</tt> except for the last document.
--   
--   <pre>
--   someText = map text ["words","in","a","tuple"]
--   test     = parens (align (cat (punctuate comma someText)))
--   </pre>
--   
--   This is layed out on a page width of 20 as:
--   
--   <pre>
--   (words,in,a,tuple)
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   (words,
--    in,
--    a,
--    tuple)
--   </pre>
--   
--   (If you want put the commas in front of their elements instead of at
--   the end, you should use <a>tupled</a> or, in general,
--   <a>encloseSep</a>.)
punctuate :: () => Doc a -> [Doc a] -> [Doc a]

-- | The document <tt>(fill i x)</tt> renders document <tt>x</tt>. It than
--   appends <tt>space</tt>s until the width is equal to <tt>i</tt>. If the
--   width of <tt>x</tt> is already larger, nothing is appended. This
--   combinator is quite useful in practice to output a list of bindings.
--   The following example demonstrates this.
--   
--   <pre>
--   types  = [("empty","Doc a")
--            ,("nest","Int -&gt; Doc a -&gt; Doc a")
--            ,("linebreak","Doc a")]
--   
--   ptype (name,tp)
--          = fill 6 (text name) &lt;+&gt; text "::" &lt;+&gt; text tp
--   
--   test   = text "let" &lt;+&gt; align (vcat (map ptype types))
--   </pre>
--   
--   Which is layed out as:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak :: Doc a
--   </pre>
fill :: () => Int -> Doc a -> Doc a

-- | The document <tt>(fillBreak i x)</tt> first renders document
--   <tt>x</tt>. It than appends <tt>space</tt>s until the width is equal
--   to <tt>i</tt>. If the width of <tt>x</tt> is already larger than
--   <tt>i</tt>, the nesting level is increased by <tt>i</tt> and a
--   <tt>line</tt> is appended. When we redefine <tt>ptype</tt> in the
--   previous example to use <tt>fillBreak</tt>, we get a useful variation
--   of the previous output:
--   
--   <pre>
--   ptype (name,tp)
--          = fillBreak 6 (text name) &lt;+&gt; text "::" &lt;+&gt; text tp
--   </pre>
--   
--   The output will now be:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak
--              :: Doc a
--   </pre>
fillBreak :: () => Int -> Doc a -> Doc a

-- | The document <tt>(enclose l r x)</tt> encloses document <tt>x</tt>
--   between documents <tt>l</tt> and <tt>r</tt> using <tt>(&lt;&gt;)</tt>.
--   
--   <pre>
--   enclose l r x   = l &lt;&gt; x &lt;&gt; r
--   </pre>
enclose :: () => Doc a -> Doc a -> Doc a -> Doc a

-- | Document <tt>(squotes x)</tt> encloses document <tt>x</tt> with single
--   quotes "'".
squotes :: () => Doc a -> Doc a

-- | Document <tt>(dquotes x)</tt> encloses document <tt>x</tt> with double
--   quotes '"'.
dquotes :: () => Doc a -> Doc a

-- | Document <tt>(parens x)</tt> encloses document <tt>x</tt> in
--   parenthesis, "(" and ")".
parens :: () => Doc a -> Doc a

-- | Document <tt>(angles x)</tt> encloses document <tt>x</tt> in angles,
--   "&lt;" and "&gt;".
angles :: () => Doc a -> Doc a

-- | Document <tt>(braces x)</tt> encloses document <tt>x</tt> in braces,
--   "{" and "}".
braces :: () => Doc a -> Doc a

-- | Document <tt>(brackets x)</tt> encloses document <tt>x</tt> in square
--   brackets, "[" and "]".
brackets :: () => Doc a -> Doc a
annotate :: () => a -> Doc a -> Doc a

-- | Strip annotations from a document. This is useful for re-using the
--   textual formatting of some sub-document, but applying a different
--   high-level annotation.
noAnnotate :: () => Doc a -> Doc a
instance GHC.Classes.Ord Text.PrettyPrint.Leijen.Extended.SGRTag
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.SGRTag
instance GHC.Base.Monoid Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Base.Semigroup Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Show.Show Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance Text.PrettyPrint.Leijen.Extended.HasAnsiAnn Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance Text.PrettyPrint.Leijen.Extended.HasAnsiAnn ()
instance Text.PrettyPrint.Leijen.Extended.Display (Text.PrettyPrint.Annotated.Leijen.Doc a)
instance GHC.Base.Semigroup (Text.PrettyPrint.Annotated.Leijen.Doc a)
instance GHC.Base.Monoid (Text.PrettyPrint.Annotated.Leijen.Doc a)

module Stack.PrettyPrint
displayPlain :: Display a => Int -> a -> Text
displayWithColor :: (HasRunner env, Display a, HasAnsiAnn (Ann a), MonadReader env m, HasLogFunc env, HasCallStack) => a -> m Text
prettyDebug :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyInfo :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyNote :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyWarn :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyError :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyWarnNoIndent :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyErrorNoIndent :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m ()
prettyDebugL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyInfoL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyNoteL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyWarnL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyErrorL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyWarnNoIndentL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyErrorNoIndentL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m ()
prettyDebugS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()
prettyInfoS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()
prettyNoteS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()
prettyWarnS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()
prettyErrorS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()
prettyWarnNoIndentS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()
prettyErrorNoIndentS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m ()

-- | Style an <a>AnsiDoc</a> as a warning. Should be used sparingly, not to
--   style entire long messages. For example, it's used to style the
--   "Warning:" label for an error message, not the entire message.
styleWarning :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> as an error. Should be used sparingly, not to
--   style entire long messages. For example, it's used to style the
--   "Error:" label for an error message, not the entire message.
styleError :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> in a way to emphasize that it is a
--   particularly good thing.
styleGood :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> as a shell command, i.e. when suggesting
--   something to the user that should be typed in directly as written.
styleShell :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> as a filename. See <a>styleDir</a> for
--   directories.
styleFile :: AnsiDoc -> AnsiDoc

-- | Style an <tt>AsciDoc</tt> as a URL. For now using the same style as
--   files.
styleUrl :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> as a directory name. See <a>styleFile</a> for
--   files.
styleDir :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> as a module name
styleModule :: AnsiDoc -> AnsiDoc

-- | Style an <a>AnsiDoc</a> in a way that emphasizes that it is related to
--   a current thing. For example, could be used when talking about the
--   current package we're processing when outputting the name of it.
styleCurrent :: AnsiDoc -> AnsiDoc
styleTarget :: AnsiDoc -> AnsiDoc

-- | Style used to highlight part of a recommended course of action.
styleRecommendation :: AnsiDoc -> AnsiDoc
displayMilliseconds :: Double -> AnsiDoc

-- | Display a bulleted list of <a>AnsiDoc</a>.
bulletedList :: [AnsiDoc] -> AnsiDoc

-- | Display a bulleted list of <a>AnsiDoc</a> with a blank line between
--   each.
spacedBulletedList :: [AnsiDoc] -> AnsiDoc
debugBracket :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m, MonadUnliftIO m) => Doc AnsiAnn -> m a -> m a
class Display a where {
    type family Ann a;
    type Ann a = AnsiAnn;
}
display :: Display a => a -> Doc (Ann a)
display :: (Display a, Show a) => a -> Doc (Ann a)
type AnsiDoc = Doc AnsiAnn
newtype AnsiAnn
AnsiAnn :: [SGR] -> AnsiAnn
class HasAnsiAnn a
getAnsiAnn :: HasAnsiAnn a => a -> AnsiAnn
toAnsiDoc :: HasAnsiAnn a => Doc a -> AnsiDoc

-- | The abstract data type <tt>Doc a</tt> represents pretty documents.
--   
--   <tt>Doc a</tt> is an instance of the <a>Show</a> class. <tt>(show
--   doc)</tt> pretty prints document <tt>doc</tt> with a page width of 100
--   characters and a ribbon width of 40 characters.
--   
--   <pre>
--   show (text "hello" &lt;$&gt; text "world")
--   </pre>
--   
--   Which would return the string "hello\nworld", i.e.
--   
--   <pre>
--   hello
--   world
--   </pre>
data Doc a

-- | The document <tt>(nest i x)</tt> renders document <tt>x</tt> with the
--   current indentation level increased by i (See also <a>hang</a>,
--   <a>align</a> and <a>indent</a>).
--   
--   <pre>
--   nest 2 (text "hello" &lt;$&gt; text "world") &lt;$&gt; text "!"
--   </pre>
--   
--   outputs as:
--   
--   <pre>
--   hello
--     world
--   !
--   </pre>
nest :: () => Int -> Doc a -> Doc a

-- | The <tt>line</tt> document advances to the next line and indents to
--   the current nesting level. Doc aument <tt>line</tt> behaves like
--   <tt>(text " ")</tt> if the line break is undone by <a>group</a>.
line :: () => Doc a

-- | The <tt>linebreak</tt> document advances to the next line and indents
--   to the current nesting level. Document <tt>linebreak</tt> behaves like
--   <a>empty</a> if the line break is undone by <a>group</a>.
linebreak :: () => Doc a

-- | The <tt>group</tt> combinator is used to specify alternative layouts.
--   The document <tt>(group x)</tt> undoes all line breaks in document
--   <tt>x</tt>. The resulting line is added to the current line if that
--   fits the page. Otherwise, the document <tt>x</tt> is rendered without
--   any changes.
group :: () => Doc a -> Doc a

-- | The document <tt>softline</tt> behaves like <a>space</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softline = group line
--   </pre>
softline :: () => Doc a

-- | The document <tt>softbreak</tt> behaves like <a>empty</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softbreak  = group linebreak
--   </pre>
softbreak :: () => Doc a

-- | The document <tt>(align x)</tt> renders document <tt>x</tt> with the
--   nesting level set to the current column. It is used for example to
--   implement <a>hang</a>.
--   
--   As an example, we will put a document right above another one,
--   regardless of the current nesting level:
--   
--   <pre>
--   x $$ y  = align (x &lt;$&gt; y)
--   </pre>
--   
--   <pre>
--   test    = text "hi" &lt;+&gt; (text "nice" $$ text "world")
--   </pre>
--   
--   which will be layed out as:
--   
--   <pre>
--   hi nice
--      world
--   </pre>
align :: () => Doc a -> Doc a

-- | The hang combinator implements hanging indentation. The document
--   <tt>(hang i x)</tt> renders document <tt>x</tt> with a nesting level
--   set to the current column plus <tt>i</tt>. The following example uses
--   hanging indentation for some text:
--   
--   <pre>
--   test  = hang 4 (fillSep (map text
--           (words "the hang combinator indents these words !")))
--   </pre>
--   
--   Which lays out on a page with a width of 20 characters as:
--   
--   <pre>
--   the hang combinator
--       indents these
--       words !
--   </pre>
--   
--   The <tt>hang</tt> combinator is implemented as:
--   
--   <pre>
--   hang i x  = align (nest i x)
--   </pre>
hang :: () => Int -> Doc a -> Doc a

-- | The document <tt>(indent i x)</tt> indents document <tt>x</tt> with
--   <tt>i</tt> spaces.
--   
--   <pre>
--   test  = indent 4 (fillSep (map text
--           (words "the indent combinator indents these words !")))
--   </pre>
--   
--   Which lays out with a page width of 20 as:
--   
--   <pre>
--   the indent
--   combinator
--   indents these
--   words !
--   </pre>
indent :: () => Int -> Doc a -> Doc a

-- | The document <tt>(encloseSep l r sep xs)</tt> concatenates the
--   documents <tt>xs</tt> separated by <tt>sep</tt> and encloses the
--   resulting document by <tt>l</tt> and <tt>r</tt>. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All separators are put in front of the elements.
--   For example, the combinator <a>list</a> can be defined with
--   <tt>encloseSep</tt>:
--   
--   <pre>
--   list xs = encloseSep lbracket rbracket comma xs
--   test    = text "list" &lt;+&gt; (list (map int [10,200,3000]))
--   </pre>
--   
--   Which is layed out with a page width of 20 as:
--   
--   <pre>
--   list [10,200,3000]
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   list [10
--        ,200
--        ,3000]
--   </pre>
encloseSep :: () => Doc a -> Doc a -> Doc a -> [Doc a] -> Doc a

-- | The document <tt>(x &lt;+&gt; y)</tt> concatenates document <tt>x</tt>
--   and <tt>y</tt> with a <tt>space</tt> in between. (infixr 6)
(<+>) :: () => Doc a -> Doc a -> Doc a
infixr 6 <+>

-- | The document <tt>(hsep xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with (<a>&lt;+&gt;</a>).
hsep :: () => [Doc a] -> Doc a

-- | The document <tt>(vsep xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;$&gt;)</tt>. If a <a>group</a> undoes the
--   line breaks inserted by <tt>vsep</tt>, all documents are separated
--   with a space.
--   
--   <pre>
--   someText = map text (words ("text to lay out"))
--   
--   test     = text "some" &lt;+&gt; vsep someText
--   </pre>
--   
--   This is layed out as:
--   
--   <pre>
--   some text
--   to
--   lay
--   out
--   </pre>
--   
--   The <a>align</a> combinator can be used to align the documents under
--   their first element
--   
--   <pre>
--   test     = text "some" &lt;+&gt; align (vsep someText)
--   </pre>
--   
--   Which is printed as:
--   
--   <pre>
--   some text
--        to
--        lay
--        out
--   </pre>
vsep :: () => [Doc a] -> Doc a

-- | The document <tt>(fillSep xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;+&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>line</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillSep xs  = foldr (&lt;/&gt;) empty xs
--   </pre>
fillSep :: () => [Doc a] -> Doc a

-- | The document <tt>(sep xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;+&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;$&gt;)</tt>.
--   
--   <pre>
--   sep xs  = group (vsep xs)
--   </pre>
sep :: () => [Doc a] -> Doc a

-- | The document <tt>(hcat xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt>.
hcat :: () => [Doc a] -> Doc a

-- | The document <tt>(vcat xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;$$&gt;)</tt>. If a <a>group</a> undoes the
--   line breaks inserted by <tt>vcat</tt>, all documents are directly
--   concatenated.
vcat :: () => [Doc a] -> Doc a

-- | The document <tt>(fillCat xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>linebreak</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillCat xs  = foldr (\&lt;\/\/\&gt;) empty xs
--   </pre>
fillCat :: () => [Doc a] -> Doc a

-- | The document <tt>(cat xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;$$&gt;)</tt>.
--   
--   <pre>
--   cat xs  = group (vcat xs)
--   </pre>
cat :: () => [Doc a] -> Doc a

-- | <tt>(punctuate p xs)</tt> concatenates all documents in <tt>xs</tt>
--   with document <tt>p</tt> except for the last document.
--   
--   <pre>
--   someText = map text ["words","in","a","tuple"]
--   test     = parens (align (cat (punctuate comma someText)))
--   </pre>
--   
--   This is layed out on a page width of 20 as:
--   
--   <pre>
--   (words,in,a,tuple)
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   (words,
--    in,
--    a,
--    tuple)
--   </pre>
--   
--   (If you want put the commas in front of their elements instead of at
--   the end, you should use <a>tupled</a> or, in general,
--   <a>encloseSep</a>.)
punctuate :: () => Doc a -> [Doc a] -> [Doc a]

-- | The document <tt>(fill i x)</tt> renders document <tt>x</tt>. It than
--   appends <tt>space</tt>s until the width is equal to <tt>i</tt>. If the
--   width of <tt>x</tt> is already larger, nothing is appended. This
--   combinator is quite useful in practice to output a list of bindings.
--   The following example demonstrates this.
--   
--   <pre>
--   types  = [("empty","Doc a")
--            ,("nest","Int -&gt; Doc a -&gt; Doc a")
--            ,("linebreak","Doc a")]
--   
--   ptype (name,tp)
--          = fill 6 (text name) &lt;+&gt; text "::" &lt;+&gt; text tp
--   
--   test   = text "let" &lt;+&gt; align (vcat (map ptype types))
--   </pre>
--   
--   Which is layed out as:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak :: Doc a
--   </pre>
fill :: () => Int -> Doc a -> Doc a

-- | The document <tt>(fillBreak i x)</tt> first renders document
--   <tt>x</tt>. It than appends <tt>space</tt>s until the width is equal
--   to <tt>i</tt>. If the width of <tt>x</tt> is already larger than
--   <tt>i</tt>, the nesting level is increased by <tt>i</tt> and a
--   <tt>line</tt> is appended. When we redefine <tt>ptype</tt> in the
--   previous example to use <tt>fillBreak</tt>, we get a useful variation
--   of the previous output:
--   
--   <pre>
--   ptype (name,tp)
--          = fillBreak 6 (text name) &lt;+&gt; text "::" &lt;+&gt; text tp
--   </pre>
--   
--   The output will now be:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak
--              :: Doc a
--   </pre>
fillBreak :: () => Int -> Doc a -> Doc a

-- | The document <tt>(enclose l r x)</tt> encloses document <tt>x</tt>
--   between documents <tt>l</tt> and <tt>r</tt> using <tt>(&lt;&gt;)</tt>.
--   
--   <pre>
--   enclose l r x   = l &lt;&gt; x &lt;&gt; r
--   </pre>
enclose :: () => Doc a -> Doc a -> Doc a -> Doc a

-- | Document <tt>(squotes x)</tt> encloses document <tt>x</tt> with single
--   quotes "'".
squotes :: () => Doc a -> Doc a

-- | Document <tt>(dquotes x)</tt> encloses document <tt>x</tt> with double
--   quotes '"'.
dquotes :: () => Doc a -> Doc a

-- | Document <tt>(parens x)</tt> encloses document <tt>x</tt> in
--   parenthesis, "(" and ")".
parens :: () => Doc a -> Doc a

-- | Document <tt>(angles x)</tt> encloses document <tt>x</tt> in angles,
--   "&lt;" and "&gt;".
angles :: () => Doc a -> Doc a

-- | Document <tt>(braces x)</tt> encloses document <tt>x</tt> in braces,
--   "{" and "}".
braces :: () => Doc a -> Doc a

-- | Document <tt>(brackets x)</tt> encloses document <tt>x</tt> in square
--   brackets, "[" and "]".
brackets :: () => Doc a -> Doc a

-- | Use after a label and before the rest of what's being labelled for
--   consistent spacing<i>indenting</i>etc.
--   
--   For example this is used after "Warning:" in warning messages.
indentAfterLabel :: Doc a -> Doc a

-- | Make a <a>Doc</a> from each word in a <a>String</a>
wordDocs :: String -> [Doc a]

-- | Wordwrap a <a>String</a>
flow :: String -> Doc a
instance Text.PrettyPrint.Leijen.Extended.Display Stack.Types.PackageName.PackageName
instance Text.PrettyPrint.Leijen.Extended.Display Stack.Types.PackageIdentifier.PackageIdentifier
instance Text.PrettyPrint.Leijen.Extended.Display Stack.Types.Version.Version
instance Text.PrettyPrint.Leijen.Extended.Display (Path.Internal.Path b Path.File)
instance Text.PrettyPrint.Leijen.Extended.Display (Path.Internal.Path b Path.Dir)
instance Text.PrettyPrint.Leijen.Extended.Display (Stack.Types.PackageName.PackageName, Stack.Types.NamedComponent.NamedComponent)
instance Text.PrettyPrint.Leijen.Extended.Display Distribution.ModuleName.ModuleName

module Network.HTTP.Download.Verified

-- | Copied and extended version of Network.HTTP.Download.download.
--   
--   Has the following additional features: * Verifies that response
--   content-length header (if present) matches expected length * Limits
--   the download to (close to) the expected # of bytes * Verifies that the
--   expected # bytes were downloaded (not too few) * Verifies md5 if
--   response includes content-md5 header * Verifies the expected hashes
--   
--   Throws VerifiedDownloadException. Throws IOExceptions related to file
--   system operations. Throws HttpException.
verifiedDownload :: HasRunner env => DownloadRequest -> Path Abs File -> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) -> RIO env Bool
recoveringHttp :: forall env a. HasRunner env => RetryPolicy -> RIO env a -> RIO env a

-- | A request together with some checks to perform.
data DownloadRequest
DownloadRequest :: Request -> [HashCheck] -> Maybe LengthCheck -> RetryPolicy -> DownloadRequest
[drRequest] :: DownloadRequest -> Request
[drHashChecks] :: DownloadRequest -> [HashCheck]
[drLengthCheck] :: DownloadRequest -> Maybe LengthCheck
[drRetryPolicy] :: DownloadRequest -> RetryPolicy

-- | Default to retrying seven times with exponential backoff starting from
--   one hundred milliseconds.
--   
--   This means the tries will occur after these delays if necessary:
--   
--   <ul>
--   <li>0.1s</li>
--   <li>0.2s</li>
--   <li>0.4s</li>
--   <li>0.8s</li>
--   <li>1.6s</li>
--   <li>3.2s</li>
--   <li>6.4s</li>
--   </ul>
drRetryPolicyDefault :: RetryPolicy
data HashCheck
HashCheck :: a -> CheckHexDigest -> HashCheck
[hashCheckAlgorithm] :: HashCheck -> a
[hashCheckHexDigest] :: HashCheck -> CheckHexDigest
data CheckHexDigest
CheckHexDigestString :: String -> CheckHexDigest
CheckHexDigestByteString :: ByteString -> CheckHexDigest
CheckHexDigestHeader :: ByteString -> CheckHexDigest
type LengthCheck = Int

-- | An exception regarding verification of a download.
data VerifiedDownloadException
WrongContentLength :: Request -> Int -> ByteString -> VerifiedDownloadException
WrongStreamLength :: Request -> Int -> Int -> VerifiedDownloadException
WrongDigest :: Request -> String -> CheckHexDigest -> String -> VerifiedDownloadException
instance GHC.Show.Show Network.HTTP.Download.Verified.VerifyFileException
instance GHC.Show.Show Network.HTTP.Download.Verified.CheckHexDigest
instance GHC.Show.Show Network.HTTP.Download.Verified.HashCheck
instance GHC.Exception.Type.Exception Network.HTTP.Download.Verified.VerifyFileException
instance GHC.Show.Show Network.HTTP.Download.Verified.VerifiedDownloadException
instance GHC.Exception.Type.Exception Network.HTTP.Download.Verified.VerifiedDownloadException
instance Data.String.IsString Network.HTTP.Download.Verified.CheckHexDigest

module Network.HTTP.Download

-- | Copied and extended version of Network.HTTP.Download.download.
--   
--   Has the following additional features: * Verifies that response
--   content-length header (if present) matches expected length * Limits
--   the download to (close to) the expected # of bytes * Verifies that the
--   expected # bytes were downloaded (not too few) * Verifies md5 if
--   response includes content-md5 header * Verifies the expected hashes
--   
--   Throws VerifiedDownloadException. Throws IOExceptions related to file
--   system operations. Throws HttpException.
verifiedDownload :: HasRunner env => DownloadRequest -> Path Abs File -> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) -> RIO env Bool

-- | A request together with some checks to perform.
data DownloadRequest
DownloadRequest :: Request -> [HashCheck] -> Maybe LengthCheck -> RetryPolicy -> DownloadRequest
[drRequest] :: DownloadRequest -> Request
[drHashChecks] :: DownloadRequest -> [HashCheck]
[drLengthCheck] :: DownloadRequest -> Maybe LengthCheck
[drRetryPolicy] :: DownloadRequest -> RetryPolicy

-- | Default to retrying seven times with exponential backoff starting from
--   one hundred milliseconds.
--   
--   This means the tries will occur after these delays if necessary:
--   
--   <ul>
--   <li>0.1s</li>
--   <li>0.2s</li>
--   <li>0.4s</li>
--   <li>0.8s</li>
--   <li>1.6s</li>
--   <li>3.2s</li>
--   <li>6.4s</li>
--   </ul>
drRetryPolicyDefault :: RetryPolicy
data HashCheck
HashCheck :: a -> CheckHexDigest -> HashCheck
[hashCheckAlgorithm] :: HashCheck -> a
[hashCheckHexDigest] :: HashCheck -> CheckHexDigest
data DownloadException
RedownloadInvalidResponse :: Request -> Path Abs File -> Response () -> DownloadException
RedownloadHttpError :: HttpException -> DownloadException
data CheckHexDigest
CheckHexDigestString :: String -> CheckHexDigest
CheckHexDigestByteString :: ByteString -> CheckHexDigest
CheckHexDigestHeader :: ByteString -> CheckHexDigest
type LengthCheck = Int

-- | An exception regarding verification of a download.
data VerifiedDownloadException
WrongContentLength :: Request -> Int -> ByteString -> VerifiedDownloadException
WrongStreamLength :: Request -> Int -> Int -> VerifiedDownloadException
WrongDigest :: Request -> String -> CheckHexDigest -> String -> VerifiedDownloadException

-- | Download the given URL to the given location. If the file already
--   exists, no download is performed. Otherwise, creates the parent
--   directory, downloads to a temporary file, and on file download
--   completion moves to the appropriate destination.
--   
--   Throws an exception if things go wrong
download :: HasRunner env => Request -> Path Abs File -> RIO env Bool

-- | Same as <a>download</a>, but will download a file a second time if it
--   is already present.
--   
--   Returns <a>True</a> if the file was downloaded, <a>False</a> otherwise
redownload :: HasRunner env => Request -> Path Abs File -> RIO env Bool
httpJSON :: (MonadIO m, FromJSON a) => Request -> m (Response a)
httpLbs :: MonadIO m => Request -> m (Response ByteString)
httpLBS :: MonadIO m => Request -> m (Response ByteString)

-- | Convert a URL into a <a>Request</a>.
--   
--   This function defaults some of the values in <a>Request</a>, such as
--   setting <a>method</a> to <tt><a>GET</a></tt> and <a>requestHeaders</a>
--   to <tt>[]</tt>.
--   
--   Since this function uses <a>MonadThrow</a>, the return monad can be
--   anything that is an instance of <a>MonadThrow</a>, such as <a>IO</a>
--   or <a>Maybe</a>.
--   
--   You can place the request method at the beginning of the URL separated
--   by a space, e.g.:
--   
--   @@<tt> parseRequest "POST <a>http://httpbin.org/post"</a> </tt>@@
--   
--   Note that the request method must be provided as all capital letters.
--   
--   A <a>Request</a> created by this function won't cause exceptions on
--   non-2XX response status codes.
--   
--   To create a request which throws on non-2XX status codes, see
--   <a>parseUrlThrow</a>
parseRequest :: MonadThrow m => String -> m Request

-- | Same as <a>parseRequest</a>, except will throw an <a>HttpException</a>
--   in the event of a non-2XX response. This uses
--   <a>throwErrorStatusCodes</a> to implement <a>checkResponse</a>.
parseUrlThrow :: MonadThrow m => String -> m Request

-- | Set the user-agent request header
setGithubHeaders :: Request -> Request
withResponse :: (MonadUnliftIO m, MonadIO n) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a
instance GHC.Show.Show Network.HTTP.Download.DownloadException
instance GHC.Exception.Type.Exception Network.HTTP.Download.DownloadException


-- | Dealing with the 01-index file and all its cabal files.
module Stack.PackageIndex

-- | Update all of the package indices
updateAllIndices :: HasCabalLoader env => RIO env ()

-- | Load the package caches, or create the caches if necessary.
--   
--   This has two levels of caching: in memory, and the on-disk cache. So,
--   feel free to call this function multiple times.
getPackageCaches :: HasCabalLoader env => RIO env (PackageCache PackageIndex)

-- | Get the known versions for a given package from the package caches.
--   
--   See <a>getPackageCaches</a> for performance notes.
getPackageVersions :: HasCabalLoader env => PackageName -> RIO env (HashMap Version (Maybe CabalHash))
lookupPackageVersions :: PackageName -> PackageCache index -> HashMap Version (Maybe CabalHash)
data CabalLoader
CabalLoader :: !IORef (Maybe (PackageCache PackageIndex)) -> ![PackageIndex] -> !Path Abs Dir -> !MVar Bool -> !Int -> !Bool -> CabalLoader
[clCache] :: CabalLoader -> !IORef (Maybe (PackageCache PackageIndex))

-- | Information on package indices. This is left biased, meaning that
--   packages in an earlier index will shadow those in a later index.
--   
--   Warning: if you override packages in an index vs what's available
--   upstream, you may correct your compiled snapshots, as different
--   projects may have different definitions of what pkg-ver means! This
--   feature is primarily intended for adding local packages, not
--   overriding. Overriding is better accomplished by adding to your list
--   of packages.
--   
--   Note that indices specified in a later config file will override
--   previous indices, <i>not</i> extend them.
--   
--   Using an assoc list instead of a Map to keep track of priority
[clIndices] :: CabalLoader -> ![PackageIndex]

-- | ~/.stack more often than not
[clStackRoot] :: CabalLoader -> !Path Abs Dir

-- | Want to try updating the index once during a single run for missing
--   package identifiers. We also want to ensure we only update once at a
--   time. Start at <tt>True</tt>.
--   
--   TODO: probably makes sense to move this concern into getPackageCaches
[clUpdateRef] :: CabalLoader -> !MVar Bool

-- | How many concurrent connections are allowed when downloading
[clConnectionCount] :: CabalLoader -> !Int

-- | Ignore a revision mismatch when loading up cabal files, and fall back
--   to the latest revision. See:
--   <a>https://github.com/commercialhaskell/stack/issues/3520</a>
[clIgnoreRevisionMismatch] :: CabalLoader -> !Bool
class HasRunner env => HasCabalLoader env
cabalLoaderL :: HasCabalLoader env => Lens' env CabalLoader

-- | Location of the 01-index.tar file
configPackageIndex :: HasCabalLoader env => IndexName -> RIO env (Path Abs File)

-- | Root for a specific package index
configPackageIndexRoot :: HasCabalLoader env => IndexName -> RIO env (Path Abs Dir)
instance GHC.Exception.Type.Exception Stack.PackageIndex.PackageIndexException
instance GHC.Show.Show Stack.PackageIndex.PackageIndexException


-- | The Config type.
module Stack.Types.Config

-- | Class for environment values which have a Platform
class HasPlatform env
platformL :: HasPlatform env => Lens' env Platform
platformL :: (HasPlatform env, HasConfig env) => Lens' env Platform
platformVariantL :: HasPlatform env => Lens' env PlatformVariant
platformVariantL :: (HasPlatform env, HasConfig env) => Lens' env PlatformVariant

-- | A variant of the platform, used to differentiate Docker builds from
--   host
data PlatformVariant
PlatformVariantNone :: PlatformVariant
PlatformVariant :: String -> PlatformVariant

-- | The top-level Stackage configuration.
data Config
Config :: !Path Rel Dir -> !Path Abs File -> !BuildOpts -> !DockerOpts -> !NixOpts -> !EnvSettings -> IO ProcessContext -> !Path Abs Dir -> !Path Abs Dir -> !Bool -> !Platform -> !PlatformVariant -> !Maybe GHCVariant -> !Maybe CompilerBuild -> !Urls -> !Bool -> !Bool -> !Bool -> !Bool -> !VersionCheck -> !Path Abs Dir -> !VersionRange -> !Int -> !Maybe (Path Abs File) -> !HpackExecutable -> !Set FilePath -> !Set FilePath -> !Bool -> !ImageOpts -> !Map Text Text -> !Maybe SCM -> !Map PackageName [Text] -> !Map ApplyGhcOptions [Text] -> ![SetupInfoLocation] -> !PvpBounds -> !Bool -> !Map (Maybe PackageName) Bool -> !Bool -> !ApplyGhcOptions -> !Bool -> !Maybe TemplateName -> !Bool -> !DumpLogs -> !Maybe (Project, Path Abs File) -> !Bool -> !Bool -> !Text -> !Runner -> !CabalLoader -> Config

-- | this allows to override .stack-work directory
[configWorkDir] :: Config -> !Path Rel Dir

-- | Path to user configuration file (usually ~<i>.stack</i>config.yaml)
[configUserConfigPath] :: Config -> !Path Abs File

-- | Build configuration
[configBuild] :: Config -> !BuildOpts

-- | Docker configuration
[configDocker] :: Config -> !DockerOpts

-- | Execution environment (e.g nix-shell) configuration
[configNix] :: Config -> !NixOpts

-- | Environment variables to be passed to external tools
[configProcessContextSettings] :: Config -> !EnvSettings -> IO ProcessContext

-- | Non-platform-specific path containing local installations
[configLocalProgramsBase] :: Config -> !Path Abs Dir

-- | Path containing local installations (mainly GHC)
[configLocalPrograms] :: Config -> !Path Abs Dir

-- | Hide the Template Haskell "Loading package ..." messages from the
--   console
[configHideTHLoading] :: Config -> !Bool

-- | The platform we're building for, used in many directory names
[configPlatform] :: Config -> !Platform

-- | Variant of the platform, also used in directory names
[configPlatformVariant] :: Config -> !PlatformVariant

-- | The variant of GHC requested by the user. In most cases, use
--   <a>BuildConfig</a> or <tt>MiniConfig</tt>s version instead, which will
--   have an auto-detected default.
[configGHCVariant0] :: Config -> !Maybe GHCVariant

-- | Override build of the compiler distribution (e.g. standard, gmp4,
--   tinfo6)
[configGHCBuild] :: Config -> !Maybe CompilerBuild

-- | URLs for other files used by stack. TODO: Better document e.g. The
--   latest snapshot file. A build plan name (e.g. lts5.9.yaml) is appended
--   when downloading the build plan actually.
[configUrls] :: Config -> !Urls

-- | Should we use the system-installed GHC (on the PATH) if available? Can
--   be overridden by command line options.
[configSystemGHC] :: Config -> !Bool

-- | Should we automatically install GHC if missing or the wrong version is
--   available? Can be overridden by command line options.
[configInstallGHC] :: Config -> !Bool

-- | Don't bother checking the GHC version or architecture.
[configSkipGHCCheck] :: Config -> !Bool

-- | On Windows: don't use a sandboxed MSYS
[configSkipMsys] :: Config -> !Bool

-- | Specifies which versions of the compiler are acceptable.
[configCompilerCheck] :: Config -> !VersionCheck

-- | Directory we should install executables into
[configLocalBin] :: Config -> !Path Abs Dir

-- | Require a version of stack within this range.
[configRequireStackVersion] :: Config -> !VersionRange

-- | How many concurrent jobs to run, defaults to number of capabilities
[configJobs] :: Config -> !Int

-- | Optional gcc override path
[configOverrideGccPath] :: Config -> !Maybe (Path Abs File)

-- | Use Hpack executable (overrides bundled Hpack)
[configOverrideHpack] :: Config -> !HpackExecutable

-- | <ul>
--   <li>-extra-include-dirs arguments</li>
--   </ul>
[configExtraIncludeDirs] :: Config -> !Set FilePath

-- | <ul>
--   <li>-extra-lib-dirs arguments</li>
--   </ul>
[configExtraLibDirs] :: Config -> !Set FilePath

-- | Run test suites concurrently
[configConcurrentTests] :: Config -> !Bool
[configImage] :: Config -> !ImageOpts

-- | Parameters for templates.
[configTemplateParams] :: Config -> !Map Text Text

-- | Initialize SCM (e.g. git) when creating new projects.
[configScmInit] :: Config -> !Maybe SCM

-- | Additional GHC options to apply to specific packages.
[configGhcOptionsByName] :: Config -> !Map PackageName [Text]

-- | Additional GHC options to apply to categories of packages
[configGhcOptionsByCat] :: Config -> !Map ApplyGhcOptions [Text]

-- | Additional SetupInfo (inline or remote) to use to find tools.
[configSetupInfoLocations] :: Config -> ![SetupInfoLocation]

-- | How PVP upper bounds should be added to packages
[configPvpBounds] :: Config -> !PvpBounds

-- | Force the code page to UTF-8 on Windows
[configModifyCodePage] :: Config -> !Bool

-- | See <a>explicitSetupDeps</a>. <a>Nothing</a> provides the default
--   value.
[configExplicitSetupDeps] :: Config -> !Map (Maybe PackageName) Bool

-- | Rebuild on GHC options changes
[configRebuildGhcOptions] :: Config -> !Bool

-- | Which packages to ghc-options on the command line apply to?
[configApplyGhcOptions] :: Config -> !ApplyGhcOptions

-- | Ignore version ranges in .cabal files. Funny naming chosen to match
--   cabal.
[configAllowNewer] :: Config -> !Bool

-- | The default template to use when none is specified. (If Nothing, the
--   default default is used.)
[configDefaultTemplate] :: Config -> !Maybe TemplateName

-- | Allow users other than the stack root owner to use the stack
--   installation.
[configAllowDifferentUser] :: Config -> !Bool

-- | Dump logs of local non-dependencies when doing a build.
[configDumpLogs] :: Config -> !DumpLogs

-- | <a>Just</a> when a local project can be found, <a>Nothing</a> when
--   stack must fall back on the implicit global project.
[configMaybeProject] :: Config -> !Maybe (Project, Path Abs File)

-- | Are we allowed to build local packages? The script command disallows
--   this.
[configAllowLocals] :: Config -> !Bool

-- | Should we save Hackage credentials to a file?
[configSaveHackageCreds] :: Config -> !Bool

-- | Hackage base URL used when uploading packages
[configHackageBaseUrl] :: Config -> !Text
[configRunner] :: Config -> !Runner
[configCabalLoader] :: Config -> !CabalLoader

-- | Class for environment values that can provide a <a>Config</a>.
class (HasPlatform env, HasProcessContext env, HasCabalLoader env) => HasConfig env
configL :: HasConfig env => Lens' env Config
configL :: (HasConfig env, HasBuildConfig env) => Lens' env Config

-- | Get the URL to request the information on the latest snapshots
askLatestSnapshotUrl :: (MonadReader env m, HasConfig env) => m Text

-- | Provide an explicit list of package dependencies when running a custom
--   Setup.hs
explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool

-- | A superset of <a>Config</a> adding information on how to build code.
--   The reason for this breakdown is because we will need some of the
--   information from <a>Config</a> in order to determine the values here.
--   
--   These are the components which know nothing about local configuration.
data BuildConfig
BuildConfig :: !Config -> !SnapshotDef -> !GHCVariant -> ![PackageLocation Subdirs] -> ![PackageLocationIndex Subdirs] -> ![Path Abs Dir] -> !Path Abs File -> !Map PackageName (Map FlagName Bool) -> !Bool -> BuildConfig
[bcConfig] :: BuildConfig -> !Config

-- | Build plan wanted for this build
[bcSnapshotDef] :: BuildConfig -> !SnapshotDef

-- | The variant of GHC used to select a GHC bindist.
[bcGHCVariant] :: BuildConfig -> !GHCVariant

-- | Local packages
[bcPackages] :: BuildConfig -> ![PackageLocation Subdirs]

-- | Extra dependencies specified in configuration.
--   
--   These dependencies will not be installed to a shared location, and
--   will override packages provided by the resolver.
[bcDependencies] :: BuildConfig -> ![PackageLocationIndex Subdirs]

-- | Extra package databases
[bcExtraPackageDBs] :: BuildConfig -> ![Path Abs Dir]

-- | Location of the stack.yaml file.
--   
--   Note: if the STACK_YAML environment variable is used, this may be
--   different from projectRootL <a>/</a> "stack.yaml"
--   
--   FIXME MSS 2016-12-08: is the above comment still true? projectRootL is
--   defined in terms of bcStackYaml
[bcStackYaml] :: BuildConfig -> !Path Abs File

-- | Per-package flag overrides
[bcFlags] :: BuildConfig -> !Map PackageName (Map FlagName Bool)

-- | Are we loading from the implicit global stack.yaml? This is useful for
--   providing better error messages.
[bcImplicitGlobal] :: BuildConfig -> !Bool
data LocalPackages
LocalPackages :: !Map PackageName LocalPackageView -> !Map PackageName (GenericPackageDescription, PackageLocationIndex FilePath) -> LocalPackages
[lpProject] :: LocalPackages -> !Map PackageName LocalPackageView
[lpDependencies] :: LocalPackages -> !Map PackageName (GenericPackageDescription, PackageLocationIndex FilePath)

-- | A view of a local package needed for resolving components
data LocalPackageView
LocalPackageView :: !Path Abs File -> !GenericPackageDescription -> !PackageLocation FilePath -> LocalPackageView
[lpvCabalFP] :: LocalPackageView -> !Path Abs File
[lpvGPD] :: LocalPackageView -> !GenericPackageDescription
[lpvLoc] :: LocalPackageView -> !PackageLocation FilePath

-- | Root directory for the given <a>LocalPackageView</a>
lpvRoot :: LocalPackageView -> Path Abs Dir

-- | Package name for the given 'LocalPackageView
lpvName :: LocalPackageView -> PackageName

-- | Version for the given 'LocalPackageView
lpvVersion :: LocalPackageView -> Version

-- | All components available in the given <a>LocalPackageView</a>
lpvComponents :: LocalPackageView -> Set NamedComponent
stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File)

-- | Directory containing the project's stack.yaml file
projectRootL :: HasBuildConfig env => Getting r env (Path Abs Dir)
class HasConfig env => HasBuildConfig env
buildConfigL :: HasBuildConfig env => Lens' env BuildConfig
buildConfigL :: (HasBuildConfig env, HasEnvConfig env) => Lens' env BuildConfig

-- | Specialized bariant of GHC (e.g. libgmp4 or integer-simple)
data GHCVariant

-- | Standard bindist
GHCStandard :: GHCVariant

-- | Bindist that uses integer-simple
GHCIntegerSimple :: GHCVariant

-- | Other bindists
GHCCustom :: String -> GHCVariant

-- | Render a GHC variant to a String.
ghcVariantName :: GHCVariant -> String

-- | Render a GHC variant to a String suffix.
ghcVariantSuffix :: GHCVariant -> String

-- | Parse GHC variant from a String.
parseGHCVariant :: MonadThrow m => String -> m GHCVariant

-- | Class for environment values which have a GHCVariant
class HasGHCVariant env
ghcVariantL :: HasGHCVariant env => Lens' env GHCVariant
ghcVariantL :: (HasGHCVariant env, HasBuildConfig env) => Lens' env GHCVariant

-- | Directory containing snapshots
snapshotsDir :: (MonadReader env m, HasEnvConfig env, MonadThrow m) => m (Path Abs Dir)

-- | Configuration after the environment has been setup.
data EnvConfig
EnvConfig :: !BuildConfig -> !Version -> !CompilerVersion  'CVActual -> !CompilerBuild -> !IORef (Maybe LocalPackages) -> !LoadedSnapshot -> EnvConfig
[envConfigBuildConfig] :: EnvConfig -> !BuildConfig

-- | This is the version of Cabal that stack will use to compile Setup.hs
--   files in the build process.
--   
--   Note that this is not necessarily the same version as the one that
--   stack depends on as a library and which is displayed when running
--   <tt>stack list-dependencies | grep Cabal</tt> in the stack project.
[envConfigCabalVersion] :: EnvConfig -> !Version

-- | The actual version of the compiler to be used, as opposed to
--   <tt>wantedCompilerL</tt>, which provides the version specified by the
--   build plan.
[envConfigCompilerVersion] :: EnvConfig -> !CompilerVersion  'CVActual
[envConfigCompilerBuild] :: EnvConfig -> !CompilerBuild

-- | Cache for <tt>getLocalPackages</tt>.
[envConfigPackagesRef] :: EnvConfig -> !IORef (Maybe LocalPackages)

-- | The fully resolved snapshot information.
[envConfigLoadedSnapshot] :: EnvConfig -> !LoadedSnapshot
class (HasBuildConfig env, HasGHCVariant env) => HasEnvConfig env
envConfigL :: HasEnvConfig env => Lens' env EnvConfig

-- | Get the path for the given compiler ignoring any local binaries.
--   
--   <a>https://github.com/commercialhaskell/stack/issues/1052</a>
getCompilerPath :: (MonadIO m, MonadThrow m, MonadReader env m, HasConfig env) => WhichCompiler -> m (Path Abs File)

-- | Which packages do ghc-options on the command line apply to?
data ApplyGhcOptions

-- | all local targets
AGOTargets :: ApplyGhcOptions

-- | all local packages, even non-targets
AGOLocals :: ApplyGhcOptions

-- | every package
AGOEverything :: ApplyGhcOptions
data HpackExecutable
HpackBundled :: HpackExecutable
HpackCommand :: String -> HpackExecutable
data ConfigException
ParseConfigFileException :: Path Abs File -> ParseException -> ConfigException
ParseCustomSnapshotException :: Text -> ParseException -> ConfigException
NoProjectConfigFound :: Path Abs Dir -> Maybe Text -> ConfigException
UnexpectedArchiveContents :: [Path Abs Dir] -> [Path Abs File] -> ConfigException
UnableToExtractArchive :: Text -> Path Abs File -> ConfigException
BadStackVersionException :: VersionRange -> ConfigException
NoMatchingSnapshot :: WhichSolverCmd -> NonEmpty SnapName -> ConfigException
ResolverMismatch :: WhichSolverCmd -> !Text -> String -> ConfigException
ResolverPartial :: WhichSolverCmd -> !Text -> String -> ConfigException
NoSuchDirectory :: FilePath -> ConfigException
ParseGHCVariantException :: String -> ConfigException
BadStackRoot :: Path Abs Dir -> ConfigException

-- | <tt>$STACK_ROOT</tt>, parent dir
Won'tCreateStackRootInDirectoryOwnedByDifferentUser :: Path Abs Dir -> Path Abs Dir -> ConfigException
UserDoesn'tOwnDirectory :: Path Abs Dir -> ConfigException
FailedToCloneRepo :: String -> ConfigException
ManualGHCVariantSettingsAreIncompatibleWithSystemGHC :: ConfigException
NixRequiresSystemGhc :: ConfigException
NoResolverWhenUsingNoLocalConfig :: ConfigException
InvalidResolverForNoLocalConfig :: String -> ConfigException
DuplicateLocalPackageNames :: ![(PackageName, [PackageLocationIndex FilePath])] -> ConfigException
data WhichSolverCmd
IsInitCmd :: WhichSolverCmd
IsSolverCmd :: WhichSolverCmd
IsNewCmd :: WhichSolverCmd
data ConfigMonoid
ConfigMonoid :: !First (Path Abs Dir) -> !First (Path Rel Dir) -> !BuildOptsMonoid -> !DockerOptsMonoid -> !NixOptsMonoid -> !First Int -> !First Bool -> !First Text -> !UrlsMonoid -> !First [PackageIndex] -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First VersionCheck -> !IntersectingVersionRange -> !First String -> !First GHCVariant -> !First CompilerBuild -> !First Int -> !Set FilePath -> !Set FilePath -> !First (Path Abs File) -> !First FilePath -> !First Bool -> !First FilePath -> !ImageOptsMonoid -> !Map Text Text -> !First SCM -> !MonoidMap PackageName (Dual [Text]) -> !MonoidMap ApplyGhcOptions (Dual [Text]) -> ![Path Abs Dir] -> ![SetupInfoLocation] -> !First (Path Abs Dir) -> !First PvpBounds -> !First Bool -> !Map (Maybe PackageName) Bool -> !First Bool -> !First ApplyGhcOptions -> !First Bool -> !First TemplateName -> !First Bool -> !First DumpLogs -> !First Bool -> !First Text -> !First Bool -> ConfigMonoid

-- | See: <a>clStackRoot</a>
[configMonoidStackRoot] :: ConfigMonoid -> !First (Path Abs Dir)

-- | See: <a>configWorkDir</a>.
[configMonoidWorkDir] :: ConfigMonoid -> !First (Path Rel Dir)

-- | build options.
[configMonoidBuildOpts] :: ConfigMonoid -> !BuildOptsMonoid

-- | Docker options.
[configMonoidDockerOpts] :: ConfigMonoid -> !DockerOptsMonoid

-- | Options for the execution environment (nix-shell or container)
[configMonoidNixOpts] :: ConfigMonoid -> !NixOptsMonoid

-- | See: <tt>configConnectionCount</tt>
[configMonoidConnectionCount] :: ConfigMonoid -> !First Int

-- | See: <a>configHideTHLoading</a>
[configMonoidHideTHLoading] :: ConfigMonoid -> !First Bool

-- | Deprecated in favour of <a>urlsMonoidLatestSnapshot</a>
[configMonoidLatestSnapshotUrl] :: ConfigMonoid -> !First Text

-- | See: 'configUrls
[configMonoidUrls] :: ConfigMonoid -> !UrlsMonoid

-- | See: <tt>picIndices</tt>
[configMonoidPackageIndices] :: ConfigMonoid -> !First [PackageIndex]

-- | See: <a>configSystemGHC</a>
[configMonoidSystemGHC] :: ConfigMonoid -> !First Bool

-- | See: <a>configInstallGHC</a>
[configMonoidInstallGHC] :: ConfigMonoid -> !First Bool

-- | See: <a>configSkipGHCCheck</a>
[configMonoidSkipGHCCheck] :: ConfigMonoid -> !First Bool

-- | See: <a>configSkipMsys</a>
[configMonoidSkipMsys] :: ConfigMonoid -> !First Bool

-- | See: <a>configCompilerCheck</a>
[configMonoidCompilerCheck] :: ConfigMonoid -> !First VersionCheck

-- | See: <a>configRequireStackVersion</a>
[configMonoidRequireStackVersion] :: ConfigMonoid -> !IntersectingVersionRange

-- | Used for overriding the platform
[configMonoidArch] :: ConfigMonoid -> !First String

-- | Used for overriding the platform
[configMonoidGHCVariant] :: ConfigMonoid -> !First GHCVariant

-- | Used for overriding the GHC build
[configMonoidGHCBuild] :: ConfigMonoid -> !First CompilerBuild

-- | See: <a>configJobs</a>
[configMonoidJobs] :: ConfigMonoid -> !First Int

-- | See: <a>configExtraIncludeDirs</a>
[configMonoidExtraIncludeDirs] :: ConfigMonoid -> !Set FilePath

-- | See: <a>configExtraLibDirs</a>
[configMonoidExtraLibDirs] :: ConfigMonoid -> !Set FilePath

-- | Allow users to override the path to gcc
[configMonoidOverrideGccPath] :: ConfigMonoid -> !First (Path Abs File)

-- | Use Hpack executable (overrides bundled Hpack)
[configMonoidOverrideHpack] :: ConfigMonoid -> !First FilePath

-- | See: <a>configConcurrentTests</a>
[configMonoidConcurrentTests] :: ConfigMonoid -> !First Bool

-- | Used to override the binary installation dir
[configMonoidLocalBinPath] :: ConfigMonoid -> !First FilePath

-- | Image creation options.
[configMonoidImageOpts] :: ConfigMonoid -> !ImageOptsMonoid

-- | Template parameters.
[configMonoidTemplateParameters] :: ConfigMonoid -> !Map Text Text

-- | Initialize SCM (e.g. git init) when making new projects?
[configMonoidScmInit] :: ConfigMonoid -> !First SCM

-- | See <a>configGhcOptionsByName</a>. Uses <a>Dual</a> so that options
--   from the configs on the right come first, so that they can be
--   overridden.
[configMonoidGhcOptionsByName] :: ConfigMonoid -> !MonoidMap PackageName (Dual [Text])

-- | See <tt>configGhcOptionsAll</tt>. Uses <a>Dual</a> so that options
--   from the configs on the right come first, so that they can be
--   overridden.
[configMonoidGhcOptionsByCat] :: ConfigMonoid -> !MonoidMap ApplyGhcOptions (Dual [Text])

-- | Additional paths to search for executables in
[configMonoidExtraPath] :: ConfigMonoid -> ![Path Abs Dir]

-- | Additional setup info (inline or remote) to use for installing tools
[configMonoidSetupInfoLocations] :: ConfigMonoid -> ![SetupInfoLocation]

-- | Override the default local programs dir, where e.g. GHC is installed.
[configMonoidLocalProgramsBase] :: ConfigMonoid -> !First (Path Abs Dir)

-- | See <a>configPvpBounds</a>
[configMonoidPvpBounds] :: ConfigMonoid -> !First PvpBounds

-- | See <a>configModifyCodePage</a>
[configMonoidModifyCodePage] :: ConfigMonoid -> !First Bool

-- | See <a>configExplicitSetupDeps</a>
[configMonoidExplicitSetupDeps] :: ConfigMonoid -> !Map (Maybe PackageName) Bool

-- | See <a>configMonoidRebuildGhcOptions</a>
[configMonoidRebuildGhcOptions] :: ConfigMonoid -> !First Bool

-- | See <a>configApplyGhcOptions</a>
[configMonoidApplyGhcOptions] :: ConfigMonoid -> !First ApplyGhcOptions

-- | See <a>configMonoidAllowNewer</a>
[configMonoidAllowNewer] :: ConfigMonoid -> !First Bool

-- | The default template to use when none is specified. (If Nothing, the
--   default default is used.)
[configMonoidDefaultTemplate] :: ConfigMonoid -> !First TemplateName

-- | Allow users other than the stack root owner to use the stack
--   installation.
[configMonoidAllowDifferentUser] :: ConfigMonoid -> !First Bool

-- | See <a>configDumpLogs</a>
[configMonoidDumpLogs] :: ConfigMonoid -> !First DumpLogs

-- | See <a>configSaveHackageCreds</a>
[configMonoidSaveHackageCreds] :: ConfigMonoid -> !First Bool

-- | See <a>configHackageBaseUrl</a>
[configMonoidHackageBaseUrl] :: ConfigMonoid -> !First Text

-- | See <tt>configIgnoreRevisionMismatch</tt>
[configMonoidIgnoreRevisionMismatch] :: ConfigMonoid -> !First Bool
configMonoidInstallGHCName :: Text
configMonoidSystemGHCName :: Text
parseConfigMonoid :: Path Abs Dir -> Value -> Parser (WithJSONWarnings ConfigMonoid)

-- | Which build log files to dump
data DumpLogs

-- | don't dump any logfiles
DumpNoLogs :: DumpLogs

-- | dump logfiles containing warnings
DumpWarningLogs :: DumpLogs

-- | dump all logfiles
DumpAllLogs :: DumpLogs

-- | Controls which version of the environment is used
data EnvSettings
EnvSettings :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> EnvSettings

-- | include local project bin directory, GHC_PACKAGE_PATH, etc
[esIncludeLocals] :: EnvSettings -> !Bool

-- | include the GHC_PACKAGE_PATH variable
[esIncludeGhcPackagePath] :: EnvSettings -> !Bool

-- | set the STACK_EXE variable to the current executable name
[esStackExe] :: EnvSettings -> !Bool

-- | set the locale to C.UTF-8
[esLocaleUtf8] :: EnvSettings -> !Bool

-- | if True, keep GHCRTS variable in environment
[esKeepGhcRts] :: EnvSettings -> !Bool
minimalEnvSettings :: EnvSettings

-- | Default <tt>EnvSettings</tt> which includes locals and
--   GHC_PACKAGE_PATH.
--   
--   Note that this also passes through the GHCRTS environment variable.
--   See <a>https://github.com/commercialhaskell/stack/issues/3444</a>
defaultEnvSettings :: EnvSettings

-- | Environment settings which do not embellish the environment
--   
--   Note that this also passes through the GHCRTS environment variable.
--   See <a>https://github.com/commercialhaskell/stack/issues/3444</a>
plainEnvSettings :: EnvSettings

-- | Parsed global command-line options.
data GlobalOpts
GlobalOpts :: !Maybe String -> !Maybe DockerEntrypoint -> !LogLevel -> !Bool -> !ConfigMonoid -> !Maybe AbstractResolver -> !Maybe (CompilerVersion  'CVWanted) -> !Bool -> !ColorWhen -> !Maybe Int -> !StackYamlLoc FilePath -> GlobalOpts

-- | Expected re-exec in container version
[globalReExecVersion] :: GlobalOpts -> !Maybe String

-- | Data used when stack is acting as a Docker entrypoint (internal use
--   only)
[globalDockerEntrypoint] :: GlobalOpts -> !Maybe DockerEntrypoint

-- | Log level
[globalLogLevel] :: GlobalOpts -> !LogLevel

-- | Whether to include timings in logs.
[globalTimeInLog] :: GlobalOpts -> !Bool

-- | Config monoid, for passing into <tt>loadConfig</tt>
[globalConfigMonoid] :: GlobalOpts -> !ConfigMonoid

-- | Resolver override
[globalResolver] :: GlobalOpts -> !Maybe AbstractResolver

-- | Compiler override
[globalCompiler] :: GlobalOpts -> !Maybe (CompilerVersion  'CVWanted)

-- | We're in a terminal?
[globalTerminal] :: GlobalOpts -> !Bool

-- | When to use ansi terminal colors
[globalColorWhen] :: GlobalOpts -> !ColorWhen

-- | Terminal width override
[globalTermWidth] :: GlobalOpts -> !Maybe Int

-- | Override project stack.yaml
[globalStackYaml] :: GlobalOpts -> !StackYamlLoc FilePath

-- | Parsed global command-line options monoid.
data GlobalOptsMonoid
GlobalOptsMonoid :: !First String -> !First DockerEntrypoint -> !First LogLevel -> !First Bool -> !ConfigMonoid -> !First AbstractResolver -> !First (CompilerVersion  'CVWanted) -> !First Bool -> !First ColorWhen -> !First Int -> !First FilePath -> GlobalOptsMonoid

-- | Expected re-exec in container version
[globalMonoidReExecVersion] :: GlobalOptsMonoid -> !First String

-- | Data used when stack is acting as a Docker entrypoint (internal use
--   only)
[globalMonoidDockerEntrypoint] :: GlobalOptsMonoid -> !First DockerEntrypoint

-- | Log level
[globalMonoidLogLevel] :: GlobalOptsMonoid -> !First LogLevel

-- | Whether to include timings in logs.
[globalMonoidTimeInLog] :: GlobalOptsMonoid -> !First Bool

-- | Config monoid, for passing into <tt>loadConfig</tt>
[globalMonoidConfigMonoid] :: GlobalOptsMonoid -> !ConfigMonoid

-- | Resolver override
[globalMonoidResolver] :: GlobalOptsMonoid -> !First AbstractResolver

-- | Compiler override
[globalMonoidCompiler] :: GlobalOptsMonoid -> !First (CompilerVersion  'CVWanted)

-- | We're in a terminal?
[globalMonoidTerminal] :: GlobalOptsMonoid -> !First Bool

-- | When to use ansi colors
[globalMonoidColorWhen] :: GlobalOptsMonoid -> !First ColorWhen

-- | Terminal width override
[globalMonoidTermWidth] :: GlobalOptsMonoid -> !First Int

-- | Override project stack.yaml
[globalMonoidStackYaml] :: GlobalOptsMonoid -> !First FilePath
data StackYamlLoc filepath
SYLDefault :: StackYamlLoc filepath
SYLOverride :: !filepath -> StackYamlLoc filepath

-- | FilePath is the directory containing the script file, used for
--   resolving custom snapshot files.
SYLNoConfig :: !Path Abs Dir -> StackYamlLoc filepath

-- | Default logging level should be something useful but not crazy.
defaultLogLevel :: LogLevel

-- | Value returned by <a>loadConfig</a>.
data LoadConfig
LoadConfig :: !Config -> !Maybe (CompilerVersion  'CVWanted) -> IO BuildConfig -> !Maybe (Path Abs Dir) -> LoadConfig

-- | Top-level Stack configuration.
[lcConfig] :: LoadConfig -> !Config

-- | Action to load the remaining <a>BuildConfig</a>.
[lcLoadBuildConfig] :: LoadConfig -> !Maybe (CompilerVersion  'CVWanted) -> IO BuildConfig

-- | The project root directory, if in a project.
[lcProjectRoot] :: LoadConfig -> !Maybe (Path Abs Dir)

-- | Information on a single package index
data PackageIndex
PackageIndex :: !IndexName -> !Text -> !IndexType -> !Text -> !Bool -> PackageIndex
[indexName] :: PackageIndex -> !IndexName

-- | URL for the tarball or, in the case of Hackage Security, the root of
--   the directory
[indexLocation] :: PackageIndex -> !Text
[indexType] :: PackageIndex -> !IndexType

-- | URL prefix for downloading packages
[indexDownloadPrefix] :: PackageIndex -> !Text

-- | Require that hashes and package size information be available for
--   packages in this index
[indexRequireHashes] :: PackageIndex -> !Bool

-- | Unique name for a package index
newtype IndexName
IndexName :: ByteString -> IndexName
[unIndexName] :: IndexName -> ByteString
indexNameText :: IndexName -> Text

-- | A project is a collection of packages. We can have multiple stack.yaml
--   files, but only one of them may contain project information.
data Project
Project :: !Maybe String -> ![PackageLocation Subdirs] -> ![PackageLocationIndex Subdirs] -> !Map PackageName (Map FlagName Bool) -> !Resolver -> !Maybe (CompilerVersion  'CVWanted) -> ![FilePath] -> Project

-- | A warning message to display to the user when the auto generated
--   config may have issues.
[projectUserMsg] :: Project -> !Maybe String

-- | Packages which are actually part of the project (as opposed to
--   dependencies).
--   
--   <i>NOTE</i> Stack has always allowed these packages to be any kind of
--   package location, but in reality only <tt>PLFilePath</tt> really makes
--   sense. We could consider replacing <tt>[PackageLocation]</tt> with
--   <tt>[FilePath]</tt> to properly enforce this idea, though it will
--   slightly break backwards compatibility if someone really did want to
--   treat such things as non-deps.
[projectPackages] :: Project -> ![PackageLocation Subdirs]

-- | Dependencies defined within the stack.yaml file, to be applied on top
--   of the snapshot.
[projectDependencies] :: Project -> ![PackageLocationIndex Subdirs]

-- | Flags to be applied on top of the snapshot flags.
[projectFlags] :: Project -> !Map PackageName (Map FlagName Bool)

-- | How we resolve which <tt>SnapshotDef</tt> to use
[projectResolver] :: Project -> !Resolver

-- | When specified, overrides which compiler to use
[projectCompiler] :: Project -> !Maybe (CompilerVersion  'CVWanted)
[projectExtraPackageDBs] :: Project -> ![FilePath]
data ProjectAndConfigMonoid
ProjectAndConfigMonoid :: !Project -> !ConfigMonoid -> ProjectAndConfigMonoid
parseProjectAndConfigMonoid :: Path Abs Dir -> Value -> Parser (WithJSONWarnings ProjectAndConfigMonoid)
data PvpBounds
PvpBounds :: !PvpBoundsType -> !Bool -> PvpBounds
[pbType] :: PvpBounds -> !PvpBoundsType
[pbAsRevision] :: PvpBounds -> !Bool

-- | How PVP bounds should be added to .cabal files
data PvpBoundsType
PvpBoundsNone :: PvpBoundsType
PvpBoundsUpper :: PvpBoundsType
PvpBoundsLower :: PvpBoundsType
PvpBoundsBoth :: PvpBoundsType
parsePvpBounds :: Text -> Either String PvpBounds
readColorWhen :: ReadM ColorWhen

-- | A software control system.
data SCM
Git :: SCM

-- | Suffix applied to an installation root to get the bin dir
bindirSuffix :: Path Rel Dir

-- | File containing the installed cache, see <a>Stack.PackageDump</a>
configInstalledCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File)

-- | Where to store <a>LoadedSnapshot</a> caches
configLoadedSnapshotCache :: (MonadThrow m, MonadReader env m, HasConfig env, HasGHCVariant env) => SnapshotDef -> GlobalInfoSource -> m (Path Abs File)

-- | Where do we get information on global packages for loading up a
--   <a>LoadedSnapshot</a>?
data GlobalInfoSource

-- | Accept the hints in the snapshot definition
GISSnapshotHints :: GlobalInfoSource

-- | Look up the actual information in the installed compiler
GISCompiler :: CompilerVersion  'CVActual -> GlobalInfoSource

-- | Per-project work dir
getProjectWorkDir :: (HasBuildConfig env, MonadReader env m) => m (Path Abs Dir)

-- | Suffix applied to an installation root to get the doc dir
docDirSuffix :: Path Rel Dir

-- | Directory for holding flag cache information
flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Get the extra bin directories (for the PATH). Puts more local first
--   
--   Bool indicates whether or not to include the locals
extraBinDirs :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Bool -> [Path Abs Dir])

-- | Where HPC reports and tix files get stored.
hpcReportDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Installation root for dependencies
installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Installation root for locals
installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Installation root for compiler tools
bindirCompilerTools :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Hoogle directory.
hoogleRoot :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Get the hoogle database path.
hoogleDatabasePath :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs File)

-- | Package database for installing dependencies into
packageDatabaseDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Extra package databases
packageDatabaseExtra :: (MonadReader env m, HasEnvConfig env) => m [Path Abs Dir]

-- | Package database for installing local packages into
packageDatabaseLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir)

-- | Relative directory for the platform identifier
platformOnlyRelDir :: (MonadReader env m, HasPlatform env, MonadThrow m) => m (Path Rel Dir)

-- | Relative directory for the platform and GHC identifier
platformGhcRelDir :: (MonadReader env m, HasEnvConfig env, MonadThrow m) => m (Path Rel Dir)

-- | Relative directory for the platform and GHC identifier without GHC
--   bindist build
platformGhcVerOnlyRelDir :: (MonadReader env m, HasPlatform env, HasGHCVariant env, MonadThrow m) => m (Path Rel Dir)

-- | This is an attempt to shorten stack paths on Windows to decrease our
--   chances of hitting 260 symbol path limit. The idea is to calculate
--   SHA1 hash of the path used on other architectures, encode with base 16
--   and take first 8 symbols of it.
useShaPathOnWindows :: MonadThrow m => Path Rel Dir -> m (Path Rel Dir)
shaPath :: (IsPath Rel t, MonadThrow m) => Path Rel t -> m (Path Rel t)
shaPathForBytes :: (IsPath Rel t, MonadThrow m) => ByteString -> m (Path Rel t)

-- | <pre>
--   ".stack-work"
--   </pre>
workDirL :: HasConfig env => Lens' env (Path Rel Dir)
data EvalOpts
EvalOpts :: !String -> !ExecOptsExtra -> EvalOpts
[evalArg] :: EvalOpts -> !String
[evalExtra] :: EvalOpts -> !ExecOptsExtra
data ExecOpts
ExecOpts :: !SpecialExecCmd -> ![String] -> !ExecOptsExtra -> ExecOpts
[eoCmd] :: ExecOpts -> !SpecialExecCmd
[eoArgs] :: ExecOpts -> ![String]
[eoExtra] :: ExecOpts -> !ExecOptsExtra
data SpecialExecCmd
ExecCmd :: String -> SpecialExecCmd
ExecRun :: SpecialExecCmd
ExecGhc :: SpecialExecCmd
ExecRunGhc :: SpecialExecCmd
data ExecOptsExtra
ExecOptsPlain :: ExecOptsExtra
ExecOptsEmbellished :: !EnvSettings -> ![String] -> ![String] -> !Maybe FilePath -> ExecOptsExtra
[eoEnvSettings] :: ExecOptsExtra -> !EnvSettings
[eoPackages] :: ExecOptsExtra -> ![String]
[eoRtsOptions] :: ExecOptsExtra -> ![String]
[eoCwd] :: ExecOptsExtra -> !Maybe FilePath

-- | Build of the compiler distribution (e.g. standard, gmp4, tinfo6) |
--   Information for a file to download.
data DownloadInfo
DownloadInfo :: Text -> Maybe Int -> Maybe ByteString -> Maybe ByteString -> DownloadInfo

-- | URL or absolute file path
[downloadInfoUrl] :: DownloadInfo -> Text
[downloadInfoContentLength] :: DownloadInfo -> Maybe Int
[downloadInfoSha1] :: DownloadInfo -> Maybe ByteString
[downloadInfoSha256] :: DownloadInfo -> Maybe ByteString
data VersionedDownloadInfo
VersionedDownloadInfo :: Version -> DownloadInfo -> VersionedDownloadInfo
[vdiVersion] :: VersionedDownloadInfo -> Version
[vdiDownloadInfo] :: VersionedDownloadInfo -> DownloadInfo
data GHCDownloadInfo
GHCDownloadInfo :: [Text] -> Map Text Text -> DownloadInfo -> GHCDownloadInfo
[gdiConfigureOpts] :: GHCDownloadInfo -> [Text]
[gdiConfigureEnv] :: GHCDownloadInfo -> Map Text Text
[gdiDownloadInfo] :: GHCDownloadInfo -> DownloadInfo
data SetupInfo
SetupInfo :: Maybe DownloadInfo -> Maybe DownloadInfo -> Map Text VersionedDownloadInfo -> Map Text (Map Version GHCDownloadInfo) -> Map Text (Map (CompilerVersion  'CVActual) DownloadInfo) -> Map Text (Map Version DownloadInfo) -> SetupInfo
[siSevenzExe] :: SetupInfo -> Maybe DownloadInfo
[siSevenzDll] :: SetupInfo -> Maybe DownloadInfo
[siMsys2] :: SetupInfo -> Map Text VersionedDownloadInfo
[siGHCs] :: SetupInfo -> Map Text (Map Version GHCDownloadInfo)
[siGHCJSs] :: SetupInfo -> Map Text (Map (CompilerVersion  'CVActual) DownloadInfo)
[siStack] :: SetupInfo -> Map Text (Map Version DownloadInfo)

-- | Remote or inline <a>SetupInfo</a>
data SetupInfoLocation
SetupInfoFileOrURL :: String -> SetupInfoLocation
SetupInfoInline :: SetupInfo -> SetupInfoLocation

-- | Data passed into Docker container for the Docker entrypoint's use
newtype DockerEntrypoint
DockerEntrypoint :: Maybe DockerUser -> DockerEntrypoint

-- | UID<i>GID</i>etc of host user, if we wish to perform UID/GID switch in
--   container
[deUser] :: DockerEntrypoint -> Maybe DockerUser

-- | Docker host user info
data DockerUser
DockerUser :: UserID -> GroupID -> [GroupID] -> FileMode -> DockerUser

-- | uid
[duUid] :: DockerUser -> UserID

-- | gid
[duGid] :: DockerUser -> GroupID

-- | Supplemantal groups
[duGroups] :: DockerUser -> [GroupID]

-- | File creation mask }
[duUmask] :: DockerUser -> FileMode

-- | The compiler specified by the <tt>SnapshotDef</tt>. This may be
--   different from the actual compiler used!
wantedCompilerVersionL :: HasBuildConfig s => Getting r s (CompilerVersion  'CVWanted)

-- | The version of the compiler which will actually be used. May be
--   different than that specified in the <a>SnapshotDef</a> and returned
--   by <a>wantedCompilerVersionL</a>.
actualCompilerVersionL :: HasEnvConfig s => Lens' s (CompilerVersion  'CVActual)
buildOptsL :: HasConfig s => Lens' s BuildOpts
globalOptsL :: Lens' GlobalOpts ConfigMonoid
buildOptsInstallExesL :: Lens' BuildOpts Bool
buildOptsMonoidHaddockL :: Lens' BuildOptsMonoid (Maybe Bool)
buildOptsMonoidTestsL :: Lens' BuildOptsMonoid (Maybe Bool)
buildOptsMonoidBenchmarksL :: Lens' BuildOptsMonoid (Maybe Bool)
buildOptsMonoidInstallExesL :: Lens' BuildOptsMonoid (Maybe Bool)
buildOptsHaddockL :: Lens' BuildOpts Bool
globalOptsBuildOptsMonoidL :: Lens' GlobalOpts BuildOptsMonoid
stackRootL :: HasCabalLoader s => Lens' s (Path Abs Dir)
configUrlsL :: HasConfig env => Lens' env Urls
cabalVersionL :: HasEnvConfig env => Lens' env Version
whichCompilerL :: Getting r (CompilerVersion a) WhichCompiler
envOverrideSettingsL :: HasConfig env => Lens' env (EnvSettings -> IO ProcessContext)
loadedSnapshotL :: HasEnvConfig env => Lens' env LoadedSnapshot
globalHintsL :: HasBuildConfig s => Getting r s (Map PackageName (Maybe Version))
shouldForceGhcColorFlag :: (HasRunner env, HasEnvConfig env) => RIO env Bool
appropriateGhcColorFlag :: (HasRunner env, HasEnvConfig env) => RIO env (Maybe String)
view :: MonadReader s m => Getting a s a -> m a

-- | <a>to</a> creates a getter from any function:
--   
--   <pre>
--   a <a>^.</a> <a>to</a> f = f a
--   </pre>
--   
--   It's most useful in chains, because it lets you mix lenses and
--   ordinary functions. Suppose you have a record which comes from some
--   third-party library and doesn't have any lens accessors. You want to
--   do something like this:
--   
--   <pre>
--   value ^. _1 . field . at 2
--   </pre>
--   
--   However, <tt>field</tt> isn't a getter, and you have to do this
--   instead:
--   
--   <pre>
--   field (value ^. _1) ^. at 2
--   </pre>
--   
--   but now <tt>value</tt> is in the middle and it's hard to read the
--   resulting code. A variant with <a>to</a> is prettier and more
--   readable:
--   
--   <pre>
--   value ^. _1 . to field . at 2
--   </pre>
to :: () => (s -> a) -> SimpleGetter s a
instance GHC.Classes.Ord Stack.Types.Config.GhcOptionKey
instance GHC.Classes.Eq Stack.Types.Config.GhcOptionKey
instance GHC.Show.Show Stack.Types.Config.GlobalOpts
instance GHC.Generics.Generic Stack.Types.Config.GlobalOptsMonoid
instance GHC.Show.Show Stack.Types.Config.GlobalOptsMonoid
instance GHC.Show.Show Stack.Types.Config.DockerEntrypoint
instance GHC.Read.Read Stack.Types.Config.DockerEntrypoint
instance GHC.Show.Show Stack.Types.Config.DockerUser
instance GHC.Read.Read Stack.Types.Config.DockerUser
instance GHC.Generics.Generic Stack.Types.Config.ConfigMonoid
instance GHC.Show.Show Stack.Types.Config.ConfigMonoid
instance GHC.Classes.Ord Stack.Types.Config.PvpBounds
instance GHC.Classes.Eq Stack.Types.Config.PvpBounds
instance GHC.Read.Read Stack.Types.Config.PvpBounds
instance GHC.Show.Show Stack.Types.Config.PvpBounds
instance GHC.Enum.Bounded Stack.Types.Config.PvpBoundsType
instance GHC.Enum.Enum Stack.Types.Config.PvpBoundsType
instance GHC.Classes.Ord Stack.Types.Config.PvpBoundsType
instance GHC.Classes.Eq Stack.Types.Config.PvpBoundsType
instance GHC.Read.Read Stack.Types.Config.PvpBoundsType
instance GHC.Show.Show Stack.Types.Config.PvpBoundsType
instance GHC.Show.Show Stack.Types.Config.SetupInfoLocation
instance GHC.Show.Show Stack.Types.Config.SetupInfo
instance GHC.Show.Show Stack.Types.Config.GHCDownloadInfo
instance GHC.Show.Show Stack.Types.Config.VersionedDownloadInfo
instance GHC.Show.Show Stack.Types.Config.DownloadInfo
instance GHC.Show.Show Stack.Types.Config.GHCVariant
instance GHC.Show.Show Stack.Types.Config.SCM
instance GHC.Show.Show Stack.Types.Config.Project
instance GHC.Show.Show Stack.Types.Config.PackageEntry
instance Data.Traversable.Traversable Stack.Types.Config.StackYamlLoc
instance Data.Foldable.Foldable Stack.Types.Config.StackYamlLoc
instance GHC.Base.Functor Stack.Types.Config.StackYamlLoc
instance GHC.Show.Show filepath => GHC.Show.Show (Stack.Types.Config.StackYamlLoc filepath)
instance GHC.Show.Show Stack.Types.Config.EvalOpts
instance GHC.Show.Show Stack.Types.Config.ExecOpts
instance GHC.Show.Show Stack.Types.Config.ExecOptsExtra
instance GHC.Classes.Eq Stack.Types.Config.SpecialExecCmd
instance GHC.Show.Show Stack.Types.Config.SpecialExecCmd
instance GHC.Classes.Ord Stack.Types.Config.EnvSettings
instance GHC.Classes.Eq Stack.Types.Config.EnvSettings
instance GHC.Show.Show Stack.Types.Config.EnvSettings
instance GHC.Enum.Bounded Stack.Types.Config.DumpLogs
instance GHC.Enum.Enum Stack.Types.Config.DumpLogs
instance GHC.Classes.Ord Stack.Types.Config.DumpLogs
instance GHC.Classes.Eq Stack.Types.Config.DumpLogs
instance GHC.Read.Read Stack.Types.Config.DumpLogs
instance GHC.Show.Show Stack.Types.Config.DumpLogs
instance GHC.Enum.Bounded Stack.Types.Config.ApplyGhcOptions
instance GHC.Enum.Enum Stack.Types.Config.ApplyGhcOptions
instance GHC.Classes.Ord Stack.Types.Config.ApplyGhcOptions
instance GHC.Classes.Eq Stack.Types.Config.ApplyGhcOptions
instance GHC.Read.Read Stack.Types.Config.ApplyGhcOptions
instance GHC.Show.Show Stack.Types.Config.ApplyGhcOptions
instance GHC.Classes.Ord Stack.Types.Config.HpackExecutable
instance GHC.Classes.Eq Stack.Types.Config.HpackExecutable
instance GHC.Read.Read Stack.Types.Config.HpackExecutable
instance GHC.Show.Show Stack.Types.Config.HpackExecutable
instance Stack.Types.Config.HasPlatform (Distribution.System.Platform, Stack.Types.Config.PlatformVariant)
instance Stack.Types.Config.HasPlatform Stack.Types.Config.Config
instance Stack.Types.Config.HasPlatform Stack.Types.Config.LoadConfig
instance Stack.Types.Config.HasPlatform Stack.Types.Config.BuildConfig
instance Stack.Types.Config.HasPlatform Stack.Types.Config.EnvConfig
instance Stack.Types.Config.HasGHCVariant Stack.Types.Config.GHCVariant
instance Stack.Types.Config.HasGHCVariant Stack.Types.Config.BuildConfig
instance Stack.Types.Config.HasGHCVariant Stack.Types.Config.EnvConfig
instance RIO.Process.HasProcessContext Stack.Types.Config.LoadConfig
instance RIO.Process.HasProcessContext Stack.Types.Config.BuildConfig
instance RIO.Process.HasProcessContext Stack.Types.Config.EnvConfig
instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.LoadConfig
instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.BuildConfig
instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.EnvConfig
instance Stack.Types.Config.HasConfig Stack.Types.Config.Config
instance Stack.Types.Config.HasConfig Stack.Types.Config.LoadConfig
instance Stack.Types.Config.HasConfig Stack.Types.Config.BuildConfig
instance Stack.Types.Config.HasConfig Stack.Types.Config.EnvConfig
instance Stack.Types.Config.HasBuildConfig Stack.Types.Config.BuildConfig
instance Stack.Types.Config.HasBuildConfig Stack.Types.Config.EnvConfig
instance Stack.Types.Config.HasEnvConfig Stack.Types.Config.EnvConfig
instance Stack.Types.Runner.HasRunner Stack.Types.Config.LoadConfig
instance Stack.Types.Runner.HasRunner Stack.Types.Config.BuildConfig
instance Stack.Types.Runner.HasRunner Stack.Types.Config.EnvConfig
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.GhcOptions
instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.Config.GhcOptionKey
instance GHC.Base.Semigroup Stack.Types.Config.GlobalOptsMonoid
instance GHC.Base.Monoid Stack.Types.Config.GlobalOptsMonoid
instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.EnvConfig
instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.LoadConfig
instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.BuildConfig
instance RIO.Process.HasProcessContext Stack.Types.Config.Config
instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.Config
instance Stack.Types.Runner.HasRunner Stack.Types.Config.Config
instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.Config
instance GHC.Base.Semigroup Stack.Types.Config.ConfigMonoid
instance GHC.Base.Monoid Stack.Types.Config.ConfigMonoid
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Config.PvpBounds
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.PvpBounds
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.SetupInfoLocation)
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.SetupInfo)
instance GHC.Base.Semigroup Stack.Types.Config.SetupInfo
instance GHC.Base.Monoid Stack.Types.Config.SetupInfo
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.GHCDownloadInfo)
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.VersionedDownloadInfo)
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.DownloadInfo)
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.GHCVariant
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.SCM
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Config.SCM
instance Stack.Types.Config.IsPath Path.Abs Path.Dir
instance Stack.Types.Config.IsPath Path.Rel Path.Dir
instance Stack.Types.Config.IsPath Path.Abs Path.File
instance Stack.Types.Config.IsPath Path.Rel Path.File
instance GHC.Show.Show Stack.Types.Config.ConfigException
instance GHC.Exception.Type.Exception Stack.Types.Config.ConfigException
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Config.Project
instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.PackageEntry)
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.DumpLogs
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.ApplyGhcOptions


-- | Provide ability to upload tarballs to Hackage.
module Stack.Upload

-- | Upload a single tarball with the given <tt>Uploader</tt>.
--   
--   Since 0.1.0.0
upload :: String -> HackageCreds -> FilePath -> IO ()

-- | Upload a single tarball with the given <tt>Uploader</tt>. Instead of
--   sending a file like <a>upload</a>, this sends a lazy bytestring.
--   
--   Since 0.1.2.1
uploadBytes :: String -> HackageCreds -> String -> ByteString -> IO ()
uploadRevision :: String -> HackageCreds -> PackageIdentifier -> ByteString -> IO ()

-- | Username and password to log into Hackage.
--   
--   Since 0.1.0.0
data HackageCreds

-- | Load Hackage credentials, either from a save file or the command line.
--   
--   Since 0.1.0.0
loadCreds :: Config -> IO HackageCreds
instance GHC.Show.Show Stack.Upload.HackageCreds
instance Data.Aeson.Types.ToJSON.ToJSON Stack.Upload.HackageCreds
instance Data.Aeson.Types.FromJSON.FromJSON (GHC.IO.FilePath -> Stack.Upload.HackageCreds)

module Stack.Types.Package

-- | All exceptions thrown by the library.
data PackageException
PackageInvalidCabalFile :: !Either PackageIdentifierRevision (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PackageException
PackageNoCabalFileFound :: Path Abs Dir -> PackageException
PackageMultipleCabalFilesFound :: Path Abs Dir -> [Path Abs File] -> PackageException
MismatchedCabalName :: Path Abs File -> PackageName -> PackageException
MismatchedCabalIdentifier :: !PackageIdentifierRevision -> !PackageIdentifier -> PackageException

-- | Libraries in a package. Since Cabal 2.0, internal libraries are a
--   thing.
data PackageLibraries
NoLibraries :: PackageLibraries

-- | the foreign library names, sub libraries get built automatically
--   without explicit component name passing
HasLibraries :: !Set Text -> PackageLibraries

-- | Some package info.
data Package
Package :: !PackageName -> !Version -> !Either License License -> !GetPackageFiles -> !Map PackageName DepValue -> !Set ExeName -> !Set PackageName -> ![Text] -> !Map FlagName Bool -> !Map FlagName Bool -> !PackageLibraries -> !Set Text -> !Map Text TestSuiteInterface -> !Set Text -> !Set Text -> !GetPackageOpts -> !Bool -> !BuildType -> !Maybe (Map PackageName VersionRange) -> Package

-- | Name of the package.
[packageName] :: Package -> !PackageName

-- | Version of the package
[packageVersion] :: Package -> !Version

-- | The license the package was released under.
[packageLicense] :: Package -> !Either License License

-- | Get all files of the package.
[packageFiles] :: Package -> !GetPackageFiles

-- | Packages that the package depends on, both as libraries and build
--   tools.
[packageDeps] :: Package -> !Map PackageName DepValue

-- | Build tools specified in the legacy manner (build-tools:) that failed
--   the hard-coded lookup.
[packageUnknownTools] :: Package -> !Set ExeName

-- | Original dependencies (not sieved).
[packageAllDeps] :: Package -> !Set PackageName

-- | Ghc options used on package.
[packageGhcOptions] :: Package -> ![Text]

-- | Flags used on package.
[packageFlags] :: Package -> !Map FlagName Bool

-- | Defaults for unspecified flags.
[packageDefaultFlags] :: Package -> !Map FlagName Bool

-- | does the package have a buildable library stanza?
[packageLibraries] :: Package -> !PackageLibraries

-- | names of internal libraries
[packageInternalLibraries] :: Package -> !Set Text

-- | names and interfaces of test suites
[packageTests] :: Package -> !Map Text TestSuiteInterface

-- | names of benchmarks
[packageBenchmarks] :: Package -> !Set Text

-- | names of executables
[packageExes] :: Package -> !Set Text

-- | Args to pass to GHC.
[packageOpts] :: Package -> !GetPackageOpts

-- | Does the package have exposed modules?
[packageHasExposedModules] :: Package -> !Bool

-- | Package build-type.
[packageBuildType] :: Package -> !BuildType

-- | If present: custom-setup dependencies
[packageSetupDeps] :: Package -> !Maybe (Map PackageName VersionRange)

-- | The value for a map from dependency name. This contains both the
--   version range and the type of dependency, and provides a semigroup
--   instance.
data DepValue
DepValue :: !VersionRange -> !DepType -> DepValue
[dvVersionRange] :: DepValue -> !VersionRange
[dvType] :: DepValue -> !DepType

-- | Is this package being used as a library, or just as a build tool? If
--   the former, we need to ensure that a library actually exists. See
--   <a>https://github.com/commercialhaskell/stack/issues/2195</a>
data DepType
AsLibrary :: DepType
AsBuildTool :: DepType
packageIdentifier :: Package -> PackageIdentifier
packageDefinedFlags :: Package -> Set FlagName

-- | Files that the package depends on, relative to package directory.
--   Argument is the location of the .cabal file
newtype GetPackageOpts
GetPackageOpts :: (forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts)) -> GetPackageOpts
[getPackageOpts] :: GetPackageOpts -> forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts)

-- | GHC options based on cabal information and ghc-options.
data BuildInfoOpts
BuildInfoOpts :: [String] -> [String] -> [String] -> Path Abs File -> BuildInfoOpts
[bioOpts] :: BuildInfoOpts -> [String]
[bioOneWordOpts] :: BuildInfoOpts -> [String]

-- | These options can safely have <a>nubOrd</a> applied to them, as there
--   are no multi-word options (see
--   <a>https://github.com/commercialhaskell/stack/issues/1255)</a>
[bioPackageFlags] :: BuildInfoOpts -> [String]
[bioCabalMacros] :: BuildInfoOpts -> Path Abs File

-- | Files to get for a cabal package.
data CabalFileType
AllFiles :: CabalFileType
Modules :: CabalFileType

-- | Files that the package depends on, relative to package directory.
--   Argument is the location of the .cabal file
newtype GetPackageFiles
GetPackageFiles :: (forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning])) -> GetPackageFiles
[getPackageFiles] :: GetPackageFiles -> forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning])

-- | Warning generated when reading a package
data PackageWarning

-- | Modules found that are not listed in cabal file
UnlistedModulesWarning :: NamedComponent -> [ModuleName] -> PackageWarning

-- | Package build configuration
data PackageConfig
PackageConfig :: !Bool -> !Bool -> !Map FlagName Bool -> ![Text] -> !CompilerVersion  'CVActual -> !Platform -> PackageConfig

-- | Are tests enabled?
[packageConfigEnableTests] :: PackageConfig -> !Bool

-- | Are benchmarks enabled?
[packageConfigEnableBenchmarks] :: PackageConfig -> !Bool

-- | Configured flags.
[packageConfigFlags] :: PackageConfig -> !Map FlagName Bool

-- | Configured ghc options.
[packageConfigGhcOptions] :: PackageConfig -> ![Text]

-- | GHC version
[packageConfigCompilerVersion] :: PackageConfig -> !CompilerVersion  'CVActual

-- | host platform
[packageConfigPlatform] :: PackageConfig -> !Platform
type SourceMap = Map PackageName PackageSource

-- | Where the package's source is located: local directory or package
--   index
data PackageSource

-- | Package which exist on the filesystem (as opposed to an index tarball)
PSFiles :: LocalPackage -> InstallLocation -> PackageSource

-- | Package which is in an index, and the files do not exist on the
--   filesystem yet.
PSIndex :: InstallLocation -> Map FlagName Bool -> [Text] -> PackageIdentifierRevision -> PackageSource
piiVersion :: PackageSource -> Version
piiLocation :: PackageSource -> InstallLocation
piiPackageLocation :: PackageSource -> PackageLocationIndex FilePath

-- | Information on a locally available package of source code
data LocalPackage
LocalPackage :: !Package -> !Set NamedComponent -> !Set NamedComponent -> !Bool -> !Map PackageName VersionRange -> !Map PackageName VersionRange -> !Maybe Package -> !Path Abs Dir -> !Path Abs File -> !Bool -> !Maybe (Set FilePath) -> !Map NamedComponent (Map FilePath FileCacheInfo) -> !Map NamedComponent (Set (Path Abs File)) -> !PackageLocation FilePath -> LocalPackage

-- | The <tt>Package</tt> info itself, after resolution with package flags,
--   with tests and benchmarks disabled
[lpPackage] :: LocalPackage -> !Package

-- | Components to build, not including the library component.
[lpComponents] :: LocalPackage -> !Set NamedComponent

-- | Components explicitly requested for build, that are marked "buildable:
--   false".
[lpUnbuildable] :: LocalPackage -> !Set NamedComponent

-- | Whether this package is wanted as a target.
[lpWanted] :: LocalPackage -> !Bool

-- | Used for determining if we can use --enable-tests in a normal build.
[lpTestDeps] :: LocalPackage -> !Map PackageName VersionRange

-- | Used for determining if we can use --enable-benchmarks in a normal
--   build.
[lpBenchDeps] :: LocalPackage -> !Map PackageName VersionRange

-- | This stores the <a>Package</a> with tests and benchmarks enabled, if
--   either is asked for by the user.
[lpTestBench] :: LocalPackage -> !Maybe Package

-- | Directory of the package.
[lpDir] :: LocalPackage -> !Path Abs Dir

-- | The .cabal file
[lpCabalFile] :: LocalPackage -> !Path Abs File
[lpForceDirty] :: LocalPackage -> !Bool

-- | Nothing == not dirty, Just == dirty. Note that the Set may be empty if
--   we forced the build to treat packages as dirty. Also, the Set may not
--   include all modified files.
[lpDirtyFiles] :: LocalPackage -> !Maybe (Set FilePath)

-- | current state of the files
[lpNewBuildCaches] :: LocalPackage -> !Map NamedComponent (Map FilePath FileCacheInfo)

-- | all files used by this package
[lpComponentFiles] :: LocalPackage -> !Map NamedComponent (Set (Path Abs File))

-- | Where this source code came from
[lpLocation] :: LocalPackage -> !PackageLocation FilePath
lpFiles :: LocalPackage -> Set (Path Abs File)

-- | A location to install a package into, either snapshot or local
data InstallLocation
Snap :: InstallLocation
Local :: InstallLocation
data InstalledPackageLocation
InstalledTo :: InstallLocation -> InstalledPackageLocation
ExtraGlobal :: InstalledPackageLocation
data FileCacheInfo
FileCacheInfo :: !ModTime -> !Word64 -> !ByteString -> FileCacheInfo
[fciModTime] :: FileCacheInfo -> !ModTime
[fciSize] :: FileCacheInfo -> !Word64
[fciHash] :: FileCacheInfo -> !ByteString

-- | Used for storage and comparison.
newtype ModTime
ModTime :: (Integer, Rational) -> ModTime
modTimeVC :: VersionConfig ModTime
testSuccessVC :: VersionConfig Bool

-- | A descriptor from a .cabal file indicating one of the following:
--   
--   exposed-modules: Foo other-modules: Foo or main-is: Foo.hs
data DotCabalDescriptor
DotCabalModule :: !ModuleName -> DotCabalDescriptor
DotCabalMain :: !FilePath -> DotCabalDescriptor
DotCabalFile :: !FilePath -> DotCabalDescriptor
DotCabalCFile :: !FilePath -> DotCabalDescriptor

-- | Maybe get the module name from the .cabal descriptor.
dotCabalModule :: DotCabalDescriptor -> Maybe ModuleName

-- | Maybe get the main name from the .cabal descriptor.
dotCabalMain :: DotCabalDescriptor -> Maybe FilePath

-- | A path resolved from the .cabal file, which is either main-is or an
--   exposed<i>internal</i>referenced module.
data DotCabalPath
DotCabalModulePath :: !Path Abs File -> DotCabalPath
DotCabalMainPath :: !Path Abs File -> DotCabalPath
DotCabalFilePath :: !Path Abs File -> DotCabalPath
DotCabalCFilePath :: !Path Abs File -> DotCabalPath

-- | Get the module path.
dotCabalModulePath :: DotCabalPath -> Maybe (Path Abs File)

-- | Get the main path.
dotCabalMainPath :: DotCabalPath -> Maybe (Path Abs File)

-- | Get the c file path.
dotCabalCFilePath :: DotCabalPath -> Maybe (Path Abs File)

-- | Get the path.
dotCabalGetPath :: DotCabalPath -> Path Abs File
type InstalledMap = Map PackageName (InstallLocation, Installed)
data Installed
Library :: PackageIdentifier -> GhcPkgId -> Maybe (Either License License) -> Installed
Executable :: PackageIdentifier -> Installed
installedPackageIdentifier :: Installed -> PackageIdentifier

-- | Get the installed Version.
installedVersion :: Installed -> Version
instance GHC.Show.Show Stack.Types.Package.Package
instance GHC.Show.Show Stack.Types.Package.LocalPackage
instance GHC.Show.Show Stack.Types.Package.PackageSource
instance GHC.Classes.Eq Stack.Types.Package.Installed
instance GHC.Show.Show Stack.Types.Package.Installed
instance GHC.Show.Show Stack.Types.Package.DotCabalPath
instance GHC.Classes.Ord Stack.Types.Package.DotCabalPath
instance GHC.Classes.Eq Stack.Types.Package.DotCabalPath
instance GHC.Show.Show Stack.Types.Package.DotCabalDescriptor
instance GHC.Classes.Ord Stack.Types.Package.DotCabalDescriptor
instance GHC.Classes.Eq Stack.Types.Package.DotCabalDescriptor
instance Data.Data.Data Stack.Types.Package.FileCacheInfo
instance GHC.Classes.Eq Stack.Types.Package.FileCacheInfo
instance GHC.Show.Show Stack.Types.Package.FileCacheInfo
instance GHC.Generics.Generic Stack.Types.Package.FileCacheInfo
instance Data.Data.Data Stack.Types.Package.ModTime
instance Data.Store.Impl.Store Stack.Types.Package.ModTime
instance Control.DeepSeq.NFData Stack.Types.Package.ModTime
instance GHC.Classes.Eq Stack.Types.Package.ModTime
instance GHC.Generics.Generic Stack.Types.Package.ModTime
instance GHC.Show.Show Stack.Types.Package.ModTime
instance GHC.Classes.Ord Stack.Types.Package.ModTime
instance GHC.Classes.Eq Stack.Types.Package.InstalledPackageLocation
instance GHC.Show.Show Stack.Types.Package.InstalledPackageLocation
instance GHC.Classes.Eq Stack.Types.Package.InstallLocation
instance GHC.Show.Show Stack.Types.Package.InstallLocation
instance GHC.Show.Show Stack.Types.Package.PackageConfig
instance GHC.Show.Show Stack.Types.Package.BuildInfoOpts
instance GHC.Show.Show Stack.Types.Package.DepValue
instance GHC.Classes.Eq Stack.Types.Package.DepType
instance GHC.Show.Show Stack.Types.Package.DepType
instance GHC.Show.Show Stack.Types.Package.PackageLibraries
instance GHC.Show.Show Stack.Types.Package.GetPackageOpts
instance GHC.Classes.Ord Stack.Types.Package.Package
instance GHC.Classes.Eq Stack.Types.Package.Package
instance GHC.Show.Show Stack.Types.Package.GetPackageFiles
instance Data.Store.Impl.Store Stack.Types.Package.FileCacheInfo
instance Control.DeepSeq.NFData Stack.Types.Package.FileCacheInfo
instance GHC.Base.Semigroup Stack.Types.Package.InstallLocation
instance GHC.Base.Monoid Stack.Types.Package.InstallLocation
instance GHC.Base.Semigroup Stack.Types.Package.DepValue
instance GHC.Base.Semigroup Stack.Types.Package.DepType
instance GHC.Exception.Type.Exception Stack.Types.Package.PackageException
instance GHC.Show.Show Stack.Types.Package.PackageException


-- | Build-specific types.
module Stack.Types.Build
data StackBuildException
Couldn'tFindPkgId :: PackageName -> StackBuildException
CompilerVersionMismatch :: Maybe (CompilerVersion  'CVActual, Arch) -> (CompilerVersion  'CVWanted, Arch) -> GHCVariant -> CompilerBuild -> VersionCheck -> Maybe (Path Abs File) -> Text -> StackBuildException
Couldn'tParseTargets :: [Text] -> StackBuildException
UnknownTargets :: Set PackageName -> Map PackageName Version -> Path Abs File -> StackBuildException
TestSuiteFailure :: PackageIdentifier -> Map Text (Maybe ExitCode) -> Maybe (Path Abs File) -> ByteString -> StackBuildException
TestSuiteTypeUnsupported :: TestSuiteInterface -> StackBuildException
ConstructPlanFailed :: String -> StackBuildException
CabalExitedUnsuccessfully :: ExitCode -> PackageIdentifier -> Path Abs File -> [String] -> Maybe (Path Abs File) -> [Text] -> StackBuildException
SetupHsBuildFailure :: ExitCode -> Maybe PackageIdentifier -> Path Abs File -> [String] -> Maybe (Path Abs File) -> [Text] -> StackBuildException
ExecutionFailure :: [SomeException] -> StackBuildException
LocalPackageDoesn'tMatchTarget :: PackageName -> Version -> Version -> StackBuildException
NoSetupHsFound :: Path Abs Dir -> StackBuildException
InvalidFlagSpecification :: Set UnusedFlags -> StackBuildException
TargetParseException :: [Text] -> StackBuildException
SolverGiveUp :: String -> StackBuildException
SolverMissingCabalInstall :: StackBuildException
SomeTargetsNotBuildable :: [(PackageName, NamedComponent)] -> StackBuildException
TestSuiteExeMissing :: Bool -> String -> String -> String -> StackBuildException
CabalCopyFailed :: Bool -> String -> StackBuildException
LocalPackagesPresent :: [PackageIdentifier] -> StackBuildException
data FlagSource
FSCommandLine :: FlagSource
FSStackYaml :: FlagSource
data UnusedFlags
UFNoPackage :: FlagSource -> PackageName -> UnusedFlags
UFFlagsNotDefined :: FlagSource -> Package -> Set FlagName -> UnusedFlags
UFSnapshot :: PackageName -> UnusedFlags

-- | A location to install a package into, either snapshot or local
data InstallLocation
Snap :: InstallLocation
Local :: InstallLocation

-- | Used for storage and comparison.
data ModTime

-- | One-way conversion to serialized time.
modTime :: UTCTime -> ModTime
data Installed
Library :: PackageIdentifier -> GhcPkgId -> Maybe (Either License License) -> Installed
Executable :: PackageIdentifier -> Installed
piiVersion :: PackageSource -> Version
piiLocation :: PackageSource -> InstallLocation

-- | A task to perform when building
data Task
Task :: !PackageIdentifier -> !TaskType -> !TaskConfigOpts -> !Map PackageIdentifier GhcPkgId -> !Bool -> !CachePkgSrc -> !Bool -> !Bool -> Task

-- | the package/version to be built
[taskProvides] :: Task -> !PackageIdentifier

-- | the task type, telling us how to build this
[taskType] :: Task -> !TaskType
[taskConfigOpts] :: Task -> !TaskConfigOpts

-- | GhcPkgIds of already-installed dependencies
[taskPresent] :: Task -> !Map PackageIdentifier GhcPkgId

-- | indicates that the package can be built in one step
[taskAllInOne] :: Task -> !Bool
[taskCachePkgSrc] :: Task -> !CachePkgSrc

-- | Were any of the dependencies missing? The reason this is necessary
--   is... hairy. And as you may expect, a bug in Cabal. See:
--   <a>https://github.com/haskell/cabal/issues/4728#issuecomment-337937673</a>.
--   The problem is that Cabal may end up generating the same package ID
--   for a dependency, even if the ABI has changed. As a result, without
--   this field, Stack would think that a reconfigure is unnecessary, when
--   in fact we _do_ need to reconfigure. The details here suck. We really
--   need proper hashes for package identifiers.
[taskAnyMissing] :: Task -> !Bool

-- | Is the build type of this package Configure. Check out
--   ensureConfigureScript in Stack.Build.Execute for the motivation
[taskBuildTypeConfig] :: Task -> !Bool
taskIsTarget :: Task -> Bool
taskLocation :: Task -> InstallLocation

-- | Information on a locally available package of source code
data LocalPackage
LocalPackage :: !Package -> !Set NamedComponent -> !Set NamedComponent -> !Bool -> !Map PackageName VersionRange -> !Map PackageName VersionRange -> !Maybe Package -> !Path Abs Dir -> !Path Abs File -> !Bool -> !Maybe (Set FilePath) -> !Map NamedComponent (Map FilePath FileCacheInfo) -> !Map NamedComponent (Set (Path Abs File)) -> !PackageLocation FilePath -> LocalPackage

-- | The <tt>Package</tt> info itself, after resolution with package flags,
--   with tests and benchmarks disabled
[lpPackage] :: LocalPackage -> !Package

-- | Components to build, not including the library component.
[lpComponents] :: LocalPackage -> !Set NamedComponent

-- | Components explicitly requested for build, that are marked "buildable:
--   false".
[lpUnbuildable] :: LocalPackage -> !Set NamedComponent

-- | Whether this package is wanted as a target.
[lpWanted] :: LocalPackage -> !Bool

-- | Used for determining if we can use --enable-tests in a normal build.
[lpTestDeps] :: LocalPackage -> !Map PackageName VersionRange

-- | Used for determining if we can use --enable-benchmarks in a normal
--   build.
[lpBenchDeps] :: LocalPackage -> !Map PackageName VersionRange

-- | This stores the <a>Package</a> with tests and benchmarks enabled, if
--   either is asked for by the user.
[lpTestBench] :: LocalPackage -> !Maybe Package

-- | Directory of the package.
[lpDir] :: LocalPackage -> !Path Abs Dir

-- | The .cabal file
[lpCabalFile] :: LocalPackage -> !Path Abs File
[lpForceDirty] :: LocalPackage -> !Bool

-- | Nothing == not dirty, Just == dirty. Note that the Set may be empty if
--   we forced the build to treat packages as dirty. Also, the Set may not
--   include all modified files.
[lpDirtyFiles] :: LocalPackage -> !Maybe (Set FilePath)

-- | current state of the files
[lpNewBuildCaches] :: LocalPackage -> !Map NamedComponent (Map FilePath FileCacheInfo)

-- | all files used by this package
[lpComponentFiles] :: LocalPackage -> !Map NamedComponent (Set (Path Abs File))

-- | Where this source code came from
[lpLocation] :: LocalPackage -> !PackageLocation FilePath

-- | Basic information used to calculate what the configure options are
data BaseConfigOpts
BaseConfigOpts :: !Path Abs Dir -> !Path Abs Dir -> !Path Abs Dir -> !Path Abs Dir -> !BuildOpts -> !BuildOptsCLI -> ![Path Abs Dir] -> BaseConfigOpts
[bcoSnapDB] :: BaseConfigOpts -> !Path Abs Dir
[bcoLocalDB] :: BaseConfigOpts -> !Path Abs Dir
[bcoSnapInstallRoot] :: BaseConfigOpts -> !Path Abs Dir
[bcoLocalInstallRoot] :: BaseConfigOpts -> !Path Abs Dir
[bcoBuildOpts] :: BaseConfigOpts -> !BuildOpts
[bcoBuildOptsCLI] :: BaseConfigOpts -> !BuildOptsCLI
[bcoExtraDBs] :: BaseConfigOpts -> ![Path Abs Dir]

-- | A complete plan of what needs to be built and how to do it
data Plan
Plan :: !Map PackageName Task -> !Map PackageName Task -> !Map GhcPkgId (PackageIdentifier, Text) -> !Map Text InstallLocation -> Plan
[planTasks] :: Plan -> !Map PackageName Task

-- | Final actions to be taken (test, benchmark, etc)
[planFinals] :: Plan -> !Map PackageName Task

-- | Text is reason we're unregistering, for display only
[planUnregisterLocal] :: Plan -> !Map GhcPkgId (PackageIdentifier, Text)

-- | Executables that should be installed after successful building
[planInstallExes] :: Plan -> !Map Text InstallLocation

-- | Options for the <tt>FinalAction</tt> <tt>DoTests</tt>
data TestOpts
TestOpts :: !Bool -> ![String] -> !Bool -> !Bool -> TestOpts

-- | Whether successful tests will be run gain
[toRerunTests] :: TestOpts -> !Bool

-- | Arguments passed to the test program
[toAdditionalArgs] :: TestOpts -> ![String]

-- | Generate a code coverage report
[toCoverage] :: TestOpts -> !Bool

-- | Disable running of tests
[toDisableRun] :: TestOpts -> !Bool

-- | Options for the <tt>FinalAction</tt> <tt>DoBenchmarks</tt>
data BenchmarkOpts
BenchmarkOpts :: !Maybe String -> !Bool -> BenchmarkOpts

-- | Arguments passed to the benchmark program
[beoAdditionalArgs] :: BenchmarkOpts -> !Maybe String

-- | Disable running of benchmarks
[beoDisableRun] :: BenchmarkOpts -> !Bool
data FileWatchOpts
NoFileWatch :: FileWatchOpts
FileWatch :: FileWatchOpts
FileWatchPoll :: FileWatchOpts

-- | Build options that is interpreted by the build command. This is built
--   up from BuildOptsCLI and BuildOptsMonoid
data BuildOpts
BuildOpts :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !HaddockOpts -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe Bool -> !Maybe Bool -> !Bool -> !Bool -> !TestOpts -> !Bool -> !BenchmarkOpts -> !Bool -> !Bool -> !Bool -> ![Text] -> !Bool -> BuildOpts
[boptsLibProfile] :: BuildOpts -> !Bool
[boptsExeProfile] :: BuildOpts -> !Bool
[boptsLibStrip] :: BuildOpts -> !Bool
[boptsExeStrip] :: BuildOpts -> !Bool

-- | Build haddocks?
[boptsHaddock] :: BuildOpts -> !Bool

-- | Options to pass to haddock
[boptsHaddockOpts] :: BuildOpts -> !HaddockOpts

-- | Open haddocks in the browser?
[boptsOpenHaddocks] :: BuildOpts -> !Bool

-- | Build haddocks for dependencies?
[boptsHaddockDeps] :: BuildOpts -> !Maybe Bool

-- | Build haddocks for all symbols and packages, like <tt>cabal haddock
--   --internal</tt>
[boptsHaddockInternal] :: BuildOpts -> !Bool

-- | Build hyperlinked source if possible. Fallback to <tt>hscolour</tt>.
--   Disable for no sources.
[boptsHaddockHyperlinkSource] :: BuildOpts -> !Bool

-- | Install executables to user path after building?
[boptsInstallExes] :: BuildOpts -> !Bool

-- | Install executables to compiler tools path after building?
[boptsInstallCompilerTool] :: BuildOpts -> !Bool

-- | Fetch all packages immediately ^ Watch files for changes and
--   automatically rebuild
[boptsPreFetch] :: BuildOpts -> !Bool

-- | Keep building/running after failure
[boptsKeepGoing] :: BuildOpts -> !Maybe Bool

-- | Keep intermediate files and build directories
[boptsKeepTmpFiles] :: BuildOpts -> !Maybe Bool

-- | Force treating all local packages as having dirty files
[boptsForceDirty] :: BuildOpts -> !Bool

-- | Turn on tests for local targets
[boptsTests] :: BuildOpts -> !Bool

-- | Additional test arguments
[boptsTestOpts] :: BuildOpts -> !TestOpts

-- | Turn on benchmarks for local targets
[boptsBenchmarks] :: BuildOpts -> !Bool

-- | Additional test arguments ^ Commands (with arguments) to run after a
--   successful build ^ Only perform the configure step when building
[boptsBenchmarkOpts] :: BuildOpts -> !BenchmarkOpts

-- | Perform the configure step even if already configured
[boptsReconfigure] :: BuildOpts -> !Bool

-- | Ask Cabal to be verbose in its builds
[boptsCabalVerbose] :: BuildOpts -> !Bool

-- | Whether to enable split-objs.
[boptsSplitObjs] :: BuildOpts -> !Bool

-- | Which components to skip when building
[boptsSkipComponents] :: BuildOpts -> ![Text]

-- | Should we use the interleaved GHC output when building multiple
--   packages?
[boptsInterleavedOutput] :: BuildOpts -> !Bool

-- | Which subset of packages to build
data BuildSubset
BSAll :: BuildSubset

-- | Only install packages in the snapshot database, skipping packages
--   intended for the local database.
BSOnlySnapshot :: BuildSubset
BSOnlyDependencies :: BuildSubset
defaultBuildOpts :: BuildOpts

-- | The type of a task, either building local code or something from the
--   package index (upstream)
data TaskType
TTFiles :: LocalPackage -> InstallLocation -> TaskType
TTIndex :: Package -> InstallLocation -> PackageIdentifierRevision -> TaskType
ttPackageLocation :: TaskType -> PackageLocationIndex FilePath

-- | Given the IDs of any missing packages, produce the configure options
data TaskConfigOpts
TaskConfigOpts :: !Set PackageIdentifier -> !Map PackageIdentifier GhcPkgId -> ConfigureOpts -> TaskConfigOpts

-- | Dependencies for which we don't yet have an GhcPkgId
[tcoMissing] :: TaskConfigOpts -> !Set PackageIdentifier

-- | Produce the list of options given the missing <tt>GhcPkgId</tt>s
[tcoOpts] :: TaskConfigOpts -> !Map PackageIdentifier GhcPkgId -> ConfigureOpts

-- | Stored on disk to know whether the files have changed.
newtype BuildCache
BuildCache :: Map FilePath FileCacheInfo -> BuildCache

-- | Modification times of files.
[buildCacheTimes] :: BuildCache -> Map FilePath FileCacheInfo
buildCacheVC :: VersionConfig BuildCache

-- | Stored on disk to know whether the flags have changed.
data ConfigCache
ConfigCache :: !ConfigureOpts -> !Set GhcPkgId -> !Set ByteString -> !Bool -> !CachePkgSrc -> ConfigCache

-- | All options used for this package.
[configCacheOpts] :: ConfigCache -> !ConfigureOpts

-- | The GhcPkgIds of all of the dependencies. Since Cabal doesn't take the
--   complete GhcPkgId (only a PackageIdentifier) in the configure options,
--   just using the previous value is insufficient to know if dependencies
--   have changed.
[configCacheDeps] :: ConfigCache -> !Set GhcPkgId

-- | The components to be built. It's a bit of a hack to include this in
--   here, as it's not a configure option (just a build option), but this
--   is a convenient way to force compilation when the components change.
[configCacheComponents] :: ConfigCache -> !Set ByteString

-- | Are haddocks to be built?
[configCacheHaddock] :: ConfigCache -> !Bool
[configCachePkgSrc] :: ConfigCache -> !CachePkgSrc
configCacheVC :: VersionConfig ConfigCache

-- | Render a <tt>BaseConfigOpts</tt> to an actual list of options
configureOpts :: EnvConfig -> BaseConfigOpts -> Map PackageIdentifier GhcPkgId -> Bool -> InstallLocation -> Package -> ConfigureOpts
data CachePkgSrc
CacheSrcUpstream :: CachePkgSrc
CacheSrcLocal :: FilePath -> CachePkgSrc
toCachePkgSrc :: PackageSource -> CachePkgSrc
isStackOpt :: Text -> Bool

-- | Get set of wanted package names from locals.
wantedLocalPackages :: [LocalPackage] -> Set PackageName
data FileCacheInfo
FileCacheInfo :: !ModTime -> !Word64 -> !ByteString -> FileCacheInfo
[fciModTime] :: FileCacheInfo -> !ModTime
[fciSize] :: FileCacheInfo -> !Word64
[fciHash] :: FileCacheInfo -> !ByteString

-- | Configure options to be sent to Setup.hs configure
data ConfigureOpts
ConfigureOpts :: ![String] -> ![String] -> ConfigureOpts

-- | Options related to various paths. We separate these out since they do
--   not have an impact on the contents of the compiled binary for checking
--   if we can use an existing precompiled cache.
[coDirs] :: ConfigureOpts -> ![String]
[coNoDirs] :: ConfigureOpts -> ![String]

-- | Information on a compiled package: the library conf file (if
--   relevant), the sublibraries (if present) and all of the executable
--   paths.
data PrecompiledCache
PrecompiledCache :: !Maybe FilePath -> ![FilePath] -> ![FilePath] -> PrecompiledCache

-- | .conf file inside the package database
[pcLibrary] :: PrecompiledCache -> !Maybe FilePath

-- | .conf file inside the package database, for each of the sublibraries
[pcSubLibs] :: PrecompiledCache -> ![FilePath]

-- | Full paths to executables
[pcExes] :: PrecompiledCache -> ![FilePath]
precompiledCacheVC :: VersionConfig PrecompiledCache
instance Data.Data.Data Stack.Types.Build.PrecompiledCache
instance GHC.Generics.Generic Stack.Types.Build.PrecompiledCache
instance GHC.Classes.Eq Stack.Types.Build.PrecompiledCache
instance GHC.Show.Show Stack.Types.Build.PrecompiledCache
instance Data.Data.Data Stack.Types.Build.ConfigCache
instance GHC.Show.Show Stack.Types.Build.ConfigCache
instance GHC.Classes.Eq Stack.Types.Build.ConfigCache
instance GHC.Generics.Generic Stack.Types.Build.ConfigCache
instance GHC.Show.Show Stack.Types.Build.Plan
instance GHC.Show.Show Stack.Types.Build.Task
instance Data.Data.Data Stack.Types.Build.ConfigureOpts
instance GHC.Generics.Generic Stack.Types.Build.ConfigureOpts
instance GHC.Classes.Eq Stack.Types.Build.ConfigureOpts
instance GHC.Show.Show Stack.Types.Build.ConfigureOpts
instance GHC.Show.Show Stack.Types.Build.BaseConfigOpts
instance GHC.Show.Show Stack.Types.Build.TaskType
instance Data.Data.Data Stack.Types.Build.CachePkgSrc
instance GHC.Show.Show Stack.Types.Build.CachePkgSrc
instance GHC.Classes.Eq Stack.Types.Build.CachePkgSrc
instance GHC.Generics.Generic Stack.Types.Build.CachePkgSrc
instance Data.Data.Data Stack.Types.Build.BuildCache
instance GHC.Show.Show Stack.Types.Build.BuildCache
instance GHC.Classes.Eq Stack.Types.Build.BuildCache
instance GHC.Generics.Generic Stack.Types.Build.BuildCache
instance Control.DeepSeq.NFData Stack.Types.Build.PkgDepsOracle
instance Data.Store.Impl.Store Stack.Types.Build.PkgDepsOracle
instance Data.Hashable.Class.Hashable Stack.Types.Build.PkgDepsOracle
instance GHC.Classes.Eq Stack.Types.Build.PkgDepsOracle
instance GHC.Show.Show Stack.Types.Build.PkgDepsOracle
instance GHC.Classes.Ord Stack.Types.Build.UnusedFlags
instance GHC.Classes.Eq Stack.Types.Build.UnusedFlags
instance GHC.Show.Show Stack.Types.Build.UnusedFlags
instance GHC.Classes.Ord Stack.Types.Build.FlagSource
instance GHC.Classes.Eq Stack.Types.Build.FlagSource
instance GHC.Show.Show Stack.Types.Build.FlagSource
instance Data.Store.Impl.Store Stack.Types.Build.PrecompiledCache
instance Control.DeepSeq.NFData Stack.Types.Build.PrecompiledCache
instance Data.Store.Impl.Store Stack.Types.Build.ConfigCache
instance Control.DeepSeq.NFData Stack.Types.Build.ConfigCache
instance GHC.Show.Show Stack.Types.Build.TaskConfigOpts
instance Data.Store.Impl.Store Stack.Types.Build.ConfigureOpts
instance Control.DeepSeq.NFData Stack.Types.Build.ConfigureOpts
instance Data.Store.Impl.Store Stack.Types.Build.CachePkgSrc
instance Control.DeepSeq.NFData Stack.Types.Build.CachePkgSrc
instance Control.DeepSeq.NFData Stack.Types.Build.BuildCache
instance Data.Store.Impl.Store Stack.Types.Build.BuildCache
instance GHC.Show.Show Stack.Types.Build.StackBuildException
instance GHC.Exception.Type.Exception Stack.Types.Build.StackBuildException


-- | Functions for the GHC package database.
module Stack.GhcPkg

-- | Get the global package database
getGlobalDB :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env (Path Abs Dir)

-- | Get the value of a field of the package.
findGhcPkgField :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> [Path Abs Dir] -> String -> Text -> RIO env (Maybe Text)

-- | Create a package database in the given directory, if it doesn't exist.
createDatabase :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> Path Abs Dir -> RIO env ()
unregisterGhcPkgId :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> CompilerVersion  'CVActual -> Path Abs Dir -> GhcPkgId -> PackageIdentifier -> RIO env ()

-- | Get the version of Cabal from the global package database.
getCabalPkgVer :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env Version

-- | Get the name to use for "ghc-pkg", given the compiler version.
ghcPkgExeName :: WhichCompiler -> String

-- | Get the environment variable to use for the package DB paths.
ghcPkgPathEnvVar :: WhichCompiler -> Text

-- | Get the value for GHC_PACKAGE_PATH
mkGhcPackagePath :: Bool -> Path Abs Dir -> Path Abs Dir -> [Path Abs Dir] -> Path Abs Dir -> Text

module Stack.PackageDump

-- | A single line of input, not including line endings
type Line = Text

-- | Apply the given Sink to each section of output, broken by a single
--   line containing ---
eachSection :: Monad m => ConduitM Line Void m a -> ConduitM Text a m ()

-- | Grab each key/value pair
eachPair :: Monad m => (Text -> ConduitM Line Void m a) -> ConduitM Line a m ()

-- | Dump information for a single package
data DumpPackage profiling haddock symbols
DumpPackage :: !GhcPkgId -> !PackageIdentifier -> !Maybe PackageIdentifier -> !Maybe License -> ![FilePath] -> ![Text] -> !Bool -> ![Text] -> ![GhcPkgId] -> ![FilePath] -> !Maybe FilePath -> !profiling -> !haddock -> !symbols -> !Bool -> DumpPackage profiling haddock symbols
[dpGhcPkgId] :: DumpPackage profiling haddock symbols -> !GhcPkgId
[dpPackageIdent] :: DumpPackage profiling haddock symbols -> !PackageIdentifier
[dpParentLibIdent] :: DumpPackage profiling haddock symbols -> !Maybe PackageIdentifier
[dpLicense] :: DumpPackage profiling haddock symbols -> !Maybe License
[dpLibDirs] :: DumpPackage profiling haddock symbols -> ![FilePath]
[dpLibraries] :: DumpPackage profiling haddock symbols -> ![Text]
[dpHasExposedModules] :: DumpPackage profiling haddock symbols -> !Bool
[dpExposedModules] :: DumpPackage profiling haddock symbols -> ![Text]
[dpDepends] :: DumpPackage profiling haddock symbols -> ![GhcPkgId]
[dpHaddockInterfaces] :: DumpPackage profiling haddock symbols -> ![FilePath]
[dpHaddockHtml] :: DumpPackage profiling haddock symbols -> !Maybe FilePath
[dpProfiling] :: DumpPackage profiling haddock symbols -> !profiling
[dpHaddock] :: DumpPackage profiling haddock symbols -> !haddock
[dpSymbols] :: DumpPackage profiling haddock symbols -> !symbols
[dpIsExposed] :: DumpPackage profiling haddock symbols -> !Bool

-- | Convert a stream of bytes into a stream of <tt>DumpPackage</tt>s
conduitDumpPackage :: MonadThrow m => ConduitM Text (DumpPackage () () ()) m ()

-- | Call ghc-pkg dump with appropriate flags and stream to the given
--   <tt>Sink</tt>, for a single database
ghcPkgDump :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> [Path Abs Dir] -> ConduitM Text Void (RIO env) a -> RIO env a

-- | Call ghc-pkg describe with appropriate flags and stream to the given
--   <tt>Sink</tt>, for a single database
ghcPkgDescribe :: (HasProcessContext env, HasLogFunc env) => PackageName -> WhichCompiler -> [Path Abs Dir] -> ConduitM Text Void (RIO env) a -> RIO env a

-- | Create a new, empty <tt>InstalledCache</tt>
newInstalledCache :: MonadIO m => m InstalledCache

-- | Load a <tt>InstalledCache</tt> from disk, swallowing any errors and
--   returning an empty cache.
loadInstalledCache :: HasLogFunc env => Path Abs File -> RIO env InstalledCache

-- | Save a <tt>InstalledCache</tt> to disk
saveInstalledCache :: HasLogFunc env => Path Abs File -> InstalledCache -> RIO env ()

-- | Add profiling information to the stream of <tt>DumpPackage</tt>s
addProfiling :: MonadIO m => InstalledCache -> ConduitM (DumpPackage a b c) (DumpPackage Bool b c) m ()

-- | Add haddock information to the stream of <tt>DumpPackage</tt>s
addHaddock :: MonadIO m => InstalledCache -> ConduitM (DumpPackage a b c) (DumpPackage a Bool c) m ()

-- | Add debugging symbol information to the stream of
--   <tt>DumpPackage</tt>s
addSymbols :: MonadIO m => InstalledCache -> ConduitM (DumpPackage a b c) (DumpPackage a b Bool) m ()

-- | Find the package IDs matching the given constraints with all
--   dependencies installed. Packages not mentioned in the provided
--   <tt>Map</tt> are allowed to be present too.
sinkMatching :: Monad m => Bool -> Bool -> Bool -> Map PackageName Version -> ConduitM (DumpPackage Bool Bool Bool) o m (Map PackageName (DumpPackage Bool Bool Bool))

-- | Prune a list of possible packages down to those whose dependencies are
--   met.
--   
--   <ul>
--   <li>id uniquely identifies an item</li>
--   <li>There can be multiple items per name</li>
--   </ul>
pruneDeps :: (Ord name, Ord id) => (id -> name) -> (item -> id) -> (item -> [id]) -> (item -> item -> item) -> [item] -> Map name item
instance (GHC.Classes.Eq profiling, GHC.Classes.Eq haddock, GHC.Classes.Eq symbols) => GHC.Classes.Eq (Stack.PackageDump.DumpPackage profiling haddock symbols)
instance (GHC.Show.Show profiling, GHC.Show.Show haddock, GHC.Show.Show symbols) => GHC.Show.Show (Stack.PackageDump.DumpPackage profiling haddock symbols)
instance GHC.Exception.Type.Exception Stack.PackageDump.PackageDumpException
instance GHC.Show.Show Stack.PackageDump.PackageDumpException

module Stack.Setup.Installed
getCompilerVersion :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env (CompilerVersion  'CVActual)
markInstalled :: (MonadIO m, MonadThrow m) => Path Abs Dir -> Tool -> m ()
unmarkInstalled :: MonadIO m => Path Abs Dir -> Tool -> m ()
listInstalled :: (MonadIO m, MonadThrow m) => Path Abs Dir -> m [Tool]
data Tool

-- | e.g. ghc-7.8.4, msys2-20150512
Tool :: PackageIdentifier -> Tool

-- | e.g. ghcjs-0.1.0_ghc-7.10.2
ToolGhcjs :: CompilerVersion  'CVActual -> Tool
toolString :: Tool -> String
toolNameString :: Tool -> String
parseToolText :: Text -> Maybe Tool
data ExtraDirs
ExtraDirs :: ![Path Abs Dir] -> ![Path Abs Dir] -> ![Path Abs Dir] -> ExtraDirs
[edBins] :: ExtraDirs -> ![Path Abs Dir]
[edInclude] :: ExtraDirs -> ![Path Abs Dir]
[edLib] :: ExtraDirs -> ![Path Abs Dir]

-- | Binary directories for the given installed package
extraDirs :: HasConfig env => Tool -> RIO env ExtraDirs
installDir :: (MonadReader env m, MonadThrow m) => Path Abs Dir -> Tool -> m (Path Abs Dir)
tempInstallDir :: (MonadReader env m, MonadThrow m) => Path Abs Dir -> Tool -> m (Path Abs Dir)
instance GHC.Generics.Generic Stack.Setup.Installed.ExtraDirs
instance GHC.Show.Show Stack.Setup.Installed.ExtraDirs
instance GHC.Base.Semigroup Stack.Setup.Installed.ExtraDirs
instance GHC.Base.Monoid Stack.Setup.Installed.ExtraDirs

module Stack.Options.TestParser

-- | Parser for test arguments. FIXME hide args
testOptsParser :: Bool -> Parser TestOptsMonoid

module Stack.Options.HaddockParser

-- | Parser for haddock arguments.
haddockOptsParser :: Bool -> Parser HaddockOptsMonoid

module Stack.Options.GhcVariantParser

-- | GHC variant parser
ghcVariantParser :: Bool -> Parser GHCVariant

module Stack.Options.BenchParser

-- | Parser for bench arguments. FIXME hiding options
benchOptsParser :: Bool -> Parser BenchmarkOptsMonoid


-- | Global sqlite database shared by all projects. Warning: this is
--   currently only accessible from <b>outside</b> a Docker container.
module Stack.Docker.GlobalDB

-- | Update last used time and project for a Docker image hash.
updateDockerImageLastUsed :: Config -> String -> FilePath -> IO ()

-- | Get a list of Docker image hashes and when they were last used.
getDockerImagesLastUsed :: Config -> IO [DockerImageLastUsed]

-- | Given a list of all existing Docker images, remove any that no longer
--   exist from the database.
pruneDockerImagesLastUsed :: Config -> [String] -> IO ()

-- | Date and project path where Docker image hash last used.
type DockerImageLastUsed = (String, [(UTCTime, FilePath)])
type DockerImageProjectId = Key DockerImageProject

-- | Get the record of whether an executable is compatible with a Docker
--   image
getDockerImageExe :: Config -> String -> FilePath -> UTCTime -> IO (Maybe Bool)

-- | Seet the record of whether an executable is compatible with a Docker
--   image
setDockerImageExe :: Config -> String -> FilePath -> UTCTime -> Bool -> IO ()
type DockerImageExeId = Key DockerImageExe
instance GHC.Show.Show Stack.Docker.GlobalDB.DockerImageExe
instance GHC.Show.Show Stack.Docker.GlobalDB.DockerImageProject
instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject)
instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Unique Stack.Docker.GlobalDB.DockerImageProject)
instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe)
instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Unique Stack.Docker.GlobalDB.DockerImageExe)
instance Database.Persist.Class.PersistField.PersistField Stack.Docker.GlobalDB.DockerImageExe
instance Database.Persist.Sql.Class.PersistFieldSql Stack.Docker.GlobalDB.DockerImageExe
instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Docker.GlobalDB.DockerImageExe
instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.Sql.Types.Internal.SqlBackend Stack.Docker.GlobalDB.DockerImageExe
instance Database.Persist.Class.PersistField.PersistField Stack.Docker.GlobalDB.DockerImageProject
instance Database.Persist.Sql.Class.PersistFieldSql Stack.Docker.GlobalDB.DockerImageProject
instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Docker.GlobalDB.DockerImageProject
instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.Sql.Types.Internal.SqlBackend Stack.Docker.GlobalDB.DockerImageProject

module Stack.Constants.Config

-- | Package's build artifacts directory.
distDirFromDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir)

-- | Package's working directory.
workDirFromDir :: (MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir)

-- | Relative location of build artifacts.
distRelativeDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Rel Dir)

-- | Image staging dir from project root.
imageStagingDir :: (MonadReader env m, HasConfig env, MonadThrow m) => Path Abs Dir -> Int -> m (Path Abs Dir)

-- | Docker sandbox from project root.
projectDockerSandboxDir :: (MonadReader env m, HasConfig env) => Path Abs Dir -> m (Path Abs Dir)

-- | The filename used for dirtiness check of config.
configCacheFile :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File)

-- | The filename used for modification check of .cabal
configCabalMod :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File)

-- | The directory containing the files used for dirtiness check of source
--   files.
buildCachesDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir)

-- | The filename used to mark tests as having succeeded
testSuccessFile :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File)

-- | The filename used to mark tests as having built
testBuiltFile :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File)

-- | Relative location of directory for HPC work.
hpcRelativeDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Rel Dir)

-- | Directory for HPC work.
hpcDirFromDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir)

-- | Output .o/.hi directory.
objectInterfaceDirL :: HasBuildConfig env => Getting r env (Path Abs Dir)

-- | GHCi files directory.
ghciDirL :: HasBuildConfig env => Getting r env (Path Abs Dir)

-- | Directory for project templates.
templatesDir :: Config -> Path Abs Dir


-- | This module builds Docker (OpenContainer) images.
module Stack.Image

-- | Stages the executables &amp; additional content in a staging directory
--   under '.stack-work'
stageContainerImageArtifacts :: HasEnvConfig env => Maybe (Path Abs Dir) -> [Text] -> RIO env ()

-- | Builds a Docker (OpenContainer) image extending the <tt>base</tt>
--   image specified in the project's stack.yaml. Then new image will be
--   extended with an ENTRYPOINT specified for each <tt>entrypoint</tt>
--   listed in the config file.
createContainerImageFromStage :: HasConfig env => Maybe (Path Abs Dir) -> [Text] -> RIO env ()

-- | The command name for dealing with images.
imgCmdName :: String

-- | The command name for building a docker container.
imgDockerCmdName :: String

-- | Convert image opts monoid to image options.
imgOptsFromMonoid :: ImageOptsMonoid -> ImageOpts
instance GHC.Exception.Type.Exception Stack.Image.StackImageException
instance GHC.Show.Show Stack.Image.StackImageException


-- | Docker configuration
module Stack.Config.Docker

-- | Interprets DockerOptsMonoid options.
dockerOptsFromMonoid :: MonadThrow m => Maybe Project -> Path Abs Dir -> Maybe AbstractResolver -> DockerOptsMonoid -> m DockerOpts

-- | Exceptions thrown by Stack.Docker.Config.
data StackDockerConfigException

-- | Only LTS resolvers are supported for default image tag.
ResolverNotSupportedException :: String -> StackDockerConfigException

-- | Invalid global database path.
InvalidDatabasePathException :: SomeException -> StackDockerConfigException
instance GHC.Exception.Type.Exception Stack.Config.Docker.StackDockerConfigException
instance GHC.Show.Show Stack.Config.Docker.StackDockerConfigException


-- | Build configuration
module Stack.Config.Build

-- | Interprets BuildOptsMonoid options.
buildOptsFromMonoid :: BuildOptsMonoid -> BuildOpts
haddockOptsFromMonoid :: HaddockOptsMonoid -> HaddockOpts
testOptsFromMonoid :: TestOptsMonoid -> Maybe [String] -> TestOpts
benchmarkOptsFromMonoid :: BenchmarkOptsMonoid -> Maybe [String] -> BenchmarkOpts


-- | Generate haddocks
module Stack.Build.Haddock

-- | Generate Haddock index and contents for local packages.
generateLocalHaddockIndex :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () () ()) -> [LocalPackage] -> RIO env ()

-- | Generate Haddock index and contents for local packages and their
--   dependencies.
generateDepsHaddockIndex :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () () ()) -> Map GhcPkgId (DumpPackage () () ()) -> Map GhcPkgId (DumpPackage () () ()) -> [LocalPackage] -> RIO env ()

-- | Generate Haddock index and contents for all snapshot packages.
generateSnapHaddockIndex :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () () ()) -> Map GhcPkgId (DumpPackage () () ()) -> RIO env ()
openHaddocksInBrowser :: HasRunner env => BaseConfigOpts -> Map PackageName (PackageIdentifier, InstallLocation) -> Set PackageName -> RIO env ()

-- | Determine whether we should haddock for a package.
shouldHaddockPackage :: BuildOpts -> Set PackageName -> PackageName -> Bool

-- | Determine whether to build haddocks for dependencies.
shouldHaddockDeps :: BuildOpts -> Bool


-- | Cache information about previous builds
module Stack.Build.Cache

-- | Try to read the dirtiness cache for the given package directory.
tryGetBuildCache :: HasEnvConfig env => Path Abs Dir -> NamedComponent -> RIO env (Maybe (Map FilePath FileCacheInfo))

-- | Try to read the dirtiness cache for the given package directory.
tryGetConfigCache :: HasEnvConfig env => Path Abs Dir -> RIO env (Maybe ConfigCache)

-- | Try to read the mod time of the cabal file from the last build
tryGetCabalMod :: HasEnvConfig env => Path Abs Dir -> RIO env (Maybe ModTime)

-- | Get all of the installed executables
getInstalledExes :: (MonadReader env m, HasEnvConfig env, MonadIO m, MonadThrow m) => InstallLocation -> m [PackageIdentifier]

-- | Loads the flag cache for the given installed extra-deps
tryGetFlagCache :: HasEnvConfig env => Installed -> RIO env (Maybe ConfigCache)

-- | Delete the caches for the project.
deleteCaches :: (MonadIO m, MonadReader env m, HasEnvConfig env, MonadThrow m) => Path Abs Dir -> m ()

-- | Mark the given executable as installed
markExeInstalled :: (MonadReader env m, HasEnvConfig env, MonadIO m, MonadThrow m) => InstallLocation -> PackageIdentifier -> m ()

-- | Mark the given executable as not installed
markExeNotInstalled :: (MonadReader env m, HasEnvConfig env, MonadIO m, MonadThrow m) => InstallLocation -> PackageIdentifier -> m ()
writeFlagCache :: HasEnvConfig env => Installed -> ConfigCache -> RIO env ()

-- | Write the dirtiness cache for this package's files.
writeBuildCache :: HasEnvConfig env => Path Abs Dir -> NamedComponent -> Map FilePath FileCacheInfo -> RIO env ()

-- | Write the dirtiness cache for this package's configuration.
writeConfigCache :: HasEnvConfig env => Path Abs Dir -> ConfigCache -> RIO env ()

-- | See <a>tryGetCabalMod</a>
writeCabalMod :: HasEnvConfig env => Path Abs Dir -> ModTime -> RIO env ()

-- | Mark a test suite as having succeeded
setTestSuccess :: HasEnvConfig env => Path Abs Dir -> RIO env ()

-- | Mark a test suite as not having succeeded
unsetTestSuccess :: HasEnvConfig env => Path Abs Dir -> RIO env ()

-- | Check if the test suite already passed
checkTestSuccess :: HasEnvConfig env => Path Abs Dir -> RIO env Bool

-- | Write out information about a newly built package
writePrecompiledCache :: HasEnvConfig env => BaseConfigOpts -> PackageLocationIndex FilePath -> ConfigureOpts -> Set GhcPkgId -> Installed -> [GhcPkgId] -> Set Text -> RIO env ()

-- | Check the cache for a precompiled package matching the given
--   configuration.
readPrecompiledCache :: forall env. HasEnvConfig env => PackageLocationIndex FilePath -> ConfigureOpts -> Set GhcPkgId -> RIO env (Maybe PrecompiledCache)

-- | Stored on disk to know whether the files have changed.
newtype BuildCache
BuildCache :: Map FilePath FileCacheInfo -> BuildCache

-- | Modification times of files.
[buildCacheTimes] :: BuildCache -> Map FilePath FileCacheInfo

module Stack.Build.Installed
type InstalledMap = Map PackageName (InstallLocation, Installed)
data Installed
Library :: PackageIdentifier -> GhcPkgId -> Maybe (Either License License) -> Installed
Executable :: PackageIdentifier -> Installed

-- | Options for <a>getInstalled</a>.
data GetInstalledOpts
GetInstalledOpts :: !Bool -> !Bool -> !Bool -> GetInstalledOpts

-- | Require profiling libraries?
[getInstalledProfiling] :: GetInstalledOpts -> !Bool

-- | Require haddocks?
[getInstalledHaddock] :: GetInstalledOpts -> !Bool

-- | Require debugging symbols?
[getInstalledSymbols] :: GetInstalledOpts -> !Bool

-- | Returns the new InstalledMap and all of the locally registered
--   packages.
getInstalled :: HasEnvConfig env => GetInstalledOpts -> Map PackageName PackageSource -> RIO env (InstalledMap, [DumpPackage () () ()], [DumpPackage () () ()], [DumpPackage () () ()])
instance GHC.Show.Show Stack.Build.Installed.LoadHelper
instance GHC.Show.Show Stack.Build.Installed.Allowed
instance GHC.Classes.Eq Stack.Build.Installed.Allowed

module Path.CheckInstall

-- | Checks if the installed executable will be available on the user's
--   PATH. This doesn't use <tt>envSearchPath menv</tt> because it includes
--   paths only visible when running in the stack environment.
warnInstallSearchPathIssues :: HasConfig env => FilePath -> [Text] -> RIO env ()


-- | Handy path information.
module Stack.Path

-- | Print out useful path information in a human-readable format (and
--   support others later).
path :: HasEnvConfig env => [Text] -> RIO env ()
pathParser :: Parser [Text]
instance Stack.Types.Config.HasPlatform Stack.Path.PathInfo
instance RIO.Prelude.Logger.HasLogFunc Stack.Path.PathInfo
instance Stack.Types.Runner.HasRunner Stack.Path.PathInfo
instance Stack.Types.Config.HasConfig Stack.Path.PathInfo
instance Stack.PackageIndex.HasCabalLoader Stack.Path.PathInfo
instance RIO.Process.HasProcessContext Stack.Path.PathInfo
instance Stack.Types.Config.HasBuildConfig Stack.Path.PathInfo


-- | Create new a new project directory populated with a basic working
--   project.
module Stack.New

-- | Create a new project with the given options.
new :: HasConfig env => NewOpts -> Bool -> RIO env (Path Abs Dir)

-- | Options for creating a new project.
data NewOpts
NewOpts :: PackageName -> Bool -> Maybe TemplateName -> Map Text Text -> NewOpts

-- | Name of the project to create.
[newOptsProjectName] :: NewOpts -> PackageName

-- | Whether to create the project without a directory.
[newOptsCreateBare] :: NewOpts -> Bool

-- | Name of the template to use.
[newOptsTemplate] :: NewOpts -> Maybe TemplateName

-- | Nonce parameters specified just for this invocation.
[newOptsNonceParams] :: NewOpts -> Map Text Text

-- | A template name.
data TemplateName

-- | Display help for the templates command.
templatesHelp :: HasLogFunc env => RIO env ()
instance GHC.Exception.Type.Exception Stack.New.NewException
instance GHC.Show.Show Stack.New.NewException


-- | Functionality for downloading packages securely for cabal's usage.
module Stack.Fetch

-- | Intended to work for the command line command.
unpackPackages :: HasCabalLoader env => Maybe SnapshotDef -> FilePath -> [String] -> RIO env ()

-- | Same as <a>unpackPackageIdents</a>, but for a single package.
unpackPackageIdent :: HasCabalLoader env => Path Abs Dir -> Path Rel Dir -> PackageIdentifierRevision -> RIO env (Path Abs Dir)

-- | Ensure that all of the given package idents are unpacked into the
--   build unpack directory, and return the paths to all of the
--   subdirectories.
unpackPackageIdents :: HasCabalLoader env => Path Abs Dir -> Maybe (Path Rel Dir) -> [PackageIdentifierRevision] -> RIO env (Map PackageIdentifier (Path Abs Dir))

-- | Fetch packages into the cache without unpacking
fetchPackages :: HasCabalLoader env => Set PackageIdentifier -> RIO env ()

-- | Internal function used to unpack tarball.
--   
--   Takes a path to a .tar.gz file, the name of the directory it should
--   contain, and a destination folder to extract the tarball into. Returns
--   unexpected entries, as pairs of paths and descriptions.
untar :: forall b1 b2. Path b1 File -> Path Rel Dir -> Path b2 Dir -> IO [(FilePath, Text)]

-- | Resolve a set of package names and identifiers into
--   <tt>FetchPackage</tt> values.
resolvePackages :: HasCabalLoader env => Maybe SnapshotDef -> [PackageIdentifierRevision] -> Set PackageName -> RIO env [ResolvedPackage]

-- | Turn package identifiers and package names into a list of
--   <tt>ResolvedPackage</tt>s. Returns any unresolved names and
--   identifier. These are considered unresolved even if the only mismatch
--   is in the cabal file info (MSS 2017-07-17: old versions of this code
--   had special handling to treat missing cabal file info as a warning,
--   that's no longer necessary or desirable since all info should be
--   present and checked).
resolvePackagesAllowMissing :: forall env. HasCabalLoader env => Maybe SnapshotDef -> [PackageIdentifierRevision] -> Set PackageName -> RIO env (Set PackageName, HashSet PackageIdentifierRevision, [ResolvedPackage])
data ResolvedPackage
ResolvedPackage :: !PackageIdentifier -> !Maybe PackageDownload -> !OffsetSize -> !PackageIndex -> ResolvedPackage
[rpIdent] :: ResolvedPackage -> !PackageIdentifier
[rpDownload] :: ResolvedPackage -> !Maybe PackageDownload
[rpOffsetSize] :: ResolvedPackage -> !OffsetSize
[rpIndex] :: ResolvedPackage -> !PackageIndex

-- | Add the cabal files to a list of idents with their caches.
withCabalFiles :: HasCabalLoader env => IndexName -> [(ResolvedPackage, a)] -> (PackageIdentifier -> a -> ByteString -> IO b) -> RIO env [b]
loadFromIndex :: HasCabalLoader env => PackageIdentifierRevision -> RIO env ByteString
instance GHC.Show.Show Stack.Fetch.ResolvedPackage
instance GHC.Exception.Type.Exception Stack.Fetch.FetchException
instance GHC.Show.Show Stack.Fetch.FetchException


-- | Dealing with Cabal.
module Stack.Package

-- | Reads and exposes the package information
readPackageDir :: forall env. HasConfig env => PackageConfig -> Path Abs Dir -> Bool -> RIO env (Package, Path Abs File)

-- | Read the raw, unresolved package information from a file.
readPackageUnresolvedDir :: forall env. HasConfig env => Path Abs Dir -> Bool -> RIO env (GenericPackageDescription, Path Abs File)

-- | Read the <a>GenericPackageDescription</a> from the given
--   <a>PackageIdentifierRevision</a>.
readPackageUnresolvedIndex :: forall env. HasCabalLoader env => PackageIdentifierRevision -> RIO env GenericPackageDescription

-- | Get <a>GenericPackageDescription</a> and <a>PackageDescription</a>
--   reading info from given directory.
readPackageDescriptionDir :: forall env. HasConfig env => PackageConfig -> Path Abs Dir -> Bool -> RIO env (GenericPackageDescription, PackageDescriptionPair)

-- | Read <tt><a>package</a>.buildinfo</tt> ancillary files produced by
--   some Setup.hs hooks. The file includes Cabal file syntax to be merged
--   into the package description derived from the package's .cabal file.
--   
--   NOTE: not to be confused with BuildInfo, an Stack-internal datatype.
readDotBuildinfo :: MonadIO m => Path Abs File -> m HookedBuildInfo

-- | Resolve a parsed cabal file into a <a>Package</a>, which contains all
--   of the info needed for stack to build the <a>Package</a> given the
--   current configuration.
resolvePackage :: PackageConfig -> GenericPackageDescription -> Package
packageFromPackageDescription :: PackageConfig -> [Flag] -> PackageDescriptionPair -> Package

-- | Some package info.
data Package
Package :: !PackageName -> !Version -> !Either License License -> !GetPackageFiles -> !Map PackageName DepValue -> !Set ExeName -> !Set PackageName -> ![Text] -> !Map FlagName Bool -> !Map FlagName Bool -> !PackageLibraries -> !Set Text -> !Map Text TestSuiteInterface -> !Set Text -> !Set Text -> !GetPackageOpts -> !Bool -> !BuildType -> !Maybe (Map PackageName VersionRange) -> Package

-- | Name of the package.
[packageName] :: Package -> !PackageName

-- | Version of the package
[packageVersion] :: Package -> !Version

-- | The license the package was released under.
[packageLicense] :: Package -> !Either License License

-- | Get all files of the package.
[packageFiles] :: Package -> !GetPackageFiles

-- | Packages that the package depends on, both as libraries and build
--   tools.
[packageDeps] :: Package -> !Map PackageName DepValue

-- | Build tools specified in the legacy manner (build-tools:) that failed
--   the hard-coded lookup.
[packageUnknownTools] :: Package -> !Set ExeName

-- | Original dependencies (not sieved).
[packageAllDeps] :: Package -> !Set PackageName

-- | Ghc options used on package.
[packageGhcOptions] :: Package -> ![Text]

-- | Flags used on package.
[packageFlags] :: Package -> !Map FlagName Bool

-- | Defaults for unspecified flags.
[packageDefaultFlags] :: Package -> !Map FlagName Bool

-- | does the package have a buildable library stanza?
[packageLibraries] :: Package -> !PackageLibraries

-- | names of internal libraries
[packageInternalLibraries] :: Package -> !Set Text

-- | names and interfaces of test suites
[packageTests] :: Package -> !Map Text TestSuiteInterface

-- | names of benchmarks
[packageBenchmarks] :: Package -> !Set Text

-- | names of executables
[packageExes] :: Package -> !Set Text

-- | Args to pass to GHC.
[packageOpts] :: Package -> !GetPackageOpts

-- | Does the package have exposed modules?
[packageHasExposedModules] :: Package -> !Bool

-- | Package build-type.
[packageBuildType] :: Package -> !BuildType

-- | If present: custom-setup dependencies
[packageSetupDeps] :: Package -> !Maybe (Map PackageName VersionRange)

-- | A pair of package descriptions: one which modified the buildable
--   values of test suites and benchmarks depending on whether they are
--   enabled, and one which does not.
--   
--   Fields are intentionally lazy, we may only need one or the other
--   value.
--   
--   MSS 2017-08-29: The very presence of this data type is terribly ugly,
--   it represents the fact that the Cabal 2.0 upgrade did _not_ go well.
--   Specifically, we used to have a field to indicate whether a component
--   was enabled in addition to buildable, but that's gone now, and this is
--   an ugly proxy. We should at some point clean up the mess of Package,
--   LocalPackage, etc, and probably pull in the definition of
--   PackageDescription from Cabal with our additionally needed metadata.
--   But this is a good enough hack for the moment. Odds are, you're
--   reading this in the year 2024 and thinking "wtf?"
data PackageDescriptionPair
PackageDescriptionPair :: PackageDescription -> PackageDescription -> PackageDescriptionPair
[pdpOrigBuildable] :: PackageDescriptionPair -> PackageDescription
[pdpModifiedBuildable] :: PackageDescriptionPair -> PackageDescription

-- | Files that the package depends on, relative to package directory.
--   Argument is the location of the .cabal file
newtype GetPackageFiles
GetPackageFiles :: (forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning])) -> GetPackageFiles
[getPackageFiles] :: GetPackageFiles -> forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning])

-- | Files that the package depends on, relative to package directory.
--   Argument is the location of the .cabal file
newtype GetPackageOpts
GetPackageOpts :: (forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts)) -> GetPackageOpts
[getPackageOpts] :: GetPackageOpts -> forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts)

-- | Package build configuration
data PackageConfig
PackageConfig :: !Bool -> !Bool -> !Map FlagName Bool -> ![Text] -> !CompilerVersion  'CVActual -> !Platform -> PackageConfig

-- | Are tests enabled?
[packageConfigEnableTests] :: PackageConfig -> !Bool

-- | Are benchmarks enabled?
[packageConfigEnableBenchmarks] :: PackageConfig -> !Bool

-- | Configured flags.
[packageConfigFlags] :: PackageConfig -> !Map FlagName Bool

-- | Configured ghc options.
[packageConfigGhcOptions] :: PackageConfig -> ![Text]

-- | GHC version
[packageConfigCompilerVersion] :: PackageConfig -> !CompilerVersion  'CVActual

-- | host platform
[packageConfigPlatform] :: PackageConfig -> !Platform

-- | Path for the package's build log.
buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File)

-- | All exceptions thrown by the library.
data PackageException
PackageInvalidCabalFile :: !Either PackageIdentifierRevision (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PackageException
PackageNoCabalFileFound :: Path Abs Dir -> PackageException
PackageMultipleCabalFilesFound :: Path Abs Dir -> [Path Abs File] -> PackageException
MismatchedCabalName :: Path Abs File -> PackageName -> PackageException
MismatchedCabalIdentifier :: !PackageIdentifierRevision -> !PackageIdentifier -> PackageException

-- | Evaluates the conditions of a <a>GenericPackageDescription</a>,
--   yielding a resolved <a>PackageDescription</a>.
resolvePackageDescription :: PackageConfig -> GenericPackageDescription -> PackageDescriptionPair

-- | Get all dependencies of the package (buildable targets only).
--   
--   Note that for Cabal versions 1.22 and earlier, there is a bug where
--   Cabal requires dependencies for non-buildable components to be
--   present. We're going to use GHC version as a proxy for Cabal library
--   version in this case for simplicity, so we'll check for GHC being 7.10
--   or earlier. This obviously makes our function a lot more fun to
--   write...
packageDependencies :: PackageConfig -> PackageDescription -> Map PackageName VersionRange

-- | Extract the <tt>PackageIdentifier</tt> given an exploded haskell
--   package path.
cabalFilePackageId :: (MonadIO m, MonadThrow m) => Path Abs File -> m PackageIdentifier
gpdPackageIdentifier :: GenericPackageDescription -> PackageIdentifier
gpdPackageName :: GenericPackageDescription -> PackageName
gpdVersion :: GenericPackageDescription -> Version
instance Stack.Types.Config.HasPlatform Stack.Package.Ctx
instance Stack.Types.Config.HasGHCVariant Stack.Package.Ctx
instance RIO.Prelude.Logger.HasLogFunc Stack.Package.Ctx
instance Stack.Types.Runner.HasRunner Stack.Package.Ctx
instance Stack.Types.Config.HasConfig Stack.Package.Ctx
instance Stack.PackageIndex.HasCabalLoader Stack.Package.Ctx
instance RIO.Process.HasProcessContext Stack.Package.Ctx
instance Stack.Types.Config.HasBuildConfig Stack.Package.Ctx
instance Stack.Types.Config.HasEnvConfig Stack.Package.Ctx


module Stack.Sig.Sign

-- | Sign a haskell package with the given url of the signature service and
--   a path to a tarball.
sign :: HasLogFunc env => String -> Path Abs File -> RIO env Signature

-- | Sign a haskell package given the url to the signature service, a
--   <tt>PackageIdentifier</tt> and a file path to the package on disk.
signPackage :: HasLogFunc env => String -> PackageIdentifier -> Path Abs File -> RIO env Signature

-- | Sign a haskell package with the given url to the signature service, a
--   package tarball path (package tarball name) and a lazy bytestring of
--   bytes that represent the tarball bytestream. The function will write
--   the bytes to the path in a temp dir and sign the tarball with GPG.
signTarBytes :: HasLogFunc env => String -> Path Rel File -> ByteString -> RIO env Signature


module Stack.Sig


-- | Deal with downloading, cloning, or whatever else is necessary for
--   getting a <a>PackageLocation</a> into something Stack can work with.
module Stack.PackageLocation

-- | Same as <a>resolveMultiPackageLocation</a>, but works on a
--   <tt>SinglePackageLocation</tt>.
resolveSinglePackageLocation :: HasConfig env => Path Abs Dir -> PackageLocation FilePath -> RIO env (Path Abs Dir)

-- | Resolve a PackageLocation into a path, downloading and cloning as
--   necessary.
--   
--   Returns the updated PackageLocation value with just a single subdir
--   (if relevant).
resolveMultiPackageLocation :: HasConfig env => Path Abs Dir -> PackageLocation Subdirs -> RIO env [(Path Abs Dir, PackageLocation FilePath)]
parseSingleCabalFile :: forall env. HasConfig env => Path Abs Dir -> Bool -> PackageLocation FilePath -> RIO env LocalPackageView

-- | Parse the cabal files present in the given 'PackageLocationIndex
--   FilePath'.
parseSingleCabalFileIndex :: forall env. HasConfig env => Path Abs Dir -> PackageLocationIndex FilePath -> RIO env GenericPackageDescription

-- | Load and parse cabal files into <a>GenericPackageDescription</a>s
parseMultiCabalFiles :: forall env. HasConfig env => Path Abs Dir -> Bool -> PackageLocation Subdirs -> RIO env [LocalPackageView]

-- | <a>parseMultiCabalFiles</a> but supports <a>PLIndex</a>
parseMultiCabalFilesIndex :: forall env. HasConfig env => Path Abs Dir -> PackageLocationIndex Subdirs -> RIO env [(GenericPackageDescription, PackageLocationIndex FilePath)]


-- | Reading in <tt>SnapshotDef</tt>s and converting them into
--   <tt>LoadedSnapshot</tt>s.
module Stack.Snapshot

-- | Convert a <a>Resolver</a> into a <a>SnapshotDef</a>
loadResolver :: forall env. HasConfig env => Resolver -> RIO env SnapshotDef

-- | Fully load up a <a>SnapshotDef</a> into a <a>LoadedSnapshot</a>
loadSnapshot :: forall env. (HasConfig env, HasGHCVariant env) => Maybe (CompilerVersion  'CVActual) -> Path Abs Dir -> SnapshotDef -> RIO env LoadedSnapshot

-- | Given information on a <a>LoadedSnapshot</a> and a given set of
--   additional packages and configuration values, calculates the new
--   global and snapshot packages, as well as the new local packages.
--   
--   The new globals and snapshots must be a subset of the initial values.
calculatePackagePromotion :: forall env localLocation. (HasConfig env, HasGHCVariant env) => Path Abs Dir -> LoadedSnapshot -> [(GenericPackageDescription, SinglePackageLocation, localLocation)] -> Map PackageName (Map FlagName Bool) -> Map PackageName Bool -> Map PackageName [Text] -> Set PackageName -> RIO env (Map PackageName (LoadedPackageInfo GhcPkgId), Map PackageName (LoadedPackageInfo SinglePackageLocation), Map PackageName (LoadedPackageInfo (SinglePackageLocation, Maybe localLocation)))
instance GHC.Exception.Type.Exception Stack.Snapshot.SnapshotException
instance GHC.Show.Show Stack.Snapshot.SnapshotException


-- | The general Stack configuration that starts everything off. This
--   should be smart to falback if there is no stack.yaml, instead relying
--   on whatever files are available.
--   
--   If there is no stack.yaml, and there is a cabal.config, we read in
--   those constraints, and if there's a cabal.sandbox.config, we read any
--   constraints from there and also find the package database from there,
--   etc. And if there's nothing, we should probably default to behaving
--   like cabal, possibly with spitting out a warning that "you should run
--   `stk init` to make things better".
module Stack.Config

-- | An environment with a subset of BuildConfig used for setup.
data MiniConfig

-- | Load the configuration, using current directory, environment
--   variables, and defaults as necessary. The passed <tt>Maybe (Path Abs
--   File)</tt> is an override for the location of the project's
--   stack.yaml.
loadConfig :: HasRunner env => ConfigMonoid -> Maybe AbstractResolver -> StackYamlLoc (Path Abs File) -> RIO env LoadConfig
loadConfigMaybeProject :: HasRunner env => ConfigMonoid -> Maybe AbstractResolver -> LocalConfigStatus (Project, Path Abs File, ConfigMonoid) -> RIO env LoadConfig

-- | Load the <a>MiniConfig</a>.
loadMiniConfig :: Config -> MiniConfig

-- | Load and parse YAML from the given config file. Throws
--   <a>ParseConfigFileException</a> when there's a decoding error.
loadConfigYaml :: HasLogFunc env => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> RIO env a
packagesParser :: Parser [String]

-- | Get packages from EnvConfig, downloading and cloning as necessary. If
--   the packages have already been downloaded, this uses a cached value.
getLocalPackages :: forall env. HasEnvConfig env => RIO env LocalPackages

-- | Get the location of the implicit global project directory. If the
--   directory already exists at the deprecated location, its location is
--   returned. Otherwise, the new location is returned.
getImplicitGlobalProjectDir :: HasLogFunc env => Config -> RIO env (Path Abs Dir)

-- | This is slightly more expensive than <tt><a>asks</a>
--   (<a>bcStackYaml</a> <a>.</a> <tt>getBuildConfig</tt>)</tt> and should
--   only be used when no <a>BuildConfig</a> is at hand.
getStackYaml :: HasConfig env => RIO env (Path Abs File)

-- | Download the <a>Snapshots</a> value from stackage.org.
getSnapshots :: HasConfig env => RIO env Snapshots

-- | Turn an <a>AbstractResolver</a> into a <a>Resolver</a>.
makeConcreteResolver :: HasConfig env => Maybe (Path Abs Dir) -> AbstractResolver -> RIO env Resolver

-- | <tt><a>checkOwnership</a> dir</tt> throws
--   <a>UserDoesn'tOwnDirectory</a> if <tt>dir</tt> isn't owned by the
--   current user.
--   
--   If <tt>dir</tt> doesn't exist, its parent directory is checked
--   instead. If the parent directory doesn't exist either,
--   <tt><a>NoSuchDirectory</a> (<a>parent</a> dir)</tt> is thrown.
checkOwnership :: MonadIO m => Path Abs Dir -> m ()

-- | <a>True</a> if we are currently running inside a Docker container.
getInContainer :: MonadIO m => m Bool

-- | <a>True</a> if we are currently running inside a Nix.
getInNixShell :: MonadIO m => m Bool
defaultConfigYaml :: ByteString

-- | Get the location of the project config file, if it exists.
getProjectConfig :: HasLogFunc env => StackYamlLoc (Path Abs File) -> RIO env (LocalConfigStatus (Path Abs File))
data LocalConfigStatus a
LCSNoProject :: LocalConfigStatus a
LCSProject :: a -> LocalConfigStatus a

-- | parent directory for making a concrete resolving
LCSNoConfig :: !Path Abs Dir -> LocalConfigStatus a
instance Data.Traversable.Traversable Stack.Config.LocalConfigStatus
instance Data.Foldable.Foldable Stack.Config.LocalConfigStatus
instance GHC.Base.Functor Stack.Config.LocalConfigStatus
instance GHC.Show.Show a => GHC.Show.Show (Stack.Config.LocalConfigStatus a)
instance Stack.Types.Config.HasConfig Stack.Config.MiniConfig
instance RIO.Process.HasProcessContext Stack.Config.MiniConfig
instance Stack.PackageIndex.HasCabalLoader Stack.Config.MiniConfig
instance Stack.Types.Config.HasPlatform Stack.Config.MiniConfig
instance Stack.Types.Config.HasGHCVariant Stack.Config.MiniConfig
instance Stack.Types.Runner.HasRunner Stack.Config.MiniConfig
instance RIO.Prelude.Logger.HasLogFunc Stack.Config.MiniConfig


-- | Run commands in a nix-shell
module Stack.Nix

-- | If Nix is enabled, re-runs the currently running OS command in a Nix
--   container. Otherwise, runs the inner action.
reexecWithOptionalShell :: HasConfig env => Maybe (Path Abs Dir) -> IO (CompilerVersion  'CVWanted) -> IO () -> RIO env ()

-- | Command-line argument for "nix"
nixCmdName :: String
nixHelpOptName :: String
instance GHC.Exception.Type.Exception Stack.Nix.StackNixException
instance GHC.Show.Show Stack.Nix.StackNixException

module Stack.Options.NixParser
nixOptsParser :: Bool -> Parser NixOptsMonoid


-- | Make changes to project or global configuration.
module Stack.ConfigCmd
data ConfigCmdSet
ConfigCmdSetResolver :: AbstractResolver -> ConfigCmdSet
ConfigCmdSetSystemGhc :: CommandScope -> Bool -> ConfigCmdSet
ConfigCmdSetInstallGhc :: CommandScope -> Bool -> ConfigCmdSet
configCmdSetParser :: Parser ConfigCmdSet
cfgCmdSet :: (HasConfig env, HasGHCVariant env) => GlobalOpts -> ConfigCmdSet -> RIO env ()
cfgCmdSetName :: String
cfgCmdName :: String


-- | Clean a project.
module Stack.Clean

-- | Deletes build artifacts in the current project.
--   
--   Throws <a>StackCleanException</a>.
clean :: HasEnvConfig env => CleanOpts -> RIO env ()

-- | Options for <tt>stack clean</tt>.
data CleanOpts

-- | Delete the "dist directories" as defined in <a>distRelativeDir</a> for
--   the given local packages. If no packages are given, all project
--   packages should be cleaned.
CleanShallow :: [PackageName] -> CleanOpts

-- | Delete all work directories in the project.
CleanFull :: CleanOpts

-- | Exceptions during cleanup.
newtype StackCleanException
NonLocalPackages :: [PackageName] -> StackCleanException
instance GHC.Show.Show Stack.Clean.StackCleanException
instance GHC.Exception.Type.Exception Stack.Clean.StackCleanException

module Stack.Options.CleanParser

-- | Command-line parser for the clean command.
cleanOptsParser :: Parser CleanOpts


-- | Parsing command line targets
--   
--   There are two relevant data sources for performing this parsing: the
--   project configuration, and command line arguments. Project
--   configurations includes the resolver (defining a LoadedSnapshot of
--   global and snapshot packages), local dependencies, and project
--   packages. It also defines local flag overrides.
--   
--   The command line arguments specify both additional local flag
--   overrides and targets in their raw form.
--   
--   Flags are simple: we just combine CLI flags with config flags and make
--   one big map of flags, preferring CLI flags when present.
--   
--   Raw targets can be a package name, a package name with component, just
--   a component, or a package name and version number. We first must
--   resolve these raw targets into both simple targets and additional
--   dependencies. This works as follows:
--   
--   <ul>
--   <li>If a component is specified, find a unique project package which
--   defines that component, and convert it into a name+component
--   target.</li>
--   <li>Ensure that all name+component values refer to valid components in
--   the given project package.</li>
--   <li>For names, check if the name is present in the snapshot, local
--   deps, or project packages. If it is not, then look up the most recent
--   version in the package index and convert to a name+version.</li>
--   <li>For name+version, first ensure that the name is not used by a
--   project package. Next, if that name+version is present in the snapshot
--   or local deps _and_ its location is PLIndex, we have the package.
--   Otherwise, add to local deps with the appropriate PLIndex.</li>
--   </ul>
--   
--   If in either of the last two bullets we added a package to local deps,
--   print a warning to the user recommending modifying the extra-deps.
--   
--   Combine the various <tt>ResolveResults</tt>s together into
--   <a>Target</a> values, by combining various components for a single
--   package and ensuring that no conflicting statements were made about
--   targets.
--   
--   At this point, we now have a Map from package name to SimpleTarget,
--   and an updated Map of local dependencies. We still have the aggregated
--   flags, and the snapshot and project packages.
--   
--   Finally, we upgrade the snapshot by using calculatePackagePromotion.
module Stack.Build.Target

-- | How a package is intended to be built
data Target

-- | Build all of the default components.
TargetAll :: !PackageType -> Target

-- | Only build specific components
TargetComps :: !Set NamedComponent -> Target

-- | Do we need any targets? For example, `stack build` will fail if no
--   targets are provided.
data NeedTargets
NeedTargets :: NeedTargets
AllowNoTargets :: NeedTargets
data PackageType
ProjectPackage :: PackageType
Dependency :: PackageType
parseTargets :: HasEnvConfig env => NeedTargets -> BuildOptsCLI -> RIO env (LoadedSnapshot, Map PackageName (LoadedPackageInfo (PackageLocationIndex FilePath)), Map PackageName Target)
gpdVersion :: GenericPackageDescription -> Version

-- | If this function returns <tt>Nothing</tt>, the input should be treated
--   as a directory.
parseRawTarget :: Text -> Maybe RawTarget

-- | Raw command line input, without checking against any databases or list
--   of locals. Does not deal with directories
data RawTarget
RTPackageComponent :: !PackageName -> !UnresolvedComponent -> RawTarget
RTComponent :: !ComponentName -> RawTarget
RTPackage :: !PackageName -> RawTarget
RTPackageIdentifier :: !PackageIdentifier -> RawTarget

-- | Either a fully resolved component, or a component name that could be
--   either an executable, test, or benchmark
data UnresolvedComponent
ResolvedComponent :: !NamedComponent -> UnresolvedComponent
UnresolvedComponent :: !ComponentName -> UnresolvedComponent
instance GHC.Show.Show Stack.Build.Target.PackageType
instance GHC.Classes.Eq Stack.Build.Target.PackageType
instance GHC.Classes.Eq Stack.Build.Target.RawTarget
instance GHC.Show.Show Stack.Build.Target.RawTarget
instance GHC.Classes.Ord Stack.Build.Target.UnresolvedComponent
instance GHC.Classes.Eq Stack.Build.Target.UnresolvedComponent
instance GHC.Show.Show Stack.Build.Target.UnresolvedComponent


-- | Functions for IDEs.
module Stack.IDE

-- | List the packages inside the current project.
listPackages :: HasEnvConfig env => RIO env ()

-- | List the targets in the current project.
listTargets :: HasEnvConfig env => RIO env ()


-- | Generate HPC (Haskell Program Coverage) reports
module Stack.Coverage

-- | Invoked at the beginning of running with "--coverage"
deleteHpcReports :: HasEnvConfig env => RIO env ()

-- | Move a tix file into a sub-directory of the hpc report directory.
--   Deletes the old one if one is present.
updateTixFile :: HasEnvConfig env => PackageName -> Path Abs File -> String -> RIO env ()

-- | Generates the HTML coverage report and shows a textual coverage
--   summary for a package.
generateHpcReport :: HasEnvConfig env => Path Abs Dir -> Package -> [Text] -> RIO env ()
data HpcReportOpts
HpcReportOpts :: [Text] -> Bool -> Maybe String -> Bool -> HpcReportOpts
[hroptsInputs] :: HpcReportOpts -> [Text]
[hroptsAll] :: HpcReportOpts -> Bool
[hroptsDestDir] :: HpcReportOpts -> Maybe String
[hroptsOpenBrowser] :: HpcReportOpts -> Bool
generateHpcReportForTargets :: HasEnvConfig env => HpcReportOpts -> RIO env ()
generateHpcUnifiedReport :: HasEnvConfig env => RIO env ()
generateHpcMarkupIndex :: HasEnvConfig env => RIO env ()
instance GHC.Show.Show Stack.Coverage.HpcReportOpts


-- | Resolving a build plan for a set of packages in a given Stackage
--   snapshot.
module Stack.BuildPlan
data BuildPlanException
UnknownPackages :: Path Abs File -> Map PackageName (Maybe Version, Set PackageName) -> Map PackageName (Set PackageIdentifier) -> BuildPlanException
SnapshotNotFound :: SnapName -> BuildPlanException
NeitherCompilerOrResolverSpecified :: Text -> BuildPlanException
data BuildPlanCheck
BuildPlanCheckOk :: Map PackageName (Map FlagName Bool) -> BuildPlanCheck
BuildPlanCheckPartial :: Map PackageName (Map FlagName Bool) -> DepErrors -> BuildPlanCheck
BuildPlanCheckFail :: Map PackageName (Map FlagName Bool) -> DepErrors -> CompilerVersion  'CVActual -> BuildPlanCheck

-- | Check a set of <a>GenericPackageDescription</a>s and a set of flags
--   against a given snapshot. Returns how well the snapshot satisfies the
--   dependencies of the packages.
checkSnapBuildPlan :: (HasConfig env, HasGHCVariant env) => Path Abs Dir -> [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> SnapshotDef -> Maybe (CompilerVersion  'CVActual) -> RIO env BuildPlanCheck
data DepError
DepError :: !Maybe Version -> !Map PackageName VersionRange -> DepError
[deVersion] :: DepError -> !Maybe Version
[deNeededBy] :: DepError -> !Map PackageName VersionRange
type DepErrors = Map PackageName DepError
gpdPackageDeps :: GenericPackageDescription -> CompilerVersion  'CVActual -> Platform -> Map FlagName Bool -> Map PackageName VersionRange
gpdPackages :: [GenericPackageDescription] -> Map PackageName Version
removeSrcPkgDefaultFlags :: [GenericPackageDescription] -> Map PackageName (Map FlagName Bool) -> Map PackageName (Map FlagName Bool)

-- | Find a snapshot and set of flags that is compatible with and matches
--   as best as possible with the given <a>GenericPackageDescription</a>s.
selectBestSnapshot :: (HasConfig env, HasGHCVariant env) => Path Abs Dir -> [GenericPackageDescription] -> NonEmpty SnapName -> RIO env (SnapshotDef, BuildPlanCheck)
showItems :: Show a => [a] -> Text
instance GHC.Show.Show Stack.BuildPlan.DepError
instance GHC.Show.Show Stack.BuildPlan.BuildPlanCheck
instance GHC.Exception.Type.Exception Stack.BuildPlan.BuildPlanException
instance GHC.Show.Show Stack.BuildPlan.BuildPlanException

module Stack.Build.Source

-- | Like <a>loadSourceMapFull</a>, but doesn't return values that aren't
--   as commonly needed.
loadSourceMap :: HasEnvConfig env => NeedTargets -> BuildOptsCLI -> RIO env ([LocalPackage], SourceMap)

-- | Given the build commandline options, does the following:
--   
--   <ul>
--   <li>Parses the build targets.</li>
--   <li>Loads the <a>LoadedSnapshot</a> from the resolver, with extra-deps
--   shadowing any packages that should be built locally.</li>
--   <li>Loads up the <a>LocalPackage</a> info.</li>
--   <li>Builds a <a>SourceMap</a>, which contains info for all the
--   packages that will be involved in the build.</li>
--   </ul>
loadSourceMapFull :: HasEnvConfig env => NeedTargets -> BuildOptsCLI -> RIO env (Map PackageName Target, LoadedSnapshot, [LocalPackage], Set PackageName, SourceMap)
type SourceMap = Map PackageName PackageSource

-- | All flags for a local package.
getLocalFlags :: BuildConfig -> BuildOptsCLI -> PackageName -> Map FlagName Bool

-- | Get the configured options to pass from GHC, based on the build
--   configuration and commandline.
getGhcOptions :: BuildConfig -> BuildOptsCLI -> PackageName -> Bool -> Bool -> [Text]

-- | Returns entries to add to the build cache for any newly found unlisted
--   modules
addUnlistedToBuildCache :: HasEnvConfig env => ModTime -> Package -> Path Abs File -> Set NamedComponent -> Map NamedComponent (Map FilePath a) -> RIO env (Map NamedComponent [Map FilePath FileCacheInfo], [PackageWarning])


-- | Construct a <tt>Plan</tt> for how to build
module Stack.Build.ConstructPlan

-- | Computes a build plan. This means figuring out which build
--   <a>Task</a>s to take, and the interdependencies among the build
--   <a>Task</a>s. In particular:
--   
--   1) It determines which packages need to be built, based on the
--   transitive deps of the current targets. For local packages, this is
--   indicated by the <a>lpWanted</a> boolean. For extra packages to build,
--   this comes from the <tt>extraToBuild0</tt> argument of type <tt>Set
--   PackageName</tt>. These are usually packages that have been specified
--   on the commandline.
--   
--   2) It will only rebuild an upstream package if it isn't present in the
--   <a>InstalledMap</a>, or if some of its dependencies have changed.
--   
--   3) It will only rebuild a local package if its files are dirty or some
--   of its dependencies have changed.
constructPlan :: forall env. HasEnvConfig env => LoadedSnapshot -> BaseConfigOpts -> [LocalPackage] -> Set PackageName -> [DumpPackage () () ()] -> (PackageLocationIndex FilePath -> Map FlagName Bool -> [Text] -> RIO EnvConfig Package) -> SourceMap -> InstalledMap -> Bool -> RIO env Plan
instance GHC.Show.Show Stack.Build.ConstructPlan.DepsPath
instance GHC.Classes.Ord Stack.Build.ConstructPlan.DepsPath
instance GHC.Classes.Eq Stack.Build.ConstructPlan.DepsPath
instance GHC.Generics.Generic Stack.Build.ConstructPlan.W
instance GHC.Show.Show Stack.Build.ConstructPlan.ConstructPlanException
instance GHC.Classes.Ord Stack.Build.ConstructPlan.ConstructPlanException
instance GHC.Classes.Eq Stack.Build.ConstructPlan.ConstructPlanException
instance GHC.Show.Show Stack.Build.ConstructPlan.BadDependency
instance GHC.Classes.Ord Stack.Build.ConstructPlan.BadDependency
instance GHC.Classes.Eq Stack.Build.ConstructPlan.BadDependency
instance GHC.Show.Show Stack.Build.ConstructPlan.ToolWarning
instance GHC.Show.Show Stack.Build.ConstructPlan.AddDepRes
instance GHC.Show.Show Stack.Build.ConstructPlan.PackageInfo
instance GHC.Classes.Ord Distribution.Types.VersionRange.VersionRange
instance Stack.Types.Config.HasPlatform Stack.Build.ConstructPlan.Ctx
instance Stack.Types.Config.HasGHCVariant Stack.Build.ConstructPlan.Ctx
instance RIO.Prelude.Logger.HasLogFunc Stack.Build.ConstructPlan.Ctx
instance Stack.Types.Runner.HasRunner Stack.Build.ConstructPlan.Ctx
instance Stack.Types.Config.HasConfig Stack.Build.ConstructPlan.Ctx
instance Stack.PackageIndex.HasCabalLoader Stack.Build.ConstructPlan.Ctx
instance RIO.Process.HasProcessContext Stack.Build.ConstructPlan.Ctx
instance Stack.Types.Config.HasBuildConfig Stack.Build.ConstructPlan.Ctx
instance Stack.Types.Config.HasEnvConfig Stack.Build.ConstructPlan.Ctx
instance GHC.Base.Semigroup Stack.Build.ConstructPlan.W
instance GHC.Base.Monoid Stack.Build.ConstructPlan.W


-- | Perform a build
module Stack.Build.Execute

-- | Print a description of build plan for human consumption.
printPlan :: HasRunner env => Plan -> RIO env ()

-- | Fetch the packages necessary for a build, for example in combination
--   with a dry run.
preFetch :: HasEnvConfig env => Plan -> RIO env ()

-- | Perform the actual plan
executePlan :: HasEnvConfig env => BuildOptsCLI -> BaseConfigOpts -> [LocalPackage] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> InstalledMap -> Map PackageName Target -> Plan -> RIO env ()
data ExecuteEnv

-- | Execute a function that takes an <a>ExecuteEnv</a>.
withExecuteEnv :: forall env a. HasEnvConfig env => BuildOpts -> BuildOptsCLI -> BaseConfigOpts -> [LocalPackage] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> (ExecuteEnv -> RIO env a) -> RIO env a

-- | This sets up a context for executing build steps which need to run
--   Cabal (via a compiled Setup.hs). In particular it does the following:
--   
--   <ul>
--   <li>Ensures the package exists in the file system, downloading if
--   necessary.</li>
--   <li>Opens a log file if the built output shouldn't go to stderr.</li>
--   <li>Ensures that either a simple Setup.hs is built, or the package's
--   custom setup is built.</li>
--   <li>Provides the user a function with which run the Cabal
--   process.</li>
--   </ul>
withSingleContext :: forall env a. HasEnvConfig env => ActionContext -> ExecuteEnv -> Task -> Maybe (Map PackageIdentifier GhcPkgId) -> Maybe String -> (Package -> Path Abs File -> Path Abs Dir -> (ExcludeTHLoading -> [String] -> RIO env ()) -> (Text -> RIO env ()) -> OutputType -> RIO env a) -> RIO env a
data ExcludeTHLoading
ExcludeTHLoading :: ExcludeTHLoading
KeepTHLoading :: ExcludeTHLoading
instance GHC.Classes.Ord Stack.Build.Execute.ExecutableBuildStatus
instance GHC.Classes.Eq Stack.Build.Execute.ExecutableBuildStatus
instance GHC.Show.Show Stack.Build.Execute.ExecutableBuildStatus


-- | Build the project.
module Stack.Build

-- | Build.
--   
--   If a buildLock is passed there is an important contract here. That
--   lock must protect the snapshot, and it must be safe to unlock it if
--   there are no further modifications to the snapshot to be performed by
--   this build.
build :: HasEnvConfig env => (Set (Path Abs File) -> IO ()) -> Maybe FileLock -> BuildOptsCLI -> RIO env ()

-- | Provide a function for loading package information from the package
--   index
loadPackage :: HasEnvConfig env => PackageLocationIndex FilePath -> Map FlagName Bool -> [Text] -> RIO env Package

-- | Get the <tt>BaseConfigOpts</tt> necessary for constructing configure
--   options
mkBaseConfigOpts :: (MonadIO m, MonadReader env m, HasEnvConfig env, MonadThrow m) => BuildOptsCLI -> m BaseConfigOpts

-- | Query information about the build and print the result to stdout in
--   YAML format.
queryBuildInfo :: HasEnvConfig env => [Text] -> RIO env ()
splitObjsWarning :: String
newtype CabalVersionException
CabalVersionException :: String -> CabalVersionException
[unCabalVersionException] :: CabalVersionException -> String
instance GHC.Show.Show Stack.Build.CabalVersionException
instance GHC.Exception.Type.Exception Stack.Build.CabalVersionException

module Stack.Setup

-- | Modify the environment variables (like PATH) appropriately, possibly
--   doing installation too
setupEnv :: (HasBuildConfig env, HasGHCVariant env) => Maybe Text -> RIO env EnvConfig

-- | Ensure compiler (ghc or ghcjs) is installed and provide the PATHs to
--   add if necessary
ensureCompiler :: (HasConfig env, HasGHCVariant env) => SetupOpts -> RIO env (Maybe ExtraDirs, CompilerBuild, Bool)

-- | Ensure Docker container-compatible <tt>stack</tt> executable is
--   downloaded
ensureDockerStackExe :: HasConfig env => Platform -> RIO env (Path Abs File)

-- | Get the version of the system compiler, if available
getSystemCompiler :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env (Maybe (CompilerVersion  'CVActual, Arch))
getCabalInstallVersion :: (HasProcessContext env, HasLogFunc env) => RIO env (Maybe Version)
data SetupOpts
SetupOpts :: !Bool -> !Bool -> !CompilerVersion  'CVWanted -> !VersionCheck -> !Maybe (Path Abs File) -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe UpgradeTo -> !Maybe Text -> !FilePath -> !Maybe String -> [String] -> SetupOpts
[soptsInstallIfMissing] :: SetupOpts -> !Bool

-- | Should we use a system compiler installation, if available?
[soptsUseSystem] :: SetupOpts -> !Bool
[soptsWantedCompiler] :: SetupOpts -> !CompilerVersion  'CVWanted
[soptsCompilerCheck] :: SetupOpts -> !VersionCheck

-- | If we got the desired GHC version from that file
[soptsStackYaml] :: SetupOpts -> !Maybe (Path Abs File)
[soptsForceReinstall] :: SetupOpts -> !Bool

-- | Run a sanity check on the selected GHC
[soptsSanityCheck] :: SetupOpts -> !Bool

-- | Don't check for a compatible GHC version/architecture
[soptsSkipGhcCheck] :: SetupOpts -> !Bool

-- | Do not use a custom msys installation on Windows
[soptsSkipMsys] :: SetupOpts -> !Bool

-- | Upgrade the global Cabal library in the database to the newest
--   version. Only works reliably with a stack-managed installation.
[soptsUpgradeCabal] :: SetupOpts -> !Maybe UpgradeTo

-- | Message shown to user for how to resolve the missing GHC
[soptsResolveMissingGHC] :: SetupOpts -> !Maybe Text

-- | Location of the main stack-setup.yaml file
[soptsSetupInfoYaml] :: SetupOpts -> !FilePath

-- | Alternate GHC binary distribution (requires custom GHCVariant)
[soptsGHCBindistURL] :: SetupOpts -> !Maybe String

-- | Additional ghcjs-boot options, the default is "--clean"
[soptsGHCJSBootOpts] :: SetupOpts -> [String]

-- | Default location of the stack-setup.yaml file
defaultSetupInfoYaml :: String
removeHaskellEnvVars :: Map Text Text -> Map Text Text
data StackReleaseInfo
getDownloadVersion :: StackReleaseInfo -> Maybe Version

-- | Current Stack version
stackVersion :: Version
preferredPlatforms :: (MonadReader env m, HasPlatform env, MonadThrow m) => m [(Bool, String)]
downloadStackReleaseInfo :: (MonadIO m, MonadThrow m) => Maybe String -> Maybe String -> Maybe String -> m StackReleaseInfo
downloadStackExe :: HasConfig env => [(Bool, String)] -> StackReleaseInfo -> Path Abs Dir -> Bool -> (Path Abs File -> IO ()) -> RIO env ()
instance GHC.Base.Functor (Stack.Setup.CheckDependency env)
instance GHC.Show.Show Stack.Setup.SetupOpts
instance GHC.Base.Applicative (Stack.Setup.CheckDependency env)
instance GHC.Base.Alternative (Stack.Setup.CheckDependency env)
instance GHC.Exception.Type.Exception Stack.Setup.SetupException
instance GHC.Show.Show Stack.Setup.SetupException

module Stack.Upgrade
upgrade :: HasConfig env => ConfigMonoid -> Maybe AbstractResolver -> Maybe String -> UpgradeOpts -> RIO env ()
data UpgradeOpts
upgradeOpts :: Parser UpgradeOpts
instance GHC.Show.Show Stack.Upgrade.UpgradeOpts
instance GHC.Show.Show Stack.Upgrade.SourceOpts
instance GHC.Show.Show Stack.Upgrade.BinaryOpts

module Stack.Solver

-- | Perform some basic checks on a list of cabal files to be used for
--   creating stack config. It checks for duplicate package names, package
--   name and cabal file name mismatch and reports any issues related to
--   those.
--   
--   If no error occurs it returns filepath and
--   <tt>GenericPackageDescription</tt>s pairs as well as any filenames for
--   duplicate packages not included in the pairs.
cabalPackagesCheck :: (HasConfig env, HasGHCVariant env) => [Path Abs Dir] -> String -> Maybe String -> RIO env (Map PackageName (Path Abs File, GenericPackageDescription), [Path Abs File])

-- | Finds all directories with a .cabal file or an hpack package.yaml.
--   Subdirectories can be included depending on the <tt>recurse</tt>
--   parameter.
findCabalDirs :: HasConfig env => Bool -> Path Abs Dir -> RIO env (Set (Path Abs Dir))

-- | Given a resolver (snpashot, compiler or custom resolver) return the
--   compiler version, package versions and packages flags for that
--   resolver.
getResolverConstraints :: (HasConfig env, HasGHCVariant env) => Maybe (CompilerVersion  'CVActual) -> Path Abs File -> SnapshotDef -> RIO env (CompilerVersion  'CVActual, Map PackageName (Version, Map FlagName Bool))

-- | Merge two separate maps, one defining constraints on package versions
--   and the other defining package flagmap, into a single map of version
--   and flagmap tuples.
mergeConstraints :: Map PackageName v -> Map PackageName (Map p f) -> Map PackageName (v, Map p f)

-- | Verify the combination of resolver, package flags and extra
--   dependencies in an existing stack.yaml and suggest changes in flags or
--   extra dependencies so that the specified packages can be compiled.
solveExtraDeps :: HasEnvConfig env => Bool -> RIO env ()

-- | Given a resolver, user package constraints (versions and flags) and
--   extra dependency constraints determine what extra dependencies are
--   required outside the resolver snapshot and the specified extra
--   dependencies.
--   
--   First it tries by using the snapshot and the input extra dependencies
--   as hard constraints, if no solution is arrived at by using hard
--   constraints it then tries using them as soft constraints or
--   preferences.
--   
--   It returns either conflicting packages when no solution is arrived at
--   or the solution in terms of src package flag settings and extra
--   dependencies.
solveResolverSpec :: (HasConfig env, HasGHCVariant env) => Path Abs File -> [Path Abs Dir] -> (SnapshotDef, ConstraintSpec, ConstraintSpec) -> RIO env (Either [PackageName] (ConstraintSpec, ConstraintSpec))

-- | Same as <tt>checkSnapBuildPLan</tt>, but set up a real GHC if needed.
--   
--   If we're using a Stackage snapshot, we can use the snapshot hints to
--   determine global library information. This will not be available for
--   custom and GHC resolvers, however. Therefore, we insist that it be
--   installed first. Fortunately, the standard `stack solver` behavior
--   only chooses Stackage snapshots, so the common case will not force the
--   installation of a bunch of GHC versions.
checkSnapBuildPlanActual :: (HasConfig env, HasGHCVariant env) => Path Abs Dir -> [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> SnapshotDef -> RIO env BuildPlanCheck
parseCabalOutputLine :: Text -> Either Text (PackageName, (Version, Map FlagName Bool))
instance GHC.Classes.Eq Stack.Solver.ConstraintType

module Stack.Init

-- | Generate stack.yaml
initProject :: (HasConfig env, HasGHCVariant env) => WhichSolverCmd -> Path Abs Dir -> InitOpts -> Maybe AbstractResolver -> RIO env ()
data InitOpts
InitOpts :: ![Text] -> Bool -> Bool -> Bool -> Bool -> InitOpts

-- | List of sub directories to search for .cabal files
[searchDirs] :: InitOpts -> ![Text]

-- | Use solver to determine required external dependencies
[useSolver] :: InitOpts -> Bool

-- | Exclude conflicting or incompatible user packages
[omitPackages] :: InitOpts -> Bool

-- | Overwrite existing stack.yaml
[forceOverwrite] :: InitOpts -> Bool

-- | If True, include all .cabal files found in any sub directories
[includeSubDirs] :: InitOpts -> Bool


-- | Install GHC/GHCJS and Cabal.
module Stack.SetupCmd
setup :: (HasConfig env, HasGHCVariant env) => SetupCmdOpts -> CompilerVersion  'CVWanted -> VersionCheck -> Maybe (Path Abs File) -> RIO env ()
setupParser :: Parser SetupCmdOpts
data SetupCmdOpts
SetupCmdOpts :: !Maybe (CompilerVersion  'CVWanted) -> !Bool -> !Maybe UpgradeTo -> !String -> !Maybe String -> ![String] -> !Bool -> SetupCmdOpts
[scoCompilerVersion] :: SetupCmdOpts -> !Maybe (CompilerVersion  'CVWanted)
[scoForceReinstall] :: SetupCmdOpts -> !Bool
[scoUpgradeCabal] :: SetupCmdOpts -> !Maybe UpgradeTo
[scoSetupInfoYaml] :: SetupCmdOpts -> !String
[scoGHCBindistURL] :: SetupCmdOpts -> !Maybe String
[scoGHCJSBootOpts] :: SetupCmdOpts -> ![String]
[scoGHCJSBootClean] :: SetupCmdOpts -> !Bool


-- | Run commands in Docker containers
module Stack.Docker

-- | Clean-up old docker images and containers.
cleanup :: HasConfig env => CleanupOpts -> RIO env ()

-- | Options for <a>cleanup</a>.
data CleanupOpts
CleanupOpts :: !CleanupAction -> !Maybe Integer -> !Maybe Integer -> !Maybe Integer -> !Maybe Integer -> !Maybe Integer -> CleanupOpts
[dcAction] :: CleanupOpts -> !CleanupAction
[dcRemoveKnownImagesLastUsedDaysAgo] :: CleanupOpts -> !Maybe Integer
[dcRemoveUnknownImagesCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer
[dcRemoveDanglingImagesCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer
[dcRemoveStoppedContainersCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer
[dcRemoveRunningContainersCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer

-- | Cleanup action.
data CleanupAction
CleanupInteractive :: CleanupAction
CleanupImmediate :: CleanupAction
CleanupDryRun :: CleanupAction

-- | Command-line argument for <tt>docker cleanup</tt>.
dockerCleanupCmdName :: String

-- | Command-line argument for "docker"
dockerCmdName :: String
dockerHelpOptName :: String

-- | Command-line argument for <tt>docker pull</tt>.
dockerPullCmdName :: String

-- | The Docker container "entrypoint": special actions performed when
--   first entering a container, such as switching the UID/GID to the
--   "outside-Docker" user's.
entrypoint :: (HasProcessContext env, HasLogFunc env) => Config -> DockerEntrypoint -> RIO env ()

-- | Error if running in a container.
preventInContainer :: MonadIO m => m () -> m ()

-- | Pull latest version of configured Docker image from registry.
pull :: HasConfig env => RIO env ()

-- | If Docker is enabled, re-runs the currently running OS command in a
--   Docker container. Otherwise, runs the inner action.
--   
--   This takes an optional release action which should be taken IFF
--   control is transferring away from the current process to the
--   intra-container one. The main use for this is releasing a lock. After
--   launching reexecution, the host process becomes nothing but an manager
--   for the call into docker and thus may not hold the lock.
reexecWithOptionalContainer :: HasConfig env => Maybe (Path Abs Dir) -> Maybe (RIO env ()) -> IO () -> Maybe (RIO env ()) -> Maybe (RIO env ()) -> RIO env ()

-- | Remove the project's Docker sandbox.
reset :: (MonadIO m, MonadReader env m, HasConfig env) => Maybe (Path Abs Dir) -> Bool -> m ()

-- | Command-line option for <tt>--internal-re-exec-version</tt>.
reExecArgName :: String

-- | Exceptions thrown by Stack.Docker.
data StackDockerException

-- | Docker must be enabled to use the command.
DockerMustBeEnabledException :: StackDockerException

-- | Command must be run on host OS (not in a container).
OnlyOnHostException :: StackDockerException

-- | <tt>docker inspect</tt> failed.
InspectFailedException :: String -> StackDockerException

-- | Image does not exist.
NotPulledException :: String -> StackDockerException

-- | Input to <tt>docker cleanup</tt> has invalid command.
InvalidCleanupCommandException :: String -> StackDockerException

-- | Invalid output from <tt>docker images</tt>.
InvalidImagesOutputException :: String -> StackDockerException

-- | Invalid output from <tt>docker ps</tt>.
InvalidPSOutputException :: String -> StackDockerException

-- | Invalid output from <tt>docker inspect</tt>.
InvalidInspectOutputException :: String -> StackDockerException

-- | Could not pull a Docker image.
PullFailedException :: String -> StackDockerException

-- | Installed version of <tt>docker</tt> below minimum version.
DockerTooOldException :: Version -> Version -> StackDockerException

-- | Installed version of <tt>docker</tt> is prohibited.
DockerVersionProhibitedException :: [Version] -> Version -> StackDockerException

-- | Installed version of <tt>docker</tt> is out of range specified in
--   config file.
BadDockerVersionException :: VersionRange -> Version -> StackDockerException

-- | Invalid output from <tt>docker --version</tt>.
InvalidVersionOutputException :: StackDockerException

-- | Version of <tt>stack</tt> on host is too old for version in image.
HostStackTooOldException :: Version -> Maybe Version -> StackDockerException

-- | Version of <tt>stack</tt> in container/image is too old for version on
--   host.
ContainerStackTooOldException :: Version -> Version -> StackDockerException

-- | Can't determine the project root (where to put docker sandbox).
CannotDetermineProjectRootException :: StackDockerException

-- | <tt>docker --version</tt> failed.
DockerNotInstalledException :: StackDockerException

-- | Using host stack-exe on unsupported platform.
UnsupportedStackExeHostPlatformException :: StackDockerException

-- | <tt>stack-exe</tt> option fails to parse.
DockerStackExeParseException :: String -> StackDockerException
instance GHC.Show.Show Stack.Docker.Inspect
instance GHC.Show.Show Stack.Docker.ImageConfig
instance GHC.Show.Show Stack.Docker.CleanupOpts
instance GHC.Show.Show Stack.Docker.CleanupAction
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Docker.Inspect
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Docker.ImageConfig

module Stack.Options.DockerParser

-- | Options parser configuration for Docker.
dockerOptsParser :: Bool -> Parser DockerOptsMonoid

-- | Parser for docker cleanup arguments.
dockerCleanupOptsParser :: Parser CleanupOpts

module Stack.SDist

-- | Given the path to a local package, creates its source distribution
--   tarball.
--   
--   While this yields a <a>FilePath</a>, the name of the tarball, this
--   tarball is not written to the disk and instead yielded as a lazy
--   bytestring.
getSDistTarball :: HasEnvConfig env => Maybe PvpBounds -> Path Abs Dir -> RIO env (FilePath, ByteString, Maybe (PackageIdentifier, ByteString))

-- | Check package in given tarball. This will log all warnings and will
--   throw an exception in case of critical errors.
--   
--   Note that we temporarily decompress the archive to analyze it.
checkSDistTarball :: HasEnvConfig env => SDistOpts -> Path Abs File -> RIO env ()

-- | Version of <a>checkSDistTarball</a> that first saves lazy bytestring
--   to temporary directory and then calls <a>checkSDistTarball</a> on it.
checkSDistTarball' :: HasEnvConfig env => SDistOpts -> String -> ByteString -> RIO env ()

-- | Special exception to throw when you want to fail because of bad
--   results of package check.
data SDistOpts
SDistOpts :: [String] -> Maybe PvpBounds -> Bool -> Bool -> String -> Bool -> Maybe FilePath -> SDistOpts

-- | Directories to package
[sdoptsDirsToWorkWith] :: SDistOpts -> [String]

-- | PVP Bounds overrides
[sdoptsPvpBounds] :: SDistOpts -> Maybe PvpBounds

-- | Whether to ignore check of the package for common errors
[sdoptsIgnoreCheck] :: SDistOpts -> Bool

-- | Whether to sign the package
[sdoptsSign] :: SDistOpts -> Bool

-- | The URL of the signature server
[sdoptsSignServerUrl] :: SDistOpts -> String

-- | Whether to build the tarball
[sdoptsBuildTarball] :: SDistOpts -> Bool

-- | Where to copy the tarball
[sdoptsTarPath] :: SDistOpts -> Maybe FilePath
instance GHC.Exception.Type.Exception Stack.SDist.CheckException
instance GHC.Show.Show Stack.SDist.CheckException

module Stack.Options.BuildMonoidParser
buildOptsMonoidParser :: GlobalOptsContext -> Parser BuildOptsMonoid

module Stack.Options.ConfigParser

-- | Command-line arguments parser for configuration.
configOptsParser :: FilePath -> GlobalOptsContext -> Parser ConfigMonoid

module Stack.Options.GlobalParser

-- | Parser for global command-line options.
globalOptsParser :: FilePath -> GlobalOptsContext -> Maybe LogLevel -> Parser GlobalOptsMonoid

-- | Create GlobalOpts from GlobalOptsMonoid.
globalOptsFromMonoid :: Bool -> ColorWhen -> GlobalOptsMonoid -> GlobalOpts
initOptsParser :: Parser InitOpts

module Stack.Options.NewParser

-- | Parser for <tt>stack new</tt>.
newOptsParser :: Parser (NewOpts, InitOpts)


-- | Run a GHCi configured with the user's package(s).
module Stack.Ghci

-- | Command-line options for GHC.
data GhciOpts
GhciOpts :: ![Text] -> ![String] -> ![Text] -> !Map (Maybe PackageName) (Map FlagName Bool) -> !Maybe FilePath -> !Bool -> ![String] -> !Maybe Text -> !Bool -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> GhciOpts
[ghciTargets] :: GhciOpts -> ![Text]
[ghciArgs] :: GhciOpts -> ![String]
[ghciGhcOptions] :: GhciOpts -> ![Text]
[ghciFlags] :: GhciOpts -> !Map (Maybe PackageName) (Map FlagName Bool)
[ghciGhcCommand] :: GhciOpts -> !Maybe FilePath
[ghciNoLoadModules] :: GhciOpts -> !Bool
[ghciAdditionalPackages] :: GhciOpts -> ![String]
[ghciMainIs] :: GhciOpts -> !Maybe Text
[ghciLoadLocalDeps] :: GhciOpts -> !Bool
[ghciSkipIntermediate] :: GhciOpts -> !Bool
[ghciHidePackages] :: GhciOpts -> !Maybe Bool
[ghciNoBuild] :: GhciOpts -> !Bool
[ghciOnlyMain] :: GhciOpts -> !Bool

-- | Necessary information to load a package or its components.
data GhciPkgInfo
GhciPkgInfo :: !PackageName -> ![(NamedComponent, BuildInfoOpts)] -> !Path Abs Dir -> !ModuleMap -> !Set (Path Abs File) -> !Map NamedComponent (Set (Path Abs File)) -> !Maybe (Set (Path Abs File)) -> !Package -> GhciPkgInfo
[ghciPkgName] :: GhciPkgInfo -> !PackageName
[ghciPkgOpts] :: GhciPkgInfo -> ![(NamedComponent, BuildInfoOpts)]
[ghciPkgDir] :: GhciPkgInfo -> !Path Abs Dir
[ghciPkgModules] :: GhciPkgInfo -> !ModuleMap

-- | C files.
[ghciPkgCFiles] :: GhciPkgInfo -> !Set (Path Abs File)
[ghciPkgMainIs] :: GhciPkgInfo -> !Map NamedComponent (Set (Path Abs File))
[ghciPkgTargetFiles] :: GhciPkgInfo -> !Maybe (Set (Path Abs File))
[ghciPkgPackage] :: GhciPkgInfo -> !Package
data GhciException
InvalidPackageOption :: String -> GhciException
LoadingDuplicateModules :: GhciException
MissingFileTarget :: String -> GhciException
Can'tSpecifyFilesAndTargets :: GhciException
Can'tSpecifyFilesAndMainIs :: GhciException
GhciTargetParseException :: [Text] -> GhciException

-- | Launch a GHCi session for the given local package targets with the
--   given options and configure it with the load paths and extensions of
--   those targets.
ghci :: HasEnvConfig env => GhciOpts -> RIO env ()
instance GHC.Show.Show Stack.Ghci.GhciPkgInfo
instance GHC.Show.Show Stack.Ghci.GhciOpts
instance GHC.Exception.Type.Exception Stack.Ghci.GhciException
instance GHC.Show.Show Stack.Ghci.GhciException

module Stack.Dot

-- | Visualize the project's dependencies as a graphviz graph
dot :: HasEnvConfig env => DotOpts -> RIO env ()
listDependencies :: HasEnvConfig env => ListDepsOpts -> RIO env ()

-- | Options record for <tt>stack dot</tt>
data DotOpts
DotOpts :: !Bool -> !Bool -> !Maybe Int -> !Set String -> [Text] -> !Map (Maybe PackageName) (Map FlagName Bool) -> Bool -> Bool -> DotOpts

-- | Include external dependencies
[dotIncludeExternal] :: DotOpts -> !Bool

-- | Include dependencies on base
[dotIncludeBase] :: DotOpts -> !Bool

-- | Limit the depth of dependency resolution to (Just n) or continue until
--   fixpoint
[dotDependencyDepth] :: DotOpts -> !Maybe Int

-- | Package names to prune from the graph
[dotPrune] :: DotOpts -> !Set String

-- | stack TARGETs to trace dependencies for
[dotTargets] :: DotOpts -> [Text]

-- | Flags to apply when calculating dependencies
[dotFlags] :: DotOpts -> !Map (Maybe PackageName) (Map FlagName Bool)

-- | Like the "--test" flag for build, affects the meaning of
--   <a>dotTargets</a>.
[dotTestTargets] :: DotOpts -> Bool

-- | Like the "--bench" flag for build, affects the meaning of
--   <a>dotTargets</a>.
[dotBenchTargets] :: DotOpts -> Bool

-- | Information about a package in the dependency graph, when available.
data DotPayload
DotPayload :: Maybe Version -> Maybe (Either License License) -> DotPayload

-- | The package version.
[payloadVersion] :: DotPayload -> Maybe Version

-- | The license the package was released under.
[payloadLicense] :: DotPayload -> Maybe (Either License License)
data ListDepsOpts
ListDepsOpts :: !DotOpts -> !Text -> !Bool -> ListDepsOpts

-- | The normal dot options.
[listDepsDotOpts] :: ListDepsOpts -> !DotOpts

-- | Separator between the package name and details.
[listDepsSep] :: ListDepsOpts -> !Text

-- | Print dependency licenses instead of versions.
[listDepsLicense] :: ListDepsOpts -> !Bool

-- | Resolve the dependency graph up to (Just depth) or until fixpoint is
--   reached
resolveDependencies :: (Applicative m, Monad m) => Maybe Int -> Map PackageName (Set PackageName, DotPayload) -> (PackageName -> m (Set PackageName, DotPayload)) -> m (Map PackageName (Set PackageName, DotPayload))

-- | Print a graphviz graph of the edges in the Map and highlight the given
--   local packages
printGraph :: (Applicative m, MonadIO m) => DotOpts -> Set PackageName -> Map PackageName (Set PackageName, DotPayload) -> m ()

-- | <tt>pruneGraph dontPrune toPrune graph</tt> prunes all packages in
--   <tt>graph</tt> with a name in <tt>toPrune</tt> and removes resulting
--   orphans unless they are in <tt>dontPrune</tt>
pruneGraph :: (Foldable f, Foldable g, Eq a) => f PackageName -> g String -> Map PackageName (Set PackageName, a) -> Map PackageName (Set PackageName, a)
instance GHC.Show.Show Stack.Dot.DotPayload
instance GHC.Classes.Eq Stack.Dot.DotPayload


-- | Utilities for running stack commands.
module Stack.Runners

-- | Loads global config, ignoring any configuration which would be loaded
--   due to $PWD.
withGlobalConfigAndLock :: GlobalOpts -> RIO Config () -> IO ()
withConfigAndLock :: GlobalOpts -> RIO Config () -> IO ()
withMiniConfigAndLock :: GlobalOpts -> RIO MiniConfig () -> IO ()
withBuildConfigAndLock :: GlobalOpts -> (Maybe FileLock -> RIO EnvConfig ()) -> IO ()

-- | See issue #2010 for why this exists. Currently just used for the
--   specific case of "stack clean --full".
withBuildConfigAndLockNoDocker :: GlobalOpts -> (Maybe FileLock -> RIO EnvConfig ()) -> IO ()
withBuildConfig :: GlobalOpts -> RIO EnvConfig () -> IO ()
withBuildConfigExt :: Bool -> GlobalOpts -> Maybe (RIO Config ()) -> (Maybe FileLock -> RIO EnvConfig ()) -> Maybe (RIO Config ()) -> IO ()
withBuildConfigDot :: DotOpts -> GlobalOpts -> RIO EnvConfig () -> IO ()

-- | Load the configuration. Convenience function used throughout this
--   module.
loadConfigWithOpts :: GlobalOpts -> (LoadConfig -> IO a) -> IO a
loadCompilerVersion :: GlobalOpts -> LoadConfig -> IO (CompilerVersion  'CVWanted)

-- | Enforce mutual exclusion of every action running via this function, on
--   this path, on this users account.
--   
--   A lock file is created inside the given directory. Currently, stack
--   uses locks per-snapshot. In the future, stack may refine this to an
--   even more fine-grain locking approach.
withUserFileLock :: MonadUnliftIO m => GlobalOpts -> Path Abs Dir -> (Maybe FileLock -> m a) -> m a

-- | Unlock a lock file, if the value is Just
munlockFile :: MonadIO m => Maybe FileLock -> m ()

module Stack.Options.Completion
ghcOptsCompleter :: Completer
targetCompleter :: Completer
flagCompleter :: Completer
projectExeCompleter :: Completer

module Stack.Options.ScriptParser
data ScriptOpts
ScriptOpts :: ![String] -> !FilePath -> ![String] -> !ScriptExecute -> ![String] -> ScriptOpts
[soPackages] :: ScriptOpts -> ![String]
[soFile] :: ScriptOpts -> !FilePath
[soArgs] :: ScriptOpts -> ![String]
[soCompile] :: ScriptOpts -> !ScriptExecute
[soGhcOptions] :: ScriptOpts -> ![String]
data ScriptExecute
SEInterpret :: ScriptExecute
SECompile :: ScriptExecute
SEOptimize :: ScriptExecute
scriptOptsParser :: Parser ScriptOpts
instance GHC.Show.Show Stack.Options.ScriptParser.ScriptOpts
instance GHC.Show.Show Stack.Options.ScriptParser.ScriptExecute

module Stack.Script

-- | Run a Stack Script
scriptCmd :: ScriptOpts -> GlobalOpts -> IO ()

module Stack.Options.HpcReportParser

-- | Parser for <tt>stack hpc report</tt>.
hpcReportOptsParser :: Parser HpcReportOpts
pvpBoundsOption :: Parser PvpBounds

module Stack.Options.SDistParser

-- | Parser for arguments to `stack sdist` and `stack upload`
sdistOptsParser :: Bool -> Parser SDistOpts

module Stack.Options.ExecParser

-- | Parser for exec command
execOptsParser :: Maybe SpecialExecCmd -> Parser ExecOpts
evalOptsParser :: String -> Parser EvalOpts

-- | Parser for extra options to exec command
execOptsExtraParser :: Parser ExecOptsExtra

module Stack.Options.BuildParser

-- | Parser for CLI-only build arguments
buildOptsParser :: BuildCommand -> Parser BuildOptsCLI
targetsParser :: Parser [Text]
flagsParser :: Parser (Map (Maybe PackageName) (Map FlagName Bool))

module Stack.Options.GhciParser

-- | Parser for GHCI options
ghciOptsParser :: Parser GhciOpts


-- | A wrapper around hoogle.
module Stack.Hoogle

-- | Hoogle command.
hoogleCmd :: ([String], Bool, Bool, Bool) -> GlobalOpts -> IO ()

module Stack.Options.DotParser

-- | Parser for arguments to `stack dot`
dotOptsParser :: Bool -> Parser DotOpts

-- | Parser for arguments to `stack list-dependencies`.
listDepsOptsParser :: Parser ListDepsOpts

module Stack.Ls
lsCmd :: LsCmdOpts -> GlobalOpts -> IO ()
lsParser :: Parser LsCmdOpts

-- | List the dependencies
listDependenciesCmd :: Bool -> ListDepsOpts -> GlobalOpts -> IO ()
instance GHC.Show.Show Stack.Ls.LsException
instance GHC.Classes.Ord Stack.Ls.SnapshotData
instance GHC.Classes.Eq Stack.Ls.SnapshotData
instance GHC.Show.Show Stack.Ls.SnapshotData
instance GHC.Classes.Ord Stack.Ls.Snapshot
instance GHC.Classes.Eq Stack.Ls.Snapshot
instance GHC.Show.Show Stack.Ls.Snapshot
instance GHC.Classes.Ord Stack.Ls.SnapshotOpts
instance GHC.Show.Show Stack.Ls.SnapshotOpts
instance GHC.Classes.Eq Stack.Ls.SnapshotOpts
instance GHC.Classes.Ord Stack.Ls.SnapshotType
instance GHC.Classes.Eq Stack.Ls.SnapshotType
instance GHC.Show.Show Stack.Ls.SnapshotType
instance GHC.Classes.Ord Stack.Ls.LsView
instance GHC.Classes.Eq Stack.Ls.LsView
instance GHC.Show.Show Stack.Ls.LsView
instance GHC.Exception.Type.Exception Stack.Ls.LsException
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Ls.SnapshotData
instance Data.Aeson.Types.FromJSON.FromJSON Stack.Ls.Snapshot
