-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | The Haskell Tool Stack -- -- Please see the documentation at https://docs.haskellstack.org -- for usage information. -- -- If building a stack executable for distribution, please -- download the source code from -- https://github.com/commercialhaskell/stack/releases and build -- it using Stack itself in order to ensure identical behaviour to -- official binaries. This package on Hackage is provided for convenience -- and bootstrapping purposes. -- -- 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 2.15.1 module Build_stack deps :: [String] module Codec.Archive.Tar.Utf8 -- | Tar archive entry. data () => Entry -- | A tar archive is a sequence of entries. -- -- The point of this type as opposed to just using a list is that it -- makes the failure case explicit. We need this because the sequence of -- entries we get from reading a tarball can include errors. -- -- It is a concrete data type so you can manipulate it directly but it is -- often clearer to use the provided functions for mapping, folding and -- unfolding. -- -- Converting from a list can be done with just foldr Next Done. -- Converting back into a list can be done with foldEntries -- however in that case you must be prepared to handle the Fail -- case inherent in the Entries type. -- -- The Monoid instance lets you concatenate archives or append -- entries to an archive. data () => Entries e Next :: Entry -> Entries e -> Entries e Done :: Entries e Fail :: e -> Entries e infixr 5 `Next` -- | The content of a tar archive entry, which depends on the type of -- entry. -- -- Portable archives should contain only NormalFile and -- Directory. data () => EntryContent NormalFile :: ByteString -> {-# UNPACK #-} !FileSize -> EntryContent Directory :: EntryContent SymbolicLink :: !LinkTarget -> EntryContent HardLink :: !LinkTarget -> EntryContent CharacterDevice :: {-# UNPACK #-} !DevMajor -> {-# UNPACK #-} !DevMinor -> EntryContent BlockDevice :: {-# UNPACK #-} !DevMajor -> {-# UNPACK #-} !DevMinor -> EntryContent NamedPipe :: EntryContent OtherEntryType :: {-# UNPACK #-} !TypeCode -> ByteString -> {-# UNPACK #-} !FileSize -> EntryContent -- | Errors that can be encountered when parsing a Tar archive. data () => FormatError TruncatedArchive :: FormatError ShortTrailer :: FormatError BadTrailer :: FormatError TrailingJunk :: FormatError ChecksumIncorrect :: FormatError NotTarFormat :: FormatError UnrecognisedTarFormat :: FormatError HeaderBadNumericEncoding :: FormatError -- | Creates a tar archive from a list of directory or files. Any -- directories specified will have their contents included recursively. -- Paths in the archive will be relative to the given base directory. -- -- This is a portable implementation of packing suitable for portable -- archives. In particular it only constructs NormalFile and -- Directory entries. Hard links and symbolic links are treated -- like ordinary files. It cannot be used to pack directories containing -- recursive symbolic links. Special files like FIFOs (named pipes), -- sockets or device files will also cause problems. -- -- An exception will be thrown for any file names that are too long to -- represent as a TarPath. -- --
-- $ tar -f tarball.tar -C base -c dir ---- -- This assumes a directory ./base/dir with files inside, eg -- ./base/dir/foo.txt. The file names inside the resulting tar -- file will be relative to dir, eg dir/foo.txt. -- -- This is a high level "all in one" operation. Since you may need -- variations on this function it is instructive to see how it is -- written. It is just: -- --
-- BS.writeFile tar . Tar.write =<< Tar.pack base paths ---- -- Notes: -- -- The files and directories must not change during this operation or the -- result is not well defined. -- -- The intention of this function is to create tarballs that are portable -- between systems. It is not suitable for doing file system -- backups because file ownership and permissions are not fully -- preserved. File ownership is not preserved at all. File permissions -- are set to simple portable values: -- --
-- $ tar -x -f tarball.tar -C dir ---- -- So for example if the tarball.tar file contains -- foo/bar.txt then this will extract it to -- dir/foo/bar.txt. -- -- This is a high level "all in one" operation. Since you may need -- variations on this function it is instructive to see how it is -- written. It is just: -- --
-- Tar.unpack dir . Tar.read =<< BS.readFile tar ---- -- Notes: -- -- Extracting can fail for a number of reasons. The tarball may be -- incorrectly formatted. There may be IO or permission errors. In such -- cases an exception will be thrown and extraction will not continue. -- -- Since the extraction may fail part way through it is not atomic. For -- this reason you may want to extract into an empty directory and, if -- the extraction fails, recursively delete the directory. -- -- Security: only files inside the target directory will be written. -- Tarballs containing entries that point outside of the tarball (either -- absolute paths or relative paths) will be caught and an exception will -- be thrown. extract :: FilePath -> FilePath -> IO () -- | This is like the standard unfoldr function on lists, but for -- Entries. It includes failure as an extra possibility that the -- stepper function may return. -- -- It can be used to generate Entries from some other type. For -- example it is used internally to lazily unfold entries from a -- ByteString. unfoldEntries :: (a -> Either e (Maybe (Entry, a))) -> a -> Entries e -- | This is like the standard foldr function on lists, but for -- Entries. Compared to foldr it takes an extra function to -- account for the possibility of failure. -- -- This is used to consume a sequence of entries. For example it could be -- used to scan a tarball for problems or to collect an index of the -- contents. foldEntries :: (Entry -> a -> a) -> a -> (e -> a) -> Entries e -> a -- | A foldl-like function on Entries. It either returns the final -- accumulator result, or the failure along with the intermediate -- accumulator value. foldlEntries :: (a -> Entry -> a) -> a -> Entries e -> Either (e, a) a -- | This is like the standard map function on lists, but for -- Entries. It includes failure as a extra possible outcome of the -- mapping function. -- -- If your mapping function cannot fail it may be more convenient to use -- mapEntriesNoFail mapEntries :: (Entry -> Either e' Entry) -> Entries e -> Entries (Either e e') -- | Like mapEntries but the mapping function itself cannot fail. mapEntriesNoFail :: (Entry -> Entry) -> Entries e -> Entries e -- | Native FilePath of the file or directory within the archive. -- -- Assumes that the TarPath of an Entry is UTF8 encoded. entryPath :: Entry -> FilePath -- | Create local files and directories based on the entries of a tar -- archive. -- -- This is a portable implementation of unpacking suitable for portable -- archives. It handles NormalFile and Directory entries -- and has simulated support for SymbolicLink and HardLink -- entries. Links are implemented by copying the target file. This -- therefore works on Windows as well as Unix. All other entry types are -- ignored, that is they are not unpacked and no exception is raised. -- -- If the Entries ends in an error then it is raised an an -- exception. Any files or directories that have been unpacked before the -- error was encountered will not be deleted. For this reason you may -- want to unpack into an empty directory so that you can easily clean up -- if unpacking fails part-way. -- -- On its own, this function only checks for security (using -- checkSecurity). You can do other checks by applying checking -- functions to the Entries that you pass to this function. For -- example: -- --
-- unpack dir (checkTarbomb expectedDir entries) ---- -- If you care about the priority of the reported errors then you may -- want to use checkSecurity before checkTarbomb or other -- checks. -- -- Assumes that the TarPath of an Entry is UTF8 encoded. unpack :: Exception e => FilePath -> Entries e -> IO () -- | Wrapper functions of Simple and Client 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 LByteString) httpNoBody :: MonadIO m => Request -> m (Response ()) httpSink :: MonadUnliftIO m => Request -> (Response () -> ConduitM ByteString Void m a) -> m a withResponse :: (MonadUnliftIO m, MonadIO n) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a -- | Modify the request so that non-2XX status codes generate a runtime -- StatusCodeException, by using throwErrorStatusCodes setRequestCheckStatus :: Request -> Request -- | 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 -- | Set the request headers, wiping out all previously set headers. -- This means if you use setRequestHeaders to set some headers and -- also use one of the other setters that modifies the -- content-type header (such as setRequestBodyJSON), be -- sure that setRequestHeaders is evaluated first. setRequestHeaders :: RequestHeaders -> Request -> Request -- | Add a request header name/value combination addRequestHeader :: HeaderName -> ByteString -> Request -> Request -- | Set the request body to the given RequestBody. You may want to -- consider using one of the convenience functions in the modules, e.g. -- requestBodyJSON. -- -- Note: This will not modify the request method. For that, please -- use requestMethod. You likely don't want the default of -- GET. setRequestBody :: RequestBody -> 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 -- | Convert a URL into a Request. -- -- This function defaults some of the values in Request, such as -- setting method to GET and requestHeaders -- to []. -- -- Since this function uses MonadThrow, the return monad can be -- anything that is an instance of MonadThrow, such as IO -- or Maybe. -- -- You can place the request method at the beginning of the URL separated -- by a space, e.g.: -- --
-- parseRequest "POST http://httpbin.org/post" ---- -- Note that the request method must be provided as all capital letters. -- -- A Request 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 -- parseUrlThrow parseRequest :: MonadThrow m => String -> m Request -- | Extract a URI 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 -- checkStatus, but was renamed to avoid confusion about the new -- default behavior (doing nothing). checkResponse :: Request -> Request -> Response BodyReader -> IO () -- | Same as parseRequest, except will throw an HttpException -- in the event of a non-2XX response. This uses -- throwErrorStatusCodes to implement checkResponse. 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 requestHeaders. -- -- If not provided by the user, Host will automatically be set -- based on the host and port 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 decompress -- 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 Manager 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 Manager -- and to live in IO. This also means that the request body will -- be sent to the server. If the request body in the supplied -- Request 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 -- Just value. If there is any problem with generating the -- digest, it will return Nothing. applyDigestAuth :: (MonadIO m, MonadThrow n) => ByteString -> ByteString -> Request -> Manager -> m (n Request) -- | User friendly display of a DigestAuthException 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 parseRequest. -- -- The constructor for this data type is not exposed. Instead, you should -- use either the defaultRequest value, or parseRequest -- 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: -- --
-- initReq <- parseRequest "http://www.example.com/path"
-- let req = initReq
-- { method = "POST"
-- }
--
--
-- For more information, please see
-- http://www.yesodweb.com/book/settings-types.
--
-- Since 0.1.0
data () => Request
-- | When using one of the RequestBodyStream /
-- RequestBodyStreamChunked constructors, you must ensure that the
-- GivesPopper can be called multiple times. Usually this is not a
-- problem.
--
-- The RequestBodyStreamChunked will send a chunked request body.
-- Note that not all servers support this. Only use
-- RequestBodyStreamChunked 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
-- | An exception which may be generated by this library
data () => HttpException
-- | Most exceptions are specific to a Request. Inspect the
-- HttpExceptionContent value for details on what occurred.
HttpExceptionRequest :: Request -> HttpExceptionContent -> HttpException
-- | A URL (first field) is invalid for a given reason (second argument).
InvalidUrlException :: String -> String -> HttpException
data () => HttpExceptionContent
-- | Generated by the parseUrlThrow function when the server
-- returns a non-2XX response status code.
--
-- May include the beginning of the response body.
StatusCodeException :: Response () -> ByteString -> HttpExceptionContent
-- | The server responded with too many redirects for a request.
--
-- Contains the list of encountered responses containing redirects in
-- reverse chronological order; including last redirect, which triggered
-- the exception and was not followed.
TooManyRedirects :: [Response ByteString] -> HttpExceptionContent
-- | Either too many headers, or too many total bytes in a single header,
-- were returned by the server, and the memory exhaustion protection in
-- this library has kicked in.
OverlongHeaders :: HttpExceptionContent
-- | The server took too long to return a response. This can be altered via
-- responseTimeout or managerResponseTimeout.
ResponseTimeout :: HttpExceptionContent
-- | Attempting to connect to the server timed out.
ConnectionTimeout :: HttpExceptionContent
-- | An exception occurred when trying to connect to the server.
ConnectionFailure :: SomeException -> HttpExceptionContent
-- | The status line returned by the server could not be parsed.
InvalidStatusLine :: ByteString -> HttpExceptionContent
-- | The given response header line could not be parsed
InvalidHeader :: ByteString -> HttpExceptionContent
-- | The given request header is not compliant (e.g. has newlines)
InvalidRequestHeader :: ByteString -> HttpExceptionContent
-- | An exception was raised by an underlying library when performing the
-- request. Most often, this is caused by a failing socket action or a
-- TLS exception.
InternalException :: SomeException -> HttpExceptionContent
-- | A non-200 status code was returned when trying to connect to the proxy
-- server on the given host and port.
ProxyConnectException :: ByteString -> Int -> Status -> HttpExceptionContent
-- | No response data was received from the server at all. This exception
-- may deserve special handling within the library, since it may indicate
-- that a pipelining has been used, and a connection thought to be open
-- was in fact closed.
NoResponseDataReceived :: HttpExceptionContent
-- | Exception thrown when using a Manager which does not have
-- support for secure connections. Typically, you will want to use
-- tlsManagerSettings from http-client-tls to overcome
-- this.
TlsNotSupported :: HttpExceptionContent
-- | The request body provided did not match the expected size.
--
-- Provides the expected and actual size.
WrongRequestBodyStreamSize :: Word64 -> Word64 -> HttpExceptionContent
-- | The returned response body is too short. Provides the expected size
-- and actual size.
ResponseBodyTooShort :: Word64 -> Word64 -> HttpExceptionContent
-- | A chunked response body had invalid headers.
InvalidChunkHeaders :: HttpExceptionContent
-- | An incomplete set of response headers were returned.
IncompleteHeaders :: HttpExceptionContent
-- | The host we tried to connect to is invalid (e.g., an empty string).
InvalidDestinationHost :: ByteString -> HttpExceptionContent
-- | An exception was thrown when inflating a response body.
HttpZlibException :: ZlibException -> HttpExceptionContent
-- | Values in the proxy environment variable were invalid. Provides the
-- environment variable name and its value.
InvalidProxyEnvironmentVariable :: Text -> Text -> HttpExceptionContent
-- | Attempted to use a Connection which was already closed
ConnectionClosed :: HttpExceptionContent
-- | Proxy settings are not valid (Windows specific currently) @since 0.5.7
InvalidProxySettings :: Text -> HttpExceptionContent
-- | Not Found 404
notFound404 :: Status
-- | Accept
hAccept :: HeaderName
-- | Content-Length
hContentLength :: HeaderName
-- | Content-MD5
--
-- This header has been obsoleted in RFC 9110.
hContentMD5 :: HeaderName
-- | HTTP request method, eg GET, POST.
--
-- Since 0.1.0
method :: Request -> Method
-- | HTTP POST Method
methodPost :: Method
-- | HTTP PUT Method
methodPut :: Method
-- | Add form data to the Request.
--
-- This sets a new requestBody, adds a content-type request header
-- and changes the method to POST.
formDataBody :: MonadIO m => [Part] -> Request -> m Request
-- | Construct a Part from form name, filepath and a
-- RequestBody
--
--
-- partFileRequestBody "who_calls" "caller.json" $ RequestBodyBS "{\"caller\":\"Jason J Jason\"}"
--
--
-- -- -- empty upload form -- partFileRequestBody "file" mempty mempty ---- -- The Part does not have a content type associated with it. partFileRequestBody :: forall (m :: Type -> Type). Applicative m => Text -> FilePath -> RequestBody -> PartM m -- | Make a Part whose content is a strict ByteString. -- -- The Part does not have a file name or content type associated -- with it. partBS :: forall (m :: Type -> Type). Applicative m => Text -> ByteString -> PartM m -- | Make a Part whose content is a lazy ByteString. -- -- The Part does not have a file name or content type associated -- with it. partLBS :: forall (m :: Type -> Type). Applicative m => Text -> ByteString -> PartM m -- | Set the user-agent request header setGitHubHeaders :: Request -> Request -- | 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 :: HasTerm env => Request -> Path Abs File -> RIO env Bool -- | Same as download, but will download a file a second time if it -- is already present. -- -- Returns True if the file was downloaded, False otherwise redownload :: HasTerm env => Request -> Path Abs File -> RIO env Bool -- | Request body to be sent to the server. -- -- Since 0.1.0 requestBody :: Request -> RequestBody -- | 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 :: HasTerm env => DownloadRequest -> Path Abs File -> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) -> RIO env Bool verifiedDownloadWithProgress :: HasTerm env => DownloadRequest -> Path Abs File -> Text -> Maybe Int -> RIO env Bool data () => CheckHexDigest CheckHexDigestString :: String -> CheckHexDigest CheckHexDigestByteString :: ByteString -> CheckHexDigest CheckHexDigestHeader :: ByteString -> CheckHexDigest -- | A request together with some checks to perform. -- -- Construct using the downloadRequest smart constructor and -- associated setters. The constructor itself is not exposed to avoid -- breaking changes with additional fields. data () => DownloadRequest -- | Default to retrying seven times with exponential backoff starting from -- one hundred milliseconds. -- -- This means the tries will occur after these delays if necessary: -- --
-- forgivingAbsence (resolveFile …) >>= rejectMissingFile --rejectMissingFile :: MonadIO m => Maybe (Path Abs File) -> m (Maybe (Path Abs File)) -- | See rejectMissingFile. 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) -- | resolveDir (path-io package) throws -- InvalidAbsDir (path package) if the directory does not -- exist; this function yields Nothing. forgivingResolveDir :: MonadIO m => Path Abs Dir -> FilePath -> m (Maybe (Path Abs Dir)) -- | resolveFile (path-io package) throws -- InvalidAbsFile (path package) if the file does not -- exist; this function yields Nothing. forgivingResolveFile :: MonadIO m => Path Abs Dir -> FilePath -> m (Maybe (Path Abs File)) -- | resolveFile' (path-io package) throws -- InvalidAbsFile (path package) if the file does not -- exist; this function yields Nothing. forgivingResolveFile' :: MonadIO m => FilePath -> m (Maybe (Path Abs File)) -- | 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] -- | findInParents f path applies f to path and -- its parents until it finds a Just or reaches the root -- directory. findInParents :: MonadIO m => (Path Abs Dir -> m (Maybe a)) -> Path Abs Dir -> m (Maybe a) 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 -- | Path version withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a -- | Like withSystemTempDir, 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 -- ByteStrings to the consumers. -- -- Throws a ReadProcessException if unsuccessful in launching, -- or ExitCodeException 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 ByteStrings 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 sinkProcessStderrStdout. -- -- Throws a ReadProcessException 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 ReadProcessException exception if the process fails. readProcessNull :: (HasProcessContext env, HasLogFunc env, HasCallStack) => String -> [String] -> RIO env () -- | Use the new ProcessContext, but retain the working directory -- from the parent environment. withProcessContext :: HasProcessContext env => ProcessContext -> RIO env a -> RIO env a -- | Remove a trailing carriage pure if present stripCR :: Text -> Text -- | 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 -- | Like First Bool, but the default is True. newtype FirstTrue FirstTrue :: Maybe Bool -> FirstTrue [$sel:firstTrue:FirstTrue] :: FirstTrue -> Maybe Bool -- | Get the Bool, defaulting to True fromFirstTrue :: FirstTrue -> Bool -- | Helper for filling in default values defaultFirstTrue :: FirstTrue -> Bool -- | Like First Bool, but the default is False. newtype FirstFalse FirstFalse :: Maybe Bool -> FirstFalse [$sel:firstFalse:FirstFalse] :: FirstFalse -> Maybe Bool -- | Get the Bool, defaulting to False fromFirstFalse :: FirstFalse -> Bool -- | Helper for filling in default values defaultFirstFalse :: FirstFalse -> Bool -- | Write a Builder to a file and atomically rename. writeBinaryFileAtomic :: MonadIO m => Path absrel File -> Builder -> m () -- | Report a bug in Stack. bugReport :: String -> String -> String -- | Report a pretty bug in Stack. bugPrettyReport :: String -> StyleDoc -> StyleDoc -- | A blank line. blankLine :: StyleDoc -- | Write a Utf8Builder to the standard output stream. putUtf8Builder :: MonadIO m => Utf8Builder -> m () -- | Write a Builder to the standard output stream. putBuilder :: MonadIO m => Builder -> m () -- | Provide the prettiest available information about an exception. ppException :: SomeException -> StyleDoc -- | Synchronously throw the given exception as a PrettyException. prettyThrowIO :: (Exception e, MonadIO m, Pretty e) => e -> m a -- | Throw the given exception as a PrettyException, when the action -- is run in the monad m. prettyThrowM :: (Exception e, MonadThrow m, Pretty e) => e -> m a -- | Maybe cons. mcons :: Maybe a -> [a] -> [a] -- | A simple pair of a MungedPackageName and Version. -- MungedPackageName is to MungedPackageId as -- PackageName is to PackageId. See -- MungedPackageName for more info. data () => MungedPackageId MungedPackageId :: MungedPackageName -> Version -> MungedPackageId -- | The combined package and component name. see documentation for -- MungedPackageName. [mungedName] :: MungedPackageId -> MungedPackageName -- | The version of this package / component, eg 1.2 [mungedVersion] :: MungedPackageId -> Version -- | A combination of a package and component name used in various legacy -- interfaces, chiefly bundled with a version as -- MungedPackageId. It's generally better to use a -- UnitId to opaquely refer to some compilation/packing unit, -- but that doesn't always work, e.g. where a "name" is needed, in which -- case this can be used as a fallback. -- -- Use mkMungedPackageName and unMungedPackageName to -- convert from/to a String. -- -- In 3.0.0.0 representation was changed from opaque (string) to -- semantic representation. data () => MungedPackageName MungedPackageName :: !PackageName -> !LibraryName -> MungedPackageName data () => LibraryName LMainLibName :: LibraryName LSubLibName :: UnqualComponentName -> LibraryName -- | Path of some base and type. -- -- The type variables are: -- --
-- putStrLnWithCallStack :: HasCallStack => String -> IO () ---- -- as a variant of putStrLn that will get its call-site and -- print it, along with the string given as argument. We can access the -- call-stack inside putStrLnWithCallStack with -- callStack. -- --
-- >>> :{
-- putStrLnWithCallStack :: HasCallStack => String -> IO ()
-- putStrLnWithCallStack msg = do
-- putStrLn msg
-- putStrLn (prettyCallStack callStack)
-- :}
--
--
-- Thus, if we call putStrLnWithCallStack we will get a
-- formatted call-stack alongside our string.
--
-- -- >>> putStrLnWithCallStack "hello" -- hello -- CallStack (from HasCallStack): -- putStrLnWithCallStack, called at <interactive>:... in interactive:Ghci... ---- -- GHC solves HasCallStack constraints in three steps: -- --
-- data T a b = C1 a b | C2 deriving (Typeable, Data) ---- -- GHC will generate an instance that is equivalent to -- --
-- instance (Data a, Data b) => 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 -> k (k (z C1)) -- 2 -> 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] ---- -- This is suitable for datatypes that are exported transparently. class Typeable a => Data a -- | Left-associative fold operation for constructor applications. -- -- The type of gfoldl is a headache, but operationally it is a -- simple generalisation of a list fold. -- -- The default definition for gfoldl is const -- id, 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 Data instances of the form -- --
-- instance (Data a, ...) => Data (T a) ---- -- dataCast1 should be defined as gcast1. -- -- The default definition is const Nothing, 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 Data instances of the form -- --
-- instance (Data a, Data b, ...) => Data (T a b) ---- -- dataCast2 should be defined as gcast2. -- -- The default definition is const Nothing, 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 c in -- the type of gfoldl 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 :: forall r r'. 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 c in -- the type of gfoldl to the monad datatype constructor, defining -- injection and projection using return and >>=. 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 -- | Representable types of kind *. This class is derivable in GHC -- with the DeriveGeneric flag on. -- -- A Generic instance must satisfy the following laws: -- --
-- from . to ≡ id -- to . from ≡ id --class () => Generic a -- | A type f is a Functor if it provides a function fmap -- which, given any types a and b lets you apply any -- function from (a -> b) to turn an f a into an -- f b, preserving the structure of f. Furthermore -- f needs to adhere to the following: -- -- -- -- Note, that the second law follows from the free theorem of the type -- fmap and the first law, so you need only check that the former -- condition holds. See -- https://www.schoolofhaskell.com/user/edwardk/snippets/fmap or -- https://github.com/quchen/articles/blob/master/second_functor_law.md -- for an explanation. class () => Functor (f :: Type -> Type) -- | fmap is used to apply a function of type (a -> b) -- to a value of type f a, where f is a functor, to produce a -- value of type f b. Note that for any type constructor with -- more than one parameter (e.g., Either), only the last type -- parameter can be modified with fmap (e.g., b in -- `Either a b`). -- -- Some type constructors with two parameters or more have a -- Bifunctor instance that allows both the last and the -- penultimate parameters to be mapped over. -- --
-- >>> fmap show Nothing -- Nothing -- -- >>> fmap show (Just 3) -- Just "3" ---- -- Convert from an Either Int Int to an Either Int -- String using show: -- --
-- >>> fmap show (Left 17) -- Left 17 -- -- >>> fmap show (Right 17) -- Right "17" ---- -- Double each element of a list: -- --
-- >>> fmap (*2) [1,2,3] -- [2,4,6] ---- -- Apply even to the second element of a pair: -- --
-- >>> fmap even (2,2) -- (2,True) ---- -- It may seem surprising that the function is only applied to the last -- element of the tuple compared to the list example above which applies -- it to every element in the list. To understand, remember that tuples -- are type constructors with multiple type parameters: a tuple of 3 -- elements (a,b,c) can also be written (,,) a b c and -- its Functor instance is defined for Functor ((,,) a -- b) (i.e., only the third parameter is free to be mapped over with -- fmap). -- -- It explains why fmap can be used with tuples containing -- values of different types as in the following example: -- --
-- >>> fmap even ("hello", 1.0, 4)
-- ("hello",1.0,True)
--
fmap :: Functor f => (a -> b) -> f a -> f b
-- | Replace all locations in the input with the same value. The default
-- definition is fmap . const, but this may be
-- overridden with a more efficient version.
--
-- -- >>> 'a' <$ Just 2 -- Just 'a' -- -- >>> 'a' <$ Nothing -- Nothing --(<$) :: Functor f => a -> f b -> f a infixl 4 <$ -- | Functors representing data structures that can be transformed to -- structures of the same shape by performing an -- Applicative (or, therefore, Monad) action on each -- element from left to right. -- -- A more detailed description of what same shape means, the -- various methods, how traversals are constructed, and example advanced -- use-cases can be found in the Overview section of -- Data.Traversable#overview. -- -- For the class laws see the Laws section of -- Data.Traversable#laws. 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 traverse_. -- --
-- >>> traverse Just [1,2,3,4] -- Just [1,2,3,4] ---- --
-- >>> traverse id [Right 1, Right 2, Right 3, Right 4] -- Right [1,2,3,4] ---- -- In the next examples, we show that Nothing and Left -- values short circuit the created structure. -- --
-- >>> traverse (const Nothing) [1,2,3,4] -- Nothing ---- --
-- >>> traverse (\x -> if odd x then Just x else Nothing) [1,2,3,4] -- Nothing ---- --
-- >>> traverse id [Right 1, Right 2, Right 3, Right 4, Left 0] -- Left 0 --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 -- sequenceA_. -- --
-- >>> sequenceA [Just 1, Just 2, Just 3] -- Just [1,2,3] ---- --
-- >>> sequenceA [Right 1, Right 2, Right 3] -- Right [1,2,3] ---- -- The next two example show Nothing and Just will short -- circuit the resulting structure if present in the input. For more -- context, check the Traversable instances for Either and -- Maybe. -- --
-- >>> sequenceA [Just 1, Just 2, Just 3, Nothing] -- Nothing ---- --
-- >>> sequenceA [Right 1, Right 2, Right 3, Left 4] -- Left 4 --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 mapM_. -- --
-- >>> sequence $ Right [1,2,3,4] -- [Right 1,Right 2,Right 3,Right 4] ---- --
-- >>> sequence $ [Right 1,Right 2,Right 3,Right 4] -- Right [1,2,3,4] ---- -- The following examples demonstrate short circuit behavior for -- sequence. -- --
-- >>> sequence $ Left [1,2,3,4] -- Left [1,2,3,4] ---- --
-- >>> sequence $ [Left 0, Right 1,Right 2,Right 3,Right 4] -- Left 0 --sequence :: (Traversable t, Monad m) => t (m a) -> m (t a) -- | The Foldable class represents data structures that can be reduced to a -- summary value one element at a time. Strict left-associative folds are -- a good fit for space-efficient reduction, while lazy right-associative -- folds are a good fit for corecursive iteration, or for folds that -- short-circuit after processing an initial subsequence of the -- structure's elements. -- -- Instances can be derived automatically by enabling the -- DeriveFoldable extension. For example, a derived instance for -- a binary tree might be: -- --
-- {-# LANGUAGE DeriveFoldable #-}
-- data Tree a = Empty
-- | Leaf a
-- | Node (Tree a) a (Tree a)
-- deriving Foldable
--
--
-- A more detailed description can be found in the Overview
-- section of Data.Foldable#overview.
--
-- For the class laws see the Laws section of
-- Data.Foldable#laws.
class () => Foldable (t :: Type -> Type)
-- | Given a structure with elements whose type is a Monoid, combine
-- them via the monoid's (<>) operator. This fold
-- is right-associative and lazy in the accumulator. When you need a
-- strict left-associative fold, use foldMap' instead, with
-- id as the map.
--
-- -- >>> fold [[1, 2, 3], [4, 5], [6], []] -- [1,2,3,4,5,6] ---- --
-- >>> fold $ Node (Leaf (Sum 1)) (Sum 3) (Leaf (Sum 5))
-- Sum {getSum = 9}
--
--
-- Folds of unbounded structures do not terminate when the monoid's
-- (<>) operator is strict:
--
-- -- >>> fold (repeat Nothing) -- * Hangs forever * ---- -- Lazy corecursive folds of unbounded structures are fine: -- --
-- >>> take 12 $ fold $ map (\i -> [i..i+2]) [0..] -- [0,1,2,1,2,3,2,3,4,3,4,5] -- -- >>> sum $ take 4000000 $ fold $ map (\i -> [i..i+2]) [0..] -- 2666668666666 --fold :: (Foldable t, Monoid m) => t m -> m -- | Map each element of the structure into a monoid, and combine the -- results with (<>). This fold is -- right-associative and lazy in the accumulator. For strict -- left-associative folds consider foldMap' instead. -- --
-- >>> foldMap Sum [1, 3, 5]
-- Sum {getSum = 9}
--
--
--
-- >>> foldMap Product [1, 3, 5]
-- Product {getProduct = 15}
--
--
-- -- >>> foldMap (replicate 3) [1, 2, 3] -- [1,1,1,2,2,2,3,3,3] ---- -- When a Monoid's (<>) is lazy in its second -- argument, foldMap can return a result even from an unbounded -- structure. For example, lazy accumulation enables -- Data.ByteString.Builder to efficiently serialise large data -- structures and produce the output incrementally: -- --
-- >>> import qualified Data.ByteString.Lazy as L -- -- >>> import qualified Data.ByteString.Builder as B -- -- >>> let bld :: Int -> B.Builder; bld i = B.intDec i <> B.word8 0x20 -- -- >>> let lbs = B.toLazyByteString $ foldMap bld [0..] -- -- >>> L.take 64 lbs -- "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24" --foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m -- | Right-associative fold of a structure, lazy in the accumulator. -- -- In the case of lists, foldr, 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: -- --
-- foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...) ---- -- Note that since the head of the resulting expression is produced by an -- application of the operator to the first element of the list, given an -- operator lazy in its right argument, foldr can produce a -- terminating expression from an unbounded list. -- -- For a general Foldable structure this should be semantically -- identical to, -- --
-- foldr f z = foldr f z . toList ---- --
-- >>> foldr (||) False [False, True, False] -- True ---- --
-- >>> foldr (||) False [] -- False ---- --
-- >>> foldr (\c acc -> acc ++ [c]) "foo" ['a', 'b', 'c', 'd'] -- "foodcba" ---- --
-- >>> foldr (||) False (True : repeat False) -- True ---- -- But the following doesn't terminate: -- --
-- >>> foldr (||) False (repeat False ++ [True]) -- * Hangs forever * ---- --
-- >>> take 5 $ foldr (\i acc -> i : fmap (+3) acc) [] (repeat 1) -- [1,4,7,10,13] --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 structure to a single strict result (e.g. sum). -- -- For a general Foldable structure this should be semantically -- identical to, -- --
-- foldl' f z = foldl' f z . toList --foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b -- | List of elements of a structure, from left to right. If the entire -- list is intended to be reduced via a fold, just fold the structure -- directly bypassing the list. -- --
-- >>> toList Nothing -- [] ---- --
-- >>> toList (Just 42) -- [42] ---- --
-- >>> toList (Left "foo") -- [] ---- --
-- >>> toList (Node (Leaf 5) 17 (Node Empty 12 (Leaf 8))) -- [5,17,12,8] ---- -- For lists, toList is the identity: -- --
-- >>> toList [1, 2, 3] -- [1,2,3] --toList :: Foldable t => t a -> [a] -- | Test whether the structure is empty. The default implementation is -- Left-associative and lazy in both the initial element and the -- accumulator. Thus optimised for structures where the first element can -- be accessed in constant time. Structures where this is not the case -- should have a non-default implementation. -- --
-- >>> null [] -- True ---- --
-- >>> null [1] -- False ---- -- null is expected to terminate even for infinite structures. The -- default implementation terminates provided the structure is bounded on -- the left (there is a leftmost element). -- --
-- >>> null [1..] -- False --null :: Foldable t => t a -> Bool -- | Returns the size/length of a finite structure as an Int. The -- default implementation just counts elements starting with the -- leftmost. Instances for structures that can compute the element count -- faster than via element-by-element counting, should provide a -- specialised implementation. -- --
-- >>> length [] -- 0 ---- --
-- >>> length ['a', 'b', 'c'] -- 3 -- -- >>> length [1..] -- * Hangs forever * --length :: Foldable t => t a -> Int -- | Does the element occur in the structure? -- -- Note: elem is often used in infix form. -- --
-- >>> 3 `elem` [] -- False ---- --
-- >>> 3 `elem` [1,2] -- False ---- --
-- >>> 3 `elem` [1,2,3,4,5] -- True ---- -- For infinite structures, the default implementation of elem -- terminates if the sought-after value exists at a finite distance from -- the left side of the structure: -- --
-- >>> 3 `elem` [1..] -- True ---- --
-- >>> 3 `elem` ([4..] ++ [3]) -- * Hangs forever * --elem :: (Foldable t, Eq a) => a -> t a -> Bool -- | The sum function computes the sum of the numbers of a -- structure. -- --
-- >>> sum [] -- 0 ---- --
-- >>> sum [42] -- 42 ---- --
-- >>> sum [1..10] -- 55 ---- --
-- >>> sum [4.1, 2.0, 1.7] -- 7.8 ---- --
-- >>> sum [1..] -- * Hangs forever * --sum :: (Foldable t, Num a) => t a -> a -- | The product function computes the product of the numbers of a -- structure. -- --
-- >>> product [] -- 1 ---- --
-- >>> product [42] -- 42 ---- --
-- >>> product [1..10] -- 3628800 ---- --
-- >>> product [4.1, 2.0, 1.7] -- 13.939999999999998 ---- --
-- >>> product [1..] -- * Hangs forever * --product :: (Foldable t, Num a) => t a -> a infix 4 `elem` -- | The Bounded class is used to name the upper and lower limits of -- a type. Ord is not a superclass of Bounded since types -- that are not totally ordered may also have upper and lower bounds. -- -- The Bounded class may be derived for any enumeration type; -- minBound is the first constructor listed in the data -- declaration and maxBound is the last. Bounded may also -- be derived for single-constructor datatypes whose constituent types -- are in Bounded. class () => Bounded a minBound :: Bounded a => a maxBound :: Bounded a => a -- | Class Enum defines operations on sequentially ordered types. -- -- The enumFrom... methods are used in Haskell's translation of -- arithmetic sequences. -- -- Instances of Enum 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 fromEnum from -- 0 through n-1. See Chapter 10 of the Haskell -- Report for more details. -- -- For any type that is an instance of class Bounded as well as -- Enum, the following should hold: -- --
-- enumFrom x = enumFromTo x maxBound -- enumFromThen x y = enumFromThenTo x y bound -- where -- bound | fromEnum y >= fromEnum x = maxBound -- | otherwise = minBound --class () => Enum a -- | Convert to an Int. It is implementation-dependent what -- fromEnum returns when applied to a value that is too large to -- fit in an Int. fromEnum :: Enum a => a -> Int -- | The Eq class defines equality (==) and inequality -- (/=). All the basic datatypes exported by the Prelude -- are instances of Eq, and Eq may be derived for any -- datatype whose constituents are also instances of Eq. -- -- The Haskell Report defines no laws for Eq. However, instances -- are encouraged to follow these properties: -- --
-- (x `quot` y)*y + (x `rem` y) == x ---- -- WARNING: This function is partial (because it throws when 0 is passed -- as the divisor) for all the integer types in base. rem :: Integral a => a -> a -> a -- | integer division truncated toward negative infinity -- -- WARNING: This function is partial (because it throws when 0 is passed -- as the divisor) for all the integer types in base. div :: Integral a => a -> a -> a -- | integer modulus, satisfying -- --
-- (x `div` y)*y + (x `mod` y) == x ---- -- WARNING: This function is partial (because it throws when 0 is passed -- as the divisor) for all the integer types in base. mod :: Integral a => a -> a -> a -- | simultaneous quot and rem -- -- WARNING: This function is partial (because it throws when 0 is passed -- as the divisor) for all the integer types in base. quotRem :: Integral a => a -> a -> (a, a) -- | simultaneous div and mod -- -- WARNING: This function is partial (because it throws when 0 is passed -- as the divisor) for all the integer types in base. divMod :: Integral a => a -> a -> (a, a) -- | conversion to Integer toInteger :: Integral a => a -> Integer infixl 7 `quot` infixl 7 `rem` infixl 7 `div` infixl 7 `mod` -- | The Monad class defines the basic operations over a -- monad, a concept from a branch of mathematics known as -- category theory. From the perspective of a Haskell programmer, -- however, it is best to think of a monad as an abstract datatype -- of actions. Haskell's do expressions provide a convenient -- syntax for writing monadic expressions. -- -- Instances of Monad should satisfy the following: -- --
-- do a <- as -- bs a --(>>=) :: 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. -- -- 'as >> bs' can be understood as the do -- expression -- --
-- do as -- bs --(>>) :: Monad m => m a -> m b -> m b -- | Inject a value into the monadic type. return :: Monad m => a -> m a infixl 1 >>= infixl 1 >> -- | Basic numeric class. -- -- The Haskell Report defines no laws for Num. However, -- (+) and (*) are customarily expected -- to define a ring and have the following properties: -- --
-- abs x * signum x == x ---- -- For real numbers, the signum is either -1 (negative), -- 0 (zero) or 1 (positive). signum :: Num a => a -> a -- | Conversion from an Integer. An integer literal represents the -- application of the function fromInteger to the appropriate -- value of type Integer, so such literals have type -- (Num a) => a. fromInteger :: Num a => Integer -> a infixl 6 - infixl 6 + infixl 7 * -- | The Ord class is used for totally ordered datatypes. -- -- Instances of Ord can be derived for any user-defined datatype -- whose constituent types are in Ord. The declared order of the -- constructors in the data declaration determines the ordering in -- derived Ord instances. The Ordering datatype allows a -- single comparison to determine the precise ordering of two objects. -- -- Ord, as defined by the Haskell report, implements a total order -- and has the following properties: -- --
-- infixr 5 :^: -- data Tree a = Leaf a | Tree a :^: Tree a ---- -- the derived instance of Read in Haskell 2010 is equivalent to -- --
-- instance (Read a) => Read (Tree a) where
--
-- readsPrec d r = readParen (d > app_prec)
-- (\r -> [(Leaf m,t) |
-- ("Leaf",s) <- lex r,
-- (m,t) <- readsPrec (app_prec+1) s]) r
--
-- ++ readParen (d > up_prec)
-- (\r -> [(u:^:v,w) |
-- (u,s) <- readsPrec (up_prec+1) r,
-- (":^:",t) <- lex s,
-- (v,w) <- readsPrec (up_prec+1) t]) r
--
-- where app_prec = 10
-- up_prec = 5
--
--
-- Note that right-associativity of :^: is unused.
--
-- The derived instance in GHC is equivalent to
--
-- -- instance (Read a) => Read (Tree a) where -- -- readPrec = parens $ (prec app_prec $ do -- Ident "Leaf" <- lexP -- m <- step readPrec -- return (Leaf m)) -- -- +++ (prec up_prec $ do -- u <- step readPrec -- Symbol ":^:" <- lexP -- v <- step readPrec -- return (u :^: v)) -- -- where app_prec = 10 -- up_prec = 5 -- -- readListPrec = readListPrecDefault ---- -- Why do both readsPrec and readPrec exist, and why does -- GHC opt to implement readPrec in derived Read instances -- instead of readsPrec? The reason is that readsPrec is -- based on the ReadS type, and although ReadS is mentioned -- in the Haskell 2010 Report, it is not a very efficient parser data -- structure. -- -- readPrec, on the other hand, is based on a much more efficient -- ReadPrec datatype (a.k.a "new-style parsers"), but its -- definition relies on the use of the RankNTypes language -- extension. Therefore, readPrec (and its cousin, -- readListPrec) are marked as GHC-only. Nevertheless, it is -- recommended to use readPrec instead of readsPrec -- whenever possible for the efficiency improvements it brings. -- -- As mentioned above, derived Read instances in GHC will -- implement readPrec instead of readsPrec. The default -- implementations of readsPrec (and its cousin, readList) -- will simply use readPrec under the hood. If you are writing a -- Read instance by hand, it is recommended to write it like so: -- --
-- instance Read T where -- readPrec = ... -- readListPrec = readListPrecDefault --class () => Read a -- | Real numbers. -- -- The Haskell report defines no laws for Real, however -- Real instances are customarily expected to adhere to the -- following law: -- --
-- infixr 5 :^: -- data Tree a = Leaf a | Tree a :^: Tree a ---- -- the derived instance of Show is equivalent to -- --
-- instance (Show a) => Show (Tree a) where -- -- showsPrec d (Leaf m) = showParen (d > app_prec) $ -- showString "Leaf " . showsPrec (app_prec+1) m -- where app_prec = 10 -- -- showsPrec d (u :^: v) = showParen (d > up_prec) $ -- showsPrec (up_prec+1) u . -- showString " :^: " . -- showsPrec (up_prec+1) v -- where up_prec = 5 ---- -- Note that right-associativity of :^: is ignored. For example, -- --
-- fail s >>= f = fail s ---- -- If your Monad is also MonadPlus, a popular definition is -- --
-- fail _ = mzero ---- -- fail s should be an action that runs in the monad itself, not -- an exception (except in instances of MonadIO). In particular, -- fail should not be implemented in terms of error. class Monad m => MonadFail (m :: Type -> Type) fail :: MonadFail m => String -> m a -- | IsString is used in combination with the -- -XOverloadedStrings language extension to convert the -- literals to different string types. -- -- For example, if you use the text package, you can say -- --
-- {-# LANGUAGE OverloadedStrings #-}
--
-- myText = "hello world" :: Text
--
--
-- Internally, the extension will convert this to the equivalent of
--
--
-- myText = fromString @Text ("hello world" :: String)
--
--
-- Note: You can use fromString in normal code as well,
-- but the usual performance/memory efficiency problems with
-- String apply.
class () => IsString a
fromString :: IsString a => String -> a
-- | A functor with application, providing operations to
--
-- -- (<*>) = liftA2 id ---- --
-- liftA2 f x y = f <$> x <*> y ---- -- Further, any definition must satisfy the following: -- --
pure id <*> v = -- v
pure (.) <*> u -- <*> v <*> w = u <*> (v -- <*> w)
pure f <*> -- pure x = pure (f x)
u <*> pure y = -- pure ($ y) <*> u
-- forall x y. p (q x y) = f x . g y ---- -- it follows from the above that -- --
-- liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v ---- -- If f is also a Monad, it should satisfy -- -- -- -- (which implies that pure and <*> 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 <*> that is -- more efficient than the default one. -- --
-- >>> data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
--
--
-- -- >>> produceFoo :: Applicative f => f Foo ---- --
-- >>> produceBar :: Applicative f => f Bar -- -- >>> produceBaz :: Applicative f => f Baz ---- --
-- >>> mkState :: Applicative f => f MyState -- -- >>> mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz --(<*>) :: Applicative f => f (a -> b) -> f a -> f b -- | Lift a binary function to actions. -- -- Some functors support an implementation of liftA2 that is more -- efficient than the default one. In particular, if fmap is an -- expensive operation, it is likely better to use liftA2 than to -- fmap over the structure and then use <*>. -- -- This became a typeclass method in 4.10.0.0. Prior to that, it was a -- function defined in terms of <*> and fmap. -- --
-- >>> liftA2 (,) (Just 3) (Just 5) -- Just (3,5) --liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c -- | Sequence actions, discarding the value of the first argument. -- --
-- >>> Just 2 *> Just 3 -- Just 3 ---- --
-- >>> Nothing *> Just 3 -- Nothing ---- -- Of course a more interesting use case would be to have effectful -- computations instead of just returning pure values. -- --
-- >>> import Data.Char
--
-- >>> import Text.ParserCombinators.ReadP
--
-- >>> let p = string "my name is " *> munch1 isAlpha <* eof
--
-- >>> readP_to_S p "my name is Simon"
-- [("Simon","")]
--
(*>) :: 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 <*
-- | The class of semigroups (types with an associative binary operation).
--
-- Instances should satisfy the following:
--
--
--
-- You can alternatively define sconcat instead of
-- (<>), in which case the laws are:
--
-- -- >>> [1,2,3] <> [4,5,6] -- [1,2,3,4,5,6] --(<>) :: Semigroup a => a -> a -> a infixr 6 <> -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following: -- --
-- >>> "Hello world" <> mempty -- "Hello world" --mempty :: Monoid a => a -- | An associative operation -- -- NOTE: This method is redundant and has the default -- implementation mappend = (<>) since -- base-4.11.0.0. Should it be implemented manually, since -- mappend is a synonym for (<>), it is expected that -- the two functions are defined the same way. In a future GHC release -- mappend will be removed from Monoid. mappend :: Monoid a => a -> a -> a -- | Fold a list using the monoid. -- -- For most types, the default definition for mconcat will be -- used, but the function is included in the class definition so that an -- optimized version can be provided for specific types. -- --
-- >>> mconcat ["Hello", " ", "Haskell", "!"] -- "Hello Haskell!" --mconcat :: Monoid a => [a] -> a data () => Bool False :: Bool True :: Bool -- | String is an alias for a list of characters. -- -- String constants in Haskell are values of type String. That -- means if you write a string literal like "hello world", it -- will have the type [Char], which is the same as -- String. -- -- Note: You can ask the compiler to automatically infer different -- types with the -XOverloadedStrings language extension, for -- example "hello world" :: Text. See IsString for more -- information. -- -- Because String is just a list of characters, you can use -- normal list functions to do basic string manipulation. See -- Data.List for operations on lists. -- --
-- ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭─────┬───┬──╮ ╭────╮ -- │ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ (:) │ │ ─┼─>│ [] │ -- ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰─────┴─┼─┴──╯ ╰────╯ -- v v v -- 'a' 'b' 'c' ---- -- The String "abc" will use 5*3+1 = 16 (in general -- 5n+1) words of space in memory. -- -- Furthermore, operations like (++) (string concatenation) are -- O(n) (in the left argument). -- -- For historical reasons, the base library uses String -- in a lot of places for the conceptual simplicity, but library code -- dealing with user-data should use the text package for Unicode -- text, or the the bytestring package for binary data. type String = [Char] -- | The character type Char is an enumeration whose values -- represent Unicode (or equivalently ISO/IEC 10646) code points (i.e. -- characters, see http://www.unicode.org/ 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 -- Char. -- -- To convert a Char to or from the corresponding Int value -- defined by Unicode, use toEnum and fromEnum from the -- Enum class respectively (or equivalently ord and -- chr). 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 [-2^29 .. -- 2^29-1]. The exact range for a given implementation can be -- determined by using minBound and maxBound from the -- Bounded 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 -- | Arbitrary precision integers. In contrast with fixed-size integral -- types such as Int, the Integer type represents the -- entire infinite range of integers. -- -- Integers are stored in a kind of sign-magnitude form, hence do not -- expect two's complement form when using bit operations. -- -- If the value is small (fit into an Int), IS constructor -- is used. Otherwise Integer and IN constructors are used -- to store a BigNat representing respectively the positive or the -- negative value magnitude. -- -- Invariant: Integer and IN are used iff value doesn't fit -- in IS data () => Integer -- | The Maybe type encapsulates an optional value. A value of type -- Maybe a either contains a value of type a -- (represented as Just a), or it is empty (represented -- as Nothing). Using Maybe is a good way to deal with -- errors or exceptional cases without resorting to drastic measures such -- as error. -- -- The Maybe type is also a monad. It is a simple kind of error -- monad, where all errors are represented by Nothing. A richer -- error monad can be built using the Either 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 -- Integer values. A rational number may be constructed using the -- % operator. type Rational = Ratio Integer -- | A value of type IO a is a computation which, when -- performed, does some I/O before returning a value of type a. -- -- There is really only one way to "perform" an I/O action: bind it to -- Main.main 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 IO monad and -- called at some point, directly or indirectly, from Main.main. -- -- IO is a monad, so IO actions can be combined using -- either the do-notation or the >> and >>= -- operations from the Monad class. data () => IO a -- | A Word is an unsigned integral type, with the same size as -- Int. 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 Either type represents values with two possibilities: a -- value of type Either a b is either Left -- a or Right b. -- -- The Either type is sometimes used to represent a value which is -- either correct or an error; by convention, the Left constructor -- is used to hold an error value and the Right constructor is -- used to hold a correct value (mnemonic: "right" also means "correct"). -- --
-- >>> let s = Left "foo" :: Either String Int -- -- >>> s -- Left "foo" -- -- >>> let n = Right 3 :: Either String Int -- -- >>> n -- Right 3 -- -- >>> :type s -- s :: Either String Int -- -- >>> :type n -- n :: Either String Int ---- -- The fmap from our Functor instance will ignore -- Left values, but will apply the supplied function to values -- contained in a Right: -- --
-- >>> let s = Left "foo" :: Either String Int -- -- >>> let n = Right 3 :: Either String Int -- -- >>> fmap (*2) s -- Left "foo" -- -- >>> fmap (*2) n -- Right 6 ---- -- The Monad instance for Either 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 Int from a Char, or fail. -- --
-- >>> import Data.Char ( digitToInt, isDigit )
--
-- >>> :{
-- let parseEither :: Char -> Either String Int
-- parseEither c
-- | isDigit c = Right (digitToInt c)
-- | otherwise = Left "parse error"
--
-- >>> :}
--
--
-- The following should work, since both '1' and '2'
-- can be parsed as Ints.
--
--
-- >>> :{
-- let parseMultiple :: Either String Int
-- parseMultiple = do
-- x <- parseEither '1'
-- y <- parseEither '2'
-- return (x + y)
--
-- >>> :}
--
--
-- -- >>> parseMultiple -- Right 3 ---- -- But the following should fail overall, since the first operation where -- we attempt to parse 'm' as an Int will fail: -- --
-- >>> :{
-- let parseMultiple :: Either String Int
-- parseMultiple = do
-- x <- parseEither 'm'
-- y <- parseEither '2'
-- return (x + y)
--
-- >>> :}
--
--
-- -- >>> parseMultiple -- Left "parse error" --data () => Either a b Left :: a -> Either a b Right :: b -> Either a b -- | Uninhabited data type data () => Void -- | Non-empty (and non-strict) list type. data () => NonEmpty a (:|) :: a -> [a] -> NonEmpty a infixr 5 :| -- | The SomeException type is the root of the exception type -- hierarchy. When an exception of type e is thrown, behind the -- scenes it is encapsulated in a SomeException. data () => SomeException SomeException :: e -> SomeException -- | Monads that also support choice and failure. class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type) -- | The identity of mplus. It should also satisfy the equations -- --
-- mzero >>= f = mzero -- v >> mzero = mzero ---- -- The default definition is -- --
-- mzero = empty --mzero :: MonadPlus m => m a -- | An associative operation. The default definition is -- --
-- mplus = (<|>) --mplus :: MonadPlus m => m a -> m a -> m a -- | A monoid on applicative functors. -- -- If defined, some and many should be the least solutions -- of the equations: -- -- 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 <|> -- | Proxy 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, Proxy :: Proxy a is a safer -- alternative to the undefined :: a idiom. -- --
-- >>> Proxy :: Proxy (Void, Int -> Int) -- Proxy ---- -- Proxy can even hold types of higher kinds, -- --
-- >>> Proxy :: Proxy Either -- Proxy ---- --
-- >>> Proxy :: Proxy Functor -- Proxy ---- --
-- >>> Proxy :: Proxy complicatedStructure -- Proxy --data () => Proxy (t :: k) Proxy :: Proxy (t :: k) -- | The Const functor. newtype () => Const a (b :: k) Const :: a -> Const a (b :: k) [getConst] :: Const a (b :: k) -> a -- | Any type that you wish to throw or catch as an exception must be an -- instance of the Exception class. The simplest case is a new -- exception type directly below the root: -- --
-- data MyException = ThisException | ThatException -- deriving Show -- -- instance Exception MyException ---- -- The default method definitions in the Exception class do what -- we need in this case. You can now throw and catch -- ThisException and ThatException as exceptions: -- --
-- *Main> throw ThisException `catch` \e -> putStrLn ("Caught " ++ show (e :: MyException))
-- Caught ThisException
--
--
-- In more complicated examples, you may wish to define a whole hierarchy
-- of exceptions:
--
-- -- --------------------------------------------------------------------- -- -- Make the root exception type for all the exceptions in a compiler -- -- data SomeCompilerException = forall e . Exception e => SomeCompilerException e -- -- instance Show SomeCompilerException where -- show (SomeCompilerException e) = show e -- -- instance Exception SomeCompilerException -- -- compilerExceptionToException :: Exception e => e -> SomeException -- compilerExceptionToException = toException . SomeCompilerException -- -- compilerExceptionFromException :: Exception e => SomeException -> Maybe e -- compilerExceptionFromException x = do -- SomeCompilerException a <- fromException x -- cast a -- -- --------------------------------------------------------------------- -- -- Make a subhierarchy for exceptions in the frontend of the compiler -- -- data SomeFrontendException = forall e . Exception e => SomeFrontendException e -- -- instance Show SomeFrontendException where -- show (SomeFrontendException e) = show e -- -- instance Exception SomeFrontendException where -- toException = compilerExceptionToException -- fromException = compilerExceptionFromException -- -- frontendExceptionToException :: Exception e => e -> SomeException -- frontendExceptionToException = toException . SomeFrontendException -- -- frontendExceptionFromException :: Exception e => SomeException -> Maybe e -- frontendExceptionFromException x = do -- SomeFrontendException a <- 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 ---- -- We can now catch a MismatchedParentheses exception as -- MismatchedParentheses, SomeFrontendException or -- SomeCompilerException, but not other types, e.g. -- IOException: -- --
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: MismatchedParentheses))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeFrontendException))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: SomeCompilerException))
-- Caught MismatchedParentheses
-- *Main> throw MismatchedParentheses `catch` \e -> putStrLn ("Caught " ++ show (e :: IOException))
-- *** Exception: MismatchedParentheses
--
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: show.
displayException :: Exception e => e -> String
-- | File and directory names are values of type String, 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
-- | 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
-- | Identity functor and monad. (a non-strict monad)
newtype () => Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a
-- | A set of values a.
data () => Set a
-- | A Map from keys k to values a.
--
-- The Semigroup operation for Map is union, which
-- prefers values from the left operand. If m1 maps a key
-- k to a value a1, and m2 maps the same key
-- to a different value a2, then their union m1 <>
-- m2 maps k to a1.
data () => Map k a
-- | A class of types that can be fully evaluated.
class () => NFData a
-- | rnf should reduce its argument to normal form (that is, fully
-- evaluate all sub-components), and then return ().
--
--
-- {-# LANGUAGE DeriveGeneric #-}
--
-- import GHC.Generics (Generic, Generic1)
-- import Control.DeepSeq
--
-- data Foo a = Foo a String
-- deriving (Eq, Generic, Generic1)
--
-- instance NFData a => NFData (Foo a)
-- instance NFData1 Foo
--
-- data Colour = Red | Green | Blue
-- deriving Generic
--
-- instance NFData Colour
--
--
-- Starting with GHC 7.10, the example above can be written more
-- concisely by enabling the new DeriveAnyClass extension:
--
--
-- {-# 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)
--
--
-- -- rnf a = seq a () ---- -- However, starting with deepseq-1.4.0.0, the default -- implementation is based on DefaultSignatures allowing for -- more accurate auto-derived NFData instances. If you need the -- previously used exact default rnf method implementation -- semantics, use -- --
-- instance NFData Colour where rnf x = seq x () ---- -- or alternatively -- --
-- instance NFData Colour where rnf = rwhnf ---- -- or -- --
-- {-# LANGUAGE BangPatterns #-}
-- instance NFData Colour where rnf !_ = ()
--
rnf :: NFData a => a -> ()
-- | The strict ST monad. The ST monad allows for destructive
-- updates, but is escapable (unlike IO). A computation of type
-- ST s a returns a value of type a, and execute
-- in "thread" s. The s parameter is either
--
-- -- runST (writeSTRef _|_ v >>= f) = _|_ --data () => ST s a -- | The name and version of a package. data () => PackageIdentifier PackageIdentifier :: PackageName -> Version -> PackageIdentifier -- | The name of this package, eg. foo [pkgName] :: PackageIdentifier -> PackageName -- | the version of this package, eg 1.2 [pkgVersion] :: PackageIdentifier -> Version -- | Natural number -- -- Invariant: numbers <= 0xffffffffffffffff use the NS -- constructor data () => Natural -- | Boolean monoid under disjunction (||). -- --
-- >>> getAny (Any True <> mempty <> Any False) -- True ---- --
-- >>> getAny (mconcat (map (\x -> Any (even x)) [2,4,6,7,8])) -- True --newtype () => Any Any :: Bool -> Any [getAny] :: Any -> Bool -- | A space-efficient representation of a Word8 vector, supporting -- many efficient operations. -- -- A ByteString contains 8-bit bytes, or by using the operations -- from Data.ByteString.Char8 it can be interpreted as containing -- 8-bit characters. data () => ByteString -- | ASetter s t a b is something that turns a function modifying -- a value into a function modifying a structure. If you ignore -- Identity (as Identity a is the same thing as -- a), the type is: -- --
-- type ASetter s t a b = (a -> b) -> s -> t ---- -- The reason Identity is used here is for ASetter to be -- composable with other types, such as Lens. -- -- 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 Setter, but it is not provided by this package -- (because then it'd have to depend on distributive). It's -- completely alright, however, to export functions which take an -- ASetter as an argument. type ASetter s t a b = a -> Identity b -> s -> Identity t -- | Functions that operate on getters and folds – such as (^.), -- (^..), (^?) – use Getter r s a (with different -- values of r) to describe what kind of result they need. For -- instance, (^.) needs the getter to be able to return a single -- value, and so it accepts a getter of type Getting a s a. -- (^..) wants the getter to gather values together, so it uses -- Getting (Endo [a]) s a (it could've used Getting [a] s -- a instead, but it's faster with Endo). The choice of -- r depends on what you want to do with elements you're -- extracting from s. type Getting r s a = a -> Const r a -> s -> Const r s -- | 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 -- | Lens s t a b is the lowest common denominator of a setter and -- a getter, something that has the power of both; it has a -- Functor constraint, and since both Const and -- Identity are functors, it can be used whenever a getter or a -- setter is needed. -- --
-- >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world")) -- Just "hello" ---- -- Beware that Data.Monoid.First is different from -- Data.Semigroup.First. The former returns the first -- non-Nothing, so Data.Monoid.First Nothing <> x = -- x. The latter simply returns the first value, thus -- Data.Semigroup.First Nothing <> x = Data.Semigroup.First -- Nothing. newtype () => First a First :: Maybe a -> First a [getFirst] :: First a -> Maybe a -- | A compact representation of a Word8 vector. -- -- It has a lower memory overhead than a ByteString and does not -- contribute to heap fragmentation. It can be converted to or from a -- ByteString (at the cost of copying the string data). It -- supports very few other operations. data () => ShortByteString -- | Generalized version of Handler data () => Handler (m :: Type -> Type) a Handler :: (e -> m a) -> Handler (m :: Type -> Type) a -- | Haskell defines operations to read and write characters from and to -- files, represented by values of type Handle. Each value of -- this type is a handle: a record used by the Haskell run-time -- system to manage I/O with file system objects. A handle has at -- least the following properties: -- --
-- second id = id ---- -- If you supply bimap, you should ensure that: -- --
-- bimap id id ≡ id ---- -- If you supply first and second, ensure: -- --
-- first id ≡ id -- second id ≡ id ---- -- If you supply both, you should also ensure: -- --
-- bimap f g ≡ first f . second g ---- -- These ensure by parametricity: -- --
-- bimap (f . g) (h . i) ≡ bimap f h . bimap g i -- first (f . g) ≡ first f . first g -- second (f . g) ≡ second f . second g ---- -- Since 4.18.0.0 Functor is a superclass of 'Bifunctor. class forall a. () => Functor p a => Bifunctor (p :: Type -> Type -> Type) -- | Map over both arguments at the same time. -- --
-- bimap f g ≡ first f . second g ---- --
-- >>> bimap toUpper (+1) ('j', 3)
-- ('J',4)
--
--
-- -- >>> bimap toUpper (+1) (Left 'j') -- Left 'J' ---- --
-- >>> bimap toUpper (+1) (Right 3) -- Right 4 --bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d -- | Map covariantly over the first argument. -- --
-- first f ≡ bimap f id ---- --
-- >>> first toUpper ('j', 3)
-- ('J',3)
--
--
-- -- >>> first toUpper (Left 'j') -- Left 'J' --first :: Bifunctor p => (a -> b) -> p a c -> p b c -- | Map covariantly over the second argument. -- --
-- second ≡ bimap id ---- --
-- >>> second (+1) ('j', 3)
-- ('j',4)
--
--
-- -- >>> second (+1) (Right 3) -- Right 4 --second :: Bifunctor p => (b -> c) -> p a b -> p a c -- | Unlifted Concurrently. newtype () => Concurrently (m :: Type -> Type) a Concurrently :: m a -> Concurrently (m :: Type -> Type) a [runConcurrently] :: Concurrently (m :: Type -> Type) a -> m a -- | A monad supporting atomic memory transactions. data () => STM a -- | Monoid under addition. -- --
-- >>> getSum (Sum 1 <> Sum 2 <> mempty) -- 3 --newtype () => Sum a Sum :: a -> Sum a [getSum] :: Sum a -> a -- | 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 Ptr -- a, for some a which is an instance of class -- Storable. The type argument to Ptr 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 Storable facilitates this manipulation -- on all types for which it is instantiated, which are the standard -- basic types of Haskell, the fixed size Int types -- (Int8, Int16, Int32, Int64), the fixed -- size Word types (Word8, Word16, Word32, -- Word64), StablePtr, all types from -- Foreign.C.Types, as well as Ptr. class () => Storable a -- | Monads in which IO computations may be embedded. Any monad -- built by applying a sequence of monad transformers to the IO -- monad will be an instance of this class. -- -- Instances should satisfy the following laws, which state that -- liftIO is a transformer of monads: -- -- class Monad m => MonadIO (m :: Type -> Type) -- | Lift a computation from the IO monad. This allows us to run IO -- computations in any monadic stack, so long as it supports these kinds -- of operations (i.e. IO is the base monad for the stack). -- --
-- import Control.Monad.Trans.State -- from the "transformers" library -- -- printState :: Show s => StateT s IO () -- printState = do -- state <- get -- liftIO $ print state ---- -- Had we omitted liftIO, we would have ended up with -- this error: -- --
-- • Couldn't match type ‘IO’ with ‘StateT s IO’ -- Expected type: StateT s IO () -- Actual type: IO () ---- -- The important part here is the mismatch between StateT s IO -- () and IO (). -- -- Luckily, we know of a function that takes an IO a and -- returns an (m a): liftIO, enabling us to run -- the program and see the expected results: -- --
-- > evalStateT printState "hello" -- "hello" -- -- > evalStateT printState 3 -- 3 --liftIO :: MonadIO m => IO a -> m a -- | Chan is an abstract type representing an unbounded FIFO -- channel. data () => Chan a -- | Request a CallStack. -- -- NOTE: The implicit parameter ?callStack :: CallStack is an -- implementation detail and should not be considered part of the -- CallStack API, we may decide to change the implementation in -- the future. type HasCallStack = ?callStack :: CallStack -- | Shared memory locations that support atomic memory transactions. data () => TVar a -- | The Down type allows you to reverse sort order conveniently. A -- value of type Down a contains a value of type -- a (represented as Down a). -- -- If a has an Ord instance associated with it -- then comparing two values thus wrapped will give you the opposite of -- their normal sort order. This is particularly useful when sorting in -- generalised list comprehensions, as in: then sortWith by -- Down x. -- --
-- >>> compare True False -- GT ---- --
-- >>> compare (Down True) (Down False) -- LT ---- -- If a has a Bounded instance then the wrapped -- instance also respects the reversed ordering by exchanging the values -- of minBound and maxBound. -- --
-- >>> minBound :: Int -- -9223372036854775808 ---- --
-- >>> minBound :: Down Int -- Down 9223372036854775807 ---- -- All other instances of Down a behave as they do for -- a. newtype () => Down a Down :: a -> Down a [getDown] :: Down a -> a -- | A class for categories. Instances should satisfy the laws -- --
-- >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
--
-- >>> appEndo computation "Haskell"
-- "Hello, Haskell!"
--
newtype () => Endo a
Endo :: (a -> a) -> Endo a
[appEndo] :: Endo a -> a -> a
-- | A mutable variable in the IO monad.
--
-- -- >>> import Data.IORef -- -- >>> r <- newIORef 0 -- -- >>> readIORef r -- 0 -- -- >>> writeIORef r 1 -- -- >>> readIORef r -- 1 -- -- >>> atomicWriteIORef r 2 -- -- >>> readIORef r -- 2 -- -- >>> modifyIORef' r (+ 1) -- -- >>> readIORef r -- 3 -- -- >>> atomicModifyIORef' r (\a -> (a + 1, ())) -- -- >>> readIORef r -- 4 ---- -- See also STRef and MVar. data () => IORef a -- | A mode that determines the effect of hSeek hdl mode i. data () => SeekMode -- | the position of hdl is set to i. AbsoluteSeek :: SeekMode -- | the position of hdl is set to offset i from the -- current position. RelativeSeek :: SeekMode -- | the position of hdl is set to offset i from the end -- of the file. SeekFromEnd :: SeekMode -- | 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 flushed, from -- the internal buffer according to the buffer mode: -- --
arr id = id
arr (f >>> g) = arr f >>> -- arr g
first (arr f) = arr (first -- f)
first (f >>> g) = first f >>> -- first g
first f >>> arr fst = -- arr fst >>> f
first f >>> arr (id *** g) = -- arr (id *** g) >>> first f
first (first f) >>> arr assoc = -- arr assoc >>> first f
-- assoc ((a,b),c) = (a,(b,c)) ---- -- The other combinators have sensible default definitions, which may be -- overridden for efficiency. class Category a => Arrow (a :: Type -> Type -> Type) -- | 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') -- | 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 *** infixr 3 &&& -- | QSemN is a quantity semaphore in which the resource is acquired -- and released in units of one. It provides guaranteed FIFO ordering for -- satisfying blocked waitQSemN calls. -- -- The pattern -- --
-- bracket_ (waitQSemN n) (signalQSemN n) (...) ---- -- is safe; it never loses any of the resource. data () => QSemN -- | QSem is a quantity semaphore in which the resource is acquired -- and released in units of one. It provides guaranteed FIFO ordering for -- satisfying blocked waitQSem calls. -- -- The pattern -- --
-- bracket_ waitQSem signalQSem (...) ---- -- is safe; it never loses a unit of the resource. data () => QSem -- | Bifoldable identifies foldable structures with two different -- varieties of elements (as opposed to Foldable, which has one -- variety of element). Common examples are Either and -- (,): -- --
-- instance Bifoldable Either where -- bifoldMap f _ (Left a) = f a -- bifoldMap _ g (Right b) = g b -- -- instance Bifoldable (,) where -- bifoldr f g z (a, b) = f a (g b z) ---- -- Some examples below also use the following BiList to showcase empty -- Bifoldable behaviors when relevant (Either and (,) -- containing always exactly resp. 1 and 2 elements): -- --
-- data BiList a b = BiList [a] [b] -- -- instance Bifoldable BiList where -- bifoldr f g z (BiList as bs) = foldr f (foldr g z bs) as ---- -- A minimal Bifoldable definition consists of either -- bifoldMap or bifoldr. When defining more than this -- minimal set, one should ensure that the following identities hold: -- --
-- bifold ≡ bifoldMap id id -- bifoldMap f g ≡ bifoldr (mappend . f) (mappend . g) mempty -- bifoldr f g z t ≡ appEndo (bifoldMap (Endo . f) (Endo . g) t) z ---- -- If the type is also a Bifunctor instance, it should satisfy: -- --
-- bifoldMap f g ≡ bifold . bimap f g ---- -- which implies that -- --
-- bifoldMap f g . bimap h i ≡ bifoldMap (f . h) (g . i) --class () => Bifoldable (p :: Type -> Type -> Type) -- | Combines the elements of a structure using a monoid. -- --
-- bifold ≡ bifoldMap id id ---- --
-- >>> bifold (Right [1, 2, 3]) -- [1,2,3] ---- --
-- >>> bifold (Left [5, 6]) -- [5,6] ---- --
-- >>> bifold ([1, 2, 3], [4, 5]) -- [1,2,3,4,5] ---- --
-- >>> bifold (Product 6, Product 7)
-- Product {getProduct = 42}
--
--
--
-- >>> bifold (Sum 6, Sum 7)
-- Sum {getSum = 13}
--
bifold :: (Bifoldable p, Monoid m) => p m m -> m
-- | Combines the elements of a structure, given ways of mapping them to a
-- common monoid.
--
-- -- bifoldMap f g ≡ bifoldr (mappend . f) (mappend . g) mempty ---- --
-- >>> bifoldMap (take 3) (fmap digitToInt) ([1..], "89") -- [1,2,3,8,9] ---- --
-- >>> bifoldMap (take 3) (fmap digitToInt) (Left [1..]) -- [1,2,3] ---- --
-- >>> bifoldMap (take 3) (fmap digitToInt) (Right "89") -- [8,9] --bifoldMap :: (Bifoldable p, Monoid m) => (a -> m) -> (b -> m) -> p a b -> m -- | Combines the elements of a structure in a right associative manner. -- Given a hypothetical function toEitherList :: p a b -> [Either -- a b] yielding a list of all elements of a structure in order, the -- following would hold: -- --
-- bifoldr f g z ≡ foldr (either f g) z . toEitherList ---- --
-- > bifoldr (+) (*) 3 (5, 7) -- 26 -- 5 + (7 * 3) -- -- > bifoldr (+) (*) 3 (7, 5) -- 22 -- 7 + (5 * 3) -- -- > bifoldr (+) (*) 3 (Right 5) -- 15 -- 5 * 3 -- -- > bifoldr (+) (*) 3 (Left 5) -- 8 -- 5 + 3 --bifoldr :: Bifoldable p => (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c -- | Combines the elements of a structure in a left associative manner. -- Given a hypothetical function toEitherList :: p a b -> [Either -- a b] yielding a list of all elements of a structure in order, the -- following would hold: -- --
-- bifoldl f g z -- ≡ foldl (acc -> either (f acc) (g acc)) z . toEitherList ---- -- Note that if you want an efficient left-fold, you probably want to use -- bifoldl' instead of bifoldl. The reason is that the -- latter does not force the "inner" results, resulting in a thunk chain -- which then must be evaluated from the outside-in. -- --
-- > bifoldl (+) (*) 3 (5, 7) -- 56 -- (5 + 3) * 7 -- -- > bifoldl (+) (*) 3 (7, 5) -- 50 -- (7 + 3) * 5 -- -- > bifoldl (+) (*) 3 (Right 5) -- 15 -- 5 * 3 -- -- > bifoldl (+) (*) 3 (Left 5) -- 8 -- 5 + 3 --bifoldl :: Bifoldable p => (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c -- | Bitraversable identifies bifunctorial data structures whose -- elements can be traversed in order, performing Applicative or -- Monad actions at each element, and collecting a result -- structure with the same shape. -- -- As opposed to Traversable data structures, which have one -- variety of element on which an action can be performed, -- Bitraversable data structures have two such varieties of -- elements. -- -- A definition of bitraverse must satisfy the following laws: -- --
-- t :: (Applicative f, Applicative g) => f a -> g a ---- -- preserving the Applicative operations: -- --
-- t (pure x) = pure x -- t (f <*> x) = t f <*> t x ---- -- and the identity functor Identity and composition functors -- Compose are from Data.Functor.Identity and -- Data.Functor.Compose. -- -- Some simple examples are Either and (,): -- --
-- instance Bitraversable Either where -- bitraverse f _ (Left x) = Left <$> f x -- bitraverse _ g (Right y) = Right <$> g y -- -- instance Bitraversable (,) where -- bitraverse f g (x, y) = (,) <$> f x <*> g y ---- -- Bitraversable relates to its superclasses in the following -- ways: -- --
-- bimap f g ≡ runIdentity . bitraverse (Identity . f) (Identity . g) -- bifoldMap f g = getConst . bitraverse (Const . f) (Const . g) ---- -- These are available as bimapDefault and bifoldMapDefault -- respectively. class (Bifunctor t, Bifoldable t) => Bitraversable (t :: Type -> Type -> Type) -- | Evaluates the relevant functions at each element in the structure, -- running the action, and builds a new structure with the same shape, -- using the results produced from sequencing the actions. -- --
-- bitraverse f g ≡ bisequenceA . bimap f g ---- -- For a version that ignores the results, see bitraverse_. -- --
-- >>> bitraverse listToMaybe (find odd) (Left []) -- Nothing ---- --
-- >>> bitraverse listToMaybe (find odd) (Left [1, 2, 3]) -- Just (Left 1) ---- --
-- >>> bitraverse listToMaybe (find odd) (Right [4, 5]) -- Just (Right 5) ---- --
-- >>> bitraverse listToMaybe (find odd) ([1, 2, 3], [4, 5]) -- Just (1,5) ---- --
-- >>> bitraverse listToMaybe (find odd) ([], [4, 5]) -- Nothing --bitraverse :: (Bitraversable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d) -- | The parameterizable reader monad. -- -- Computations are functions of a shared environment. -- -- The return function ignores the environment, while -- >>= passes the inherited environment to both -- subcomputations. type Reader r = ReaderT r Identity -- | 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); } -- | Execute a primitive operation. primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a -- | State token type. type family PrimState (m :: Type -> Type) newtype () => FileSize FileSize :: Word -> FileSize -- | Boxed vectors, supporting efficient slicing. data () => Vector a -- | A double-ended queue supporting any underlying vector type and any -- monad. -- -- This implements a circular double-ended queue with exponential growth. data () => Deque (v :: Type -> Type -> Type) s a data () => BlobKey BlobKey :: !SHA256 -> !FileSize -> BlobKey -- | A class for monads in which exceptions may be thrown. -- -- Instances should obey the following law: -- --
-- throwM e >> x = throwM e ---- -- 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 m, not when it is applied. It is a generalization -- of Control.Exception's throwIO. -- -- Should satisfy the law: -- --
-- throwM e >> f = throwM e --throwM :: (MonadThrow m, HasCallStack, Exception e) => e -> m a -- | The class of monad transformers. For any monad m, the result -- t m should also be a monad, and lift should be a monad -- transformation from m to t m, i.e. it should satisfy -- the following laws: -- -- -- -- Since 0.6.0.0 and for GHC 8.6 and later, the requirement that t -- m be a Monad is enforced by the implication constraint -- forall m. Monad m => Monad (t m) enabled by -- the QuantifiedConstraints extension. -- --
-- (MonadTrans t, forall m. Monad m => Monad (t m)) => ... ---- -- to be reported as ambiguous. For transformers 0.6 and later, this can -- be fixed by removing the second constraint, which is implied by the -- first. class forall (m :: Type -> Type). Monad m => Monad t m => 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 -- | Monads which allow their actions to be run in IO. -- -- While MonadIO allows an IO 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 -- MonadUnliftIO to ReaderT and IdentityT -- transformers on top of IO. -- -- Laws. For any function run provided by withRunInIO, it -- must meet the monad transformer laws as reformulated for -- MonadUnliftIO: -- --
run . return = return
run (m >>= f) = run m >>= run . f
-- withRunInIO inner = -- StateT $ \s -> -- withRunInIO $ \run -> -- inner (run . flip evalStateT s) ---- -- This breaks the identity law because the inner run m would -- throw away any state changes in m. class MonadIO m => MonadUnliftIO (m :: Type -> Type) -- | Convenience function for capturing the monadic context and running an -- IO action with a runner function. The runner function is used -- to run a monadic action m in IO. withRunInIO :: MonadUnliftIO m => ((forall a. () => m a -> IO a) -> IO b) -> m b -- | Same as ConduitT, for backwards compat type ConduitM = ConduitT -- | The reader monad transformer, which adds a read-only environment to -- the given monad. -- -- The return function ignores the environment, while -- >>= passes the inherited environment to both -- subcomputations. newtype () => ReaderT r (m :: Type -> Type) a ReaderT :: (r -> m a) -> ReaderT r (m :: Type -> Type) a [runReaderT] :: ReaderT r (m :: Type -> Type) a -> r -> m a -- | General-purpose finite sequences. data () => Seq a -- | A set of integers. data () => IntSet -- | A map of integers to values a. data () => IntMap a data () => SHA256 -- | A file path. data () => File data () => Snapshot Snapshot :: !WantedCompiler -> !Map PackageName SnapshotPackage -> !Set PackageName -> Snapshot [snapshotCompiler] :: Snapshot -> !WantedCompiler [snapshotPackages] :: Snapshot -> !Map PackageName SnapshotPackage [snapshotDrop] :: Snapshot -> !Set PackageName -- | A SimpleGetter s a extracts a from s; so, -- it's the same thing as (s -> a), but you can use it in -- lens chains because its type looks like this: -- --
-- type SimpleGetter s a = -- forall r. (a -> Const r a) -> s -> Const r s ---- -- Since Const r is a functor, SimpleGetter has the same -- shape as other lens types and can be composed with them. To get (s -- -> a) out of a SimpleGetter, choose r ~ a and -- feed Const :: a -> Const a a to the getter: -- --
-- -- the actual signature is more permissive: -- -- view :: Getting a s a -> s -> a -- view :: SimpleGetter s a -> s -> a -- view getter = getConst . getter Const ---- -- The actual Getter from lens is more general: -- --
-- type Getter s a = -- forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s ---- -- I'm not currently aware of any functions that take lens's -- Getter but won't accept SimpleGetter, but you should -- try to avoid exporting SimpleGetters anyway to minimise -- confusion. Alternatively, look at microlens-contra, which -- provides a fully lens-compatible Getter. -- -- Lens users: you can convert a SimpleGetter to Getter -- by applying to . view to it. type SimpleGetter s a = forall r. () => Getting r s a -- | 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 ASetter' and -- Setter'. type ASetter' s a = ASetter s s a a -- | See examples in Control.Monad.Reader. Note, the partially -- applied function type (->) r is a simple reader monad. See -- the instance 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 -- | Where in the application a log message came from. Used for display -- purposes only. type LogSource = Text -- | The log level of a message. data () => LogLevel LevelDebug :: LogLevel LevelInfo :: LogLevel LevelWarn :: LogLevel LevelError :: LogLevel LevelOther :: !Text -> LogLevel newtype () => SnapshotCacheHash SnapshotCacheHash :: SHA256 -> SnapshotCacheHash [unSnapshotCacheHash] :: SnapshotCacheHash -> SHA256 data () => SnapshotLayer SnapshotLayer :: !SnapshotLocation -> !Maybe WantedCompiler -> ![PackageLocationImmutable] -> !Set PackageName -> !Map PackageName (Map FlagName Bool) -> !Map PackageName Bool -> !Map PackageName [Text] -> !Maybe UTCTime -> SnapshotLayer [slParent] :: SnapshotLayer -> !SnapshotLocation [slCompiler] :: SnapshotLayer -> !Maybe WantedCompiler [slLocations] :: SnapshotLayer -> ![PackageLocationImmutable] [slDropPackages] :: SnapshotLayer -> !Set PackageName [slFlags] :: SnapshotLayer -> !Map PackageName (Map FlagName Bool) [slHidden] :: SnapshotLayer -> !Map PackageName Bool [slGhcOptions] :: SnapshotLayer -> !Map PackageName [Text] [slPublishTime] :: SnapshotLayer -> !Maybe UTCTime data () => RawSnapshotLayer RawSnapshotLayer :: !RawSnapshotLocation -> !Maybe WantedCompiler -> ![RawPackageLocationImmutable] -> !Set PackageName -> !Map PackageName (Map FlagName Bool) -> !Map PackageName Bool -> !Map PackageName [Text] -> !Maybe UTCTime -> RawSnapshotLayer [rslParent] :: RawSnapshotLayer -> !RawSnapshotLocation [rslCompiler] :: RawSnapshotLayer -> !Maybe WantedCompiler [rslLocations] :: RawSnapshotLayer -> ![RawPackageLocationImmutable] [rslDropPackages] :: RawSnapshotLayer -> !Set PackageName [rslFlags] :: RawSnapshotLayer -> !Map PackageName (Map FlagName Bool) [rslHidden] :: RawSnapshotLayer -> !Map PackageName Bool [rslGhcOptions] :: RawSnapshotLayer -> !Map PackageName [Text] [rslPublishTime] :: RawSnapshotLayer -> !Maybe UTCTime data () => SnapshotPackage SnapshotPackage :: !PackageLocationImmutable -> !Map FlagName Bool -> !Bool -> ![Text] -> SnapshotPackage [spLocation] :: SnapshotPackage -> !PackageLocationImmutable [spFlags] :: SnapshotPackage -> !Map FlagName Bool [spHidden] :: SnapshotPackage -> !Bool [spGhcOptions] :: SnapshotPackage -> ![Text] data () => RawSnapshotPackage RawSnapshotPackage :: !RawPackageLocationImmutable -> !Map FlagName Bool -> !Bool -> ![Text] -> RawSnapshotPackage [rspLocation] :: RawSnapshotPackage -> !RawPackageLocationImmutable [rspFlags] :: RawSnapshotPackage -> !Map FlagName Bool [rspHidden] :: RawSnapshotPackage -> !Bool [rspGhcOptions] :: RawSnapshotPackage -> ![Text] data () => RawSnapshot RawSnapshot :: !WantedCompiler -> !Map PackageName RawSnapshotPackage -> !Set PackageName -> RawSnapshot [rsCompiler] :: RawSnapshot -> !WantedCompiler [rsPackages] :: RawSnapshot -> !Map PackageName RawSnapshotPackage [rsDrop] :: RawSnapshot -> !Set PackageName data () => SnapshotLocation SLCompiler :: !WantedCompiler -> SnapshotLocation SLUrl :: !Text -> !BlobKey -> SnapshotLocation SLFilePath :: !ResolvedPath File -> SnapshotLocation data () => RawSnapshotLocation RSLCompiler :: !WantedCompiler -> RawSnapshotLocation RSLUrl :: !Text -> !Maybe BlobKey -> RawSnapshotLocation RSLFilePath :: !ResolvedPath File -> RawSnapshotLocation RSLSynonym :: !SnapName -> RawSnapshotLocation data () => SnapName LTS :: !Int -> !Int -> SnapName Nightly :: !Day -> SnapName data () => WantedCompiler WCGhc :: !Version -> WantedCompiler WCGhcGit :: !Text -> !Text -> WantedCompiler WCGhcjs :: !Version -> !Version -> WantedCompiler data () => HpackExecutable HpackBundled :: HpackExecutable HpackCommand :: !FilePath -> HpackExecutable newtype () => CabalString a CabalString :: a -> CabalString a [unCabalString] :: CabalString a -> a data () => ArchiveLocation ALUrl :: !Text -> ArchiveLocation ALFilePath :: !ResolvedPath File -> ArchiveLocation newtype () => RelFilePath RelFilePath :: Text -> RelFilePath data () => PackageMetadata PackageMetadata :: !PackageIdentifier -> !TreeKey -> PackageMetadata [pmIdent] :: PackageMetadata -> !PackageIdentifier [pmTreeKey] :: PackageMetadata -> !TreeKey data () => RawPackageMetadata RawPackageMetadata :: !Maybe PackageName -> !Maybe Version -> !Maybe TreeKey -> RawPackageMetadata [rpmName] :: RawPackageMetadata -> !Maybe PackageName [rpmVersion] :: RawPackageMetadata -> !Maybe Version [rpmTreeKey] :: RawPackageMetadata -> !Maybe TreeKey newtype () => TreeKey TreeKey :: BlobKey -> TreeKey data () => SafeFilePath data () => FuzzyResults FRNameNotFound :: ![PackageName] -> FuzzyResults FRVersionNotFound :: !NonEmpty PackageIdentifierRevision -> FuzzyResults FRRevisionNotFound :: !NonEmpty PackageIdentifierRevision -> FuzzyResults data () => PantryException PackageIdentifierRevisionParseFail :: !Text -> PantryException InvalidCabalFile :: !Either RawPackageLocationImmutable (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PantryException TreeWithoutCabalFile :: !RawPackageLocationImmutable -> PantryException TreeWithMultipleCabalFiles :: !RawPackageLocationImmutable -> ![SafeFilePath] -> PantryException MismatchedCabalName :: !Path Abs File -> !PackageName -> PantryException NoLocalPackageDirFound :: !Path Abs Dir -> PantryException NoCabalFileFound :: !Path Abs Dir -> PantryException MultipleCabalFilesFound :: !Path Abs Dir -> ![Path Abs File] -> PantryException InvalidWantedCompiler :: !Text -> PantryException InvalidSnapshotLocation :: !Path Abs Dir -> !Text -> PantryException InvalidOverrideCompiler :: !WantedCompiler -> !WantedCompiler -> PantryException InvalidFilePathSnapshot :: !Text -> PantryException InvalidSnapshot :: !RawSnapshotLocation -> !SomeException -> PantryException MismatchedPackageMetadata :: !RawPackageLocationImmutable -> !RawPackageMetadata -> !Maybe TreeKey -> !PackageIdentifier -> PantryException Non200ResponseStatus :: !Status -> PantryException InvalidBlobKey :: !Mismatch BlobKey -> PantryException Couldn'tParseSnapshot :: !RawSnapshotLocation -> !String -> PantryException WrongCabalFileName :: !RawPackageLocationImmutable -> !SafeFilePath -> !PackageName -> PantryException DownloadInvalidSHA256 :: !Text -> !Mismatch SHA256 -> PantryException DownloadInvalidSize :: !Text -> !Mismatch FileSize -> PantryException DownloadTooLarge :: !Text -> !Mismatch FileSize -> PantryException LocalNoArchiveFileFound :: !Path Abs File -> PantryException LocalInvalidSHA256 :: !Path Abs File -> !Mismatch SHA256 -> PantryException LocalInvalidSize :: !Path Abs File -> !Mismatch FileSize -> PantryException UnknownArchiveType :: !ArchiveLocation -> PantryException InvalidTarFileType :: !ArchiveLocation -> !FilePath -> !FileType -> PantryException UnsupportedTarball :: !ArchiveLocation -> !Text -> PantryException NoHackageCryptographicHash :: !PackageIdentifier -> PantryException FailedToCloneRepo :: !SimpleRepo -> PantryException TreeReferencesMissingBlob :: !RawPackageLocationImmutable -> !SafeFilePath -> !BlobKey -> PantryException CompletePackageMetadataMismatch :: !RawPackageLocationImmutable -> !PackageMetadata -> PantryException CRC32Mismatch :: !ArchiveLocation -> !FilePath -> !Mismatch Word32 -> PantryException UnknownHackagePackage :: !PackageIdentifierRevision -> !FuzzyResults -> PantryException CannotCompleteRepoNonSHA1 :: !Repo -> PantryException MutablePackageLocationFromUrl :: !Text -> PantryException MismatchedCabalFileForHackage :: !PackageIdentifierRevision -> !Mismatch PackageIdentifier -> PantryException PackageNameParseFail :: !Text -> PantryException PackageVersionParseFail :: !Text -> PantryException InvalidCabalFilePath :: !Path Abs File -> PantryException DuplicatePackageNames :: !Utf8Builder -> ![(PackageName, [RawPackageLocationImmutable])] -> PantryException MigrationFailure :: !Text -> !Path Abs File -> !SomeException -> PantryException NoCasaConfig :: PantryException InvalidTreeFromCasa :: !BlobKey -> !ByteString -> PantryException ParseSnapNameException :: !Text -> PantryException HpackLibraryException :: !Path Abs File -> !String -> PantryException HpackExeException :: !FilePath -> !Path Abs Dir -> !SomeException -> PantryException data () => Mismatch a Mismatch :: !a -> !a -> Mismatch a [mismatchExpected] :: Mismatch a -> !a [mismatchActual] :: Mismatch a -> !a data () => PackageIdentifierRevision PackageIdentifierRevision :: !PackageName -> !Version -> !CabalFileInfo -> PackageIdentifierRevision data () => CabalFileInfo CFILatest :: CabalFileInfo CFIHash :: !SHA256 -> !Maybe FileSize -> CabalFileInfo CFIRevision :: !Revision -> CabalFileInfo class () => HasPantryConfig env pantryConfigL :: HasPantryConfig env => Lens' env PantryConfig data () => HackageSecurityConfig HackageSecurityConfig :: ![Text] -> !Int -> !Bool -> HackageSecurityConfig [hscKeyIds] :: HackageSecurityConfig -> ![Text] [hscKeyThreshold] :: HackageSecurityConfig -> !Int [hscIgnoreExpiry] :: HackageSecurityConfig -> !Bool data () => PackageIndexConfig PackageIndexConfig :: !Text -> !HackageSecurityConfig -> PackageIndexConfig [picDownloadPrefix] :: PackageIndexConfig -> !Text [picHackageSecurityConfig] :: PackageIndexConfig -> !HackageSecurityConfig data () => SimpleRepo SimpleRepo :: !Text -> !Text -> !RepoType -> SimpleRepo [sRepoUrl] :: SimpleRepo -> !Text [sRepoCommit] :: SimpleRepo -> !Text [sRepoType] :: SimpleRepo -> !RepoType data () => Repo Repo :: !Text -> !Text -> !RepoType -> !Text -> Repo [repoUrl] :: Repo -> !Text [repoCommit] :: Repo -> !Text [repoType] :: Repo -> !RepoType [repoSubdir] :: Repo -> !Text data () => Archive Archive :: !ArchiveLocation -> !SHA256 -> !FileSize -> !Text -> Archive [archiveLocation] :: Archive -> !ArchiveLocation [archiveHash] :: Archive -> !SHA256 [archiveSize] :: Archive -> !FileSize [archiveSubdir] :: Archive -> !Text data () => RawArchive RawArchive :: !ArchiveLocation -> !Maybe SHA256 -> !Maybe FileSize -> !Text -> RawArchive [raLocation] :: RawArchive -> !ArchiveLocation [raHash] :: RawArchive -> !Maybe SHA256 [raSize] :: RawArchive -> !Maybe FileSize [raSubdir] :: RawArchive -> !Text data () => PackageLocationImmutable PLIHackage :: !PackageIdentifier -> !BlobKey -> !TreeKey -> PackageLocationImmutable PLIArchive :: !Archive -> !PackageMetadata -> PackageLocationImmutable PLIRepo :: !Repo -> !PackageMetadata -> PackageLocationImmutable data () => RawPackageLocationImmutable RPLIHackage :: !PackageIdentifierRevision -> !Maybe TreeKey -> RawPackageLocationImmutable RPLIArchive :: !RawArchive -> !RawPackageMetadata -> RawPackageLocationImmutable RPLIRepo :: !Repo -> !RawPackageMetadata -> RawPackageLocationImmutable data () => PackageLocation PLImmutable :: !PackageLocationImmutable -> PackageLocation PLMutable :: !ResolvedPath Dir -> PackageLocation data () => RawPackageLocation RPLImmutable :: !RawPackageLocationImmutable -> RawPackageLocation RPLMutable :: !ResolvedPath Dir -> RawPackageLocation data () => ResolvedPath t ResolvedPath :: !RelFilePath -> !Path Abs t -> ResolvedPath t [resolvedRelative] :: ResolvedPath t -> !RelFilePath [resolvedAbsolute] :: ResolvedPath t -> !Path Abs t data () => Unresolved a data () => PrintWarnings YesPrintWarnings :: PrintWarnings NoPrintWarnings :: PrintWarnings data () => PantryConfig newtype () => Revision Revision :: Word -> Revision -- | Require that the Hackage index is populated. data () => RequireHackageIndex -- | If there is nothing in the Hackage index, then perform an update YesRequireHackageIndex :: RequireHackageIndex -- | Do not perform an update NoRequireHackageIndex :: RequireHackageIndex -- | Should we pay attention to Hackage's preferred versions? data () => UsePreferredVersions UsePreferredVersions :: UsePreferredVersions IgnorePreferredVersions :: UsePreferredVersions -- | Did an update occur when running updateHackageIndex? data () => DidUpdateOccur UpdateOccurred :: DidUpdateOccur NoUpdateOccurred :: DidUpdateOccur -- | Convenient data type that allows you to work with pantry more easily -- than using withPantryConfig or withPantryConfig' -- directly. Uses basically sane settings, like sharing a pantry -- directory with Stack. -- -- You can use runPantryApp to use this. data () => PantryApp -- | Package settings to be passed to addPackagesToSnapshot. data () => AddPackagesConfig AddPackagesConfig :: !Set PackageName -> !Map PackageName (Map FlagName Bool) -> !Map PackageName Bool -> !Map PackageName [Text] -> AddPackagesConfig [apcDrop] :: AddPackagesConfig -> !Set PackageName [apcFlags] :: AddPackagesConfig -> !Map PackageName (Map FlagName Bool) [apcHiddens] :: AddPackagesConfig -> !Map PackageName Bool [apcGhcOptions] :: AddPackagesConfig -> !Map PackageName [Text] -- | A completed snapshot location, including the original raw and -- completed information. data () => CompletedSL CompletedSL :: !RawSnapshotLocation -> !SnapshotLocation -> CompletedSL -- | A completed package location, including the original raw and completed -- information. data () => CompletedPLI CompletedPLI :: !RawPackageLocationImmutable -> !PackageLocationImmutable -> CompletedPLI -- | Complete package location, plus whether the package has a cabal file. -- This is relevant to reproducibility, see -- https://tech.fpcomplete.com/blog/storing-generated-cabal-files data () => CompletePackageLocation CompletePackageLocation :: !PackageLocationImmutable -> !Bool -> CompletePackageLocation [cplComplete] :: CompletePackageLocation -> !PackageLocationImmutable [cplHasCabalFile] :: CompletePackageLocation -> !Bool -- | An absolute path. data () => Abs -- | A relative path; one without a root. Note that a .. path -- component to represent the parent directory is not allowed by this -- library. data () => Rel -- | A directory path. data () => Dir -- | 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 -- | 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 -- | A set of values. A set cannot contain duplicate values. data () => HashSet a class (Vector Vector a, MVector MVector a) => Unbox a -- | A typeclass for values which can be converted to a Utf8Builder. -- 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 Text, which will also be used for -- display if it is not overriden. textDisplay :: Display a => a -> Text -- | 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 type LText = Text type LByteString = ByteString type GVector = Vector type SVector = Vector type UVector = Vector -- | Source of a log. This can be whatever you want. Use for your generic -- log data types that want to sit inside the classic log framework. class () => HasLogSource msg getLogSource :: HasLogSource msg => msg -> LogSource -- | Level, if any, of your logs. If unknown, use LogOther. Use -- for your generic log data types that want to sit inside the classic -- log framework. class () => HasLogLevel msg getLogLevel :: HasLogLevel msg => msg -> LogLevel -- | A generic logger of some type msg. -- -- Your GLocFunc can re-use the existing classical logging -- framework of RIO, and/or implement additional transforms, filters. -- Alternatively, you may log to a JSON source in a database, or anywhere -- else as needed. You can decide how to log levels or severities based -- on the constructors in your type. You will normally determine this in -- your main app entry point. data () => GLogFunc msg -- | An app is capable of generic logging if it implements this. class () => HasGLogFunc env where { type family GMsg env; } gLogFuncL :: HasGLogFunc env => Lens' env (GLogFunc (GMsg env)) type family GMsg env -- | Configuration for how to create a LogFunc. Intended to be used -- with the withLogFunc function. data () => LogOptions -- | Environment values with a logging function. class () => HasLogFunc env logFuncL :: HasLogFunc env => Lens' env LogFunc -- | A Deque specialized to boxed vectors. type BDeque = Deque MVector -- | A Deque specialized to storable vectors. type SDeque = Deque MVector -- | A Deque specialized to unboxed vectors. type UDeque = Deque MVector -- | Helpful type synonym for using a URef from an IO-based -- stack. type IOURef = URef PrimState IO -- | An unboxed reference. This works like an IORef, 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: -- https://stackoverflow.com/questions/27261813/why-is-my-little-stref-int-require-allocating-gigabytes. -- -- The first parameter is the state token type, the same as would be used -- for the ST monad. If you're using an IO-based monad, you -- can use the convenience IOURef type synonym instead. data () => URef s a -- | Environment values with writing capabilities to SomeRef class () => HasWriteRef w env | env -> w writeRefL :: HasWriteRef w env => Lens' env (SomeRef w) -- | Environment values with stateful capabilities to SomeRef class () => HasStateRef s env | env -> s stateRefL :: HasStateRef s env => Lens' env (SomeRef s) -- | Abstraction over how to read from and write to a mutable reference data () => SomeRef a -- | A simple, non-customizable environment type for RIO, which -- provides common functionality. If it's insufficient for your needs, -- define your own, custom App data type. data () => SimpleApp -- | Wrap up a synchronous exception to be treated as an asynchronous -- exception -- -- This is intended to be created via toAsyncException data () => AsyncExceptionWrapper AsyncExceptionWrapper :: e -> AsyncExceptionWrapper -- | Wrap up an asynchronous exception to be treated as a synchronous -- exception -- -- This is intended to be created via toSyncException data () => SyncExceptionWrapper SyncExceptionWrapper :: e -> SyncExceptionWrapper -- | Exception type thrown by throwString. -- -- 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 -- | TBQueue is an abstract type representing a bounded FIFO -- channel. data () => TBQueue a -- | TChan is an abstract type representing an unbounded FIFO -- channel. data () => TChan a -- | A TMVar 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 -- | TQueue is an abstract type representing an unbounded FIFO -- channel. data () => TQueue a -- | Things that can go wrong in the structure of a Conc. These are -- programmer errors. data () => ConcException EmptyWithNoAlternative :: ConcException -- | A more efficient alternative to Concurrently, which reduces the -- number of threads that need to be forked. For more information, see -- this blog post. This is provided as a separate type to -- Concurrently as it has a slightly different API. -- -- Use the conc function to construct values of type Conc, -- and runConc to execute the composed actions. You can use the -- Applicative instance to run different actions and wait for -- all of them to complete, or the Alternative 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 AsyncCancelled 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 mapConcurrently. -- -- There are some intentional differences in behavior to -- Concurrently: -- --
-- comparing p x y = compare (p x) (p y) ---- -- Useful combinator for use in conjunction with the xxxBy -- family of functions from Data.List, for example: -- --
-- ... sortBy (comparing fst) ... --comparing :: Ord a => (b -> a) -> b -> b -> Ordering -- | Unlifted concurrently. concurrently :: MonadUnliftIO m => m a -> m b -> m (a, b) -- | 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: -- --
-- withTempFile "src" "sdist." $ \tmpFile hFile -> do ... ---- -- The tmpFile will be file in the given directory, e.g. -- src/sdist.342. 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: -- --
-- withTempDirectory "src" "sdist." $ \tmpDir -> do ... ---- -- The tmpDir will be a new subdirectory of the given directory, -- e.g. src/sdist.342. withTempDirectory :: MonadUnliftIO m => FilePath -> String -> (FilePath -> m a) -> m a -- | Lifted cancel. cancel :: MonadIO m => Async a -> m () -- | Unlifted withAsync. withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b -- | Lifted uninterruptibleCancel. uninterruptibleCancel :: MonadIO m => Async a -> m () -- | Lifted wait. wait :: MonadIO m => Async a -> m a -- | Lifted waitCatch. waitCatch :: MonadIO m => Async a -> m (Either SomeException a) -- | Append two lists, i.e., -- --
-- [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn] -- [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...] ---- -- If the first list is not finite, the result is the first list. -- -- WARNING: This function takes linear time in the number of elements of -- the first list. (++) :: [a] -> [a] -> [a] infixr 5 ++ -- | The value of seq a b is bottom if a is -- bottom, and otherwise equal to b. In other words, it -- evaluates the first argument a to weak head normal form -- (WHNF). seq is usually introduced to improve performance by -- avoiding unneeded laziness. -- -- A note on evaluation order: the expression seq a b -- does not guarantee that a will be evaluated before -- b. The only guarantee given by seq is that the both -- a and b will be evaluated before seq returns -- a value. In particular, this means that b may be evaluated -- before a. If you need to guarantee a specific order of -- evaluation, you must use the function pseq from the -- "parallel" package. seq :: forall {r :: RuntimeRep} a (b :: TYPE r). a -> b -> b infixr 0 `seq` -- | <math>. filter, applied to a predicate and a list, -- returns the list of those elements that satisfy the predicate; i.e., -- --
-- filter p xs = [ x | x <- xs, p x] ---- --
-- >>> filter odd [1, 2, 3] -- [1,3] --filter :: (a -> Bool) -> [a] -> [a] -- | <math>. zip takes two lists and returns a list of -- corresponding pairs. -- --
-- >>> zip [1, 2] ['a', 'b'] -- [(1,'a'),(2,'b')] ---- -- If one input list is shorter than the other, excess elements of the -- longer list are discarded, even if one of the lists is infinite: -- --
-- >>> zip [1] ['a', 'b'] -- [(1,'a')] -- -- >>> zip [1, 2] ['a'] -- [(1,'a')] -- -- >>> zip [] [1..] -- [] -- -- >>> zip [1..] [] -- [] ---- -- zip is right-lazy: -- --
-- >>> zip [] undefined -- [] -- -- >>> zip undefined [] -- *** Exception: Prelude.undefined -- ... ---- -- zip is capable of list fusion, but it is restricted to its -- first list argument and its resulting list. zip :: [a] -> [b] -> [(a, b)] -- | otherwise is defined as the value True. It helps to make -- guards more readable. eg. -- --
-- f x | x < 0 = ... -- | otherwise = ... --otherwise :: Bool -- | <math>. map f xs is the list obtained by -- applying f to each element of xs, i.e., -- --
-- map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn] -- map f [x1, x2, ...] == [f x1, f x2, ...] ---- --
-- >>> map (+1) [1, 2, 3] -- [2,3,4] --map :: (a -> b) -> [a] -> [b] -- | Application operator. This operator is redundant, since ordinary -- application (f x) means the same as (f $ x). -- However, $ has low, right-associative binding precedence, so it -- sometimes allows parentheses to be omitted; for example: -- --
-- f $ g $ h x = f (g (h x)) ---- -- It is also useful in higher-order situations, such as map -- ($ 0) xs, or zipWith ($) fs xs. -- -- Note that ($) is representation-polymorphic in its -- result type, so that foo $ True where foo :: Bool -- -> Int# is well-typed. ($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b infixr 0 $ -- | General coercion from Integral types. -- -- WARNING: This function performs silent truncation if the result type -- is not at least as big as the argument's type. fromIntegral :: (Integral a, Num b) => a -> b -- | General coercion to Fractional types. -- -- WARNING: This function goes through the Rational type, which -- does not have values for NaN for example. This means it does -- not round-trip. -- -- For Double it also behaves differently with or without -O0: -- --
-- Prelude> realToFrac nan -- With -O0 -- -Infinity -- Prelude> realToFrac nan -- NaN --realToFrac :: (Real a, Fractional b) => a -> b -- | Conditional failure of Alternative computations. Defined by -- --
-- guard True = pure () -- guard False = empty ---- --
-- >>> safeDiv 4 0 -- Nothing ---- --
-- >>> safeDiv 4 2 -- Just 2 ---- -- A definition of safeDiv using guards, but not guard: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y | y /= 0 = Just (x `div` y) -- | otherwise = Nothing ---- -- A definition of safeDiv using guard and Monad -- do-notation: -- --
-- safeDiv :: Int -> Int -> Maybe Int -- safeDiv x y = do -- guard (y /= 0) -- return (x `div` y) --guard :: Alternative f => Bool -> f () -- | The join 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. -- -- 'join bss' can be understood as the do -- expression -- --
-- do bs <- bss -- bs ---- --
-- atomically :: STM a -> IO a ---- -- is used to run STM transactions atomically. So, by specializing -- the types of atomically and join to -- --
-- atomically :: STM (IO b) -> IO (IO b) -- join :: IO (IO b) -> IO b ---- -- we can compose them as -- --
-- join . atomically :: STM (IO b) -> IO b ---- -- to run an STM transaction and the IO action it returns. join :: Monad m => m (m a) -> m a -- | Boolean "and", lazy in the second argument (&&) :: Bool -> Bool -> Bool infixr 3 && -- | Boolean "or", lazy in the second argument (||) :: Bool -> Bool -> Bool infixr 2 || -- | Boolean "not" not :: Bool -> Bool -- | error stops execution and displays an error message. error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a -- | A special case of error. It is expected that compilers will -- recognize this and insert error messages which are more appropriate to -- the context in which undefined appears. undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a -- | Since Void values logically don't exist, this witnesses the -- logical reasoning tool of "ex falso quodlibet". -- --
-- >>> let x :: Either Void Int; x = Right 5
--
-- >>> :{
-- case x of
-- Right r -> r
-- Left l -> absurd l
-- :}
-- 5
--
absurd :: Void -> a
-- | Same as >>=, but with the arguments interchanged.
(=<<) :: Monad m => (a -> m b) -> m a -> m b
infixr 1 =<<
-- | Conditional execution of Applicative expressions. For example,
--
-- -- when debug (putStrLn "Debugging") ---- -- will output the string Debugging if the Boolean value -- debug is True, 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, -- --
-- liftM2 (+) [0,1] [0,2] = [0,2,1,3] -- liftM2 (+) (Just 1) Nothing = Nothing --liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r -- | Identity function. -- --
-- id x = x --id :: a -> a -- | const x y always evaluates to x, ignoring its second -- argument. -- --
-- >>> const 42 "hello" -- 42 ---- --
-- >>> map (const 42) [0..3] -- [42,42,42,42] --const :: a -> b -> a -- | Function composition. (.) :: (b -> c) -> (a -> b) -> a -> c infixr 9 . -- | flip f takes its (first) two arguments in the reverse -- order of f. -- --
-- >>> flip (++) "hello" "world" -- "worldhello" --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. ($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b infixr 0 $! -- | asTypeOf is a type-restricted version of const. 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 flip (-). -- -- Because - is treated specially in the Haskell grammar, -- (- e) is not a section, but an application of -- prefix negation. However, (subtract -- exp) is equivalent to the disallowed section. subtract :: Num a => a -> a -> a -- | The maybe function takes a default value, a function, and a -- Maybe value. If the Maybe value is Nothing, the -- function returns the default value. Otherwise, it applies the function -- to the value inside the Just and returns the result. -- --
-- >>> maybe False odd (Just 3) -- True ---- --
-- >>> maybe False odd Nothing -- False ---- -- Read an integer from a string using readMaybe. If we succeed, -- return twice the integer; that is, apply (*2) to it. If -- instead we fail to parse an integer, return 0 by default: -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> maybe 0 (*2) (readMaybe "5") -- 10 -- -- >>> maybe 0 (*2) (readMaybe "") -- 0 ---- -- Apply show to a Maybe Int. If we have Just n, -- we want to show the underlying Int n. But if we have -- Nothing, we return the empty string instead of (for example) -- "Nothing": -- --
-- >>> maybe "" show (Just 5) -- "5" -- -- >>> maybe "" show Nothing -- "" --maybe :: b -> (a -> b) -> Maybe a -> b -- | The isJust function returns True iff its argument is of -- the form Just _. -- --
-- >>> isJust (Just 3) -- True ---- --
-- >>> isJust (Just ()) -- True ---- --
-- >>> isJust Nothing -- False ---- -- Only the outer constructor is taken into consideration: -- --
-- >>> isJust (Just Nothing) -- True --isJust :: Maybe a -> Bool -- | The isNothing function returns True iff its argument is -- Nothing. -- --
-- >>> isNothing (Just 3) -- False ---- --
-- >>> isNothing (Just ()) -- False ---- --
-- >>> isNothing Nothing -- True ---- -- Only the outer constructor is taken into consideration: -- --
-- >>> isNothing (Just Nothing) -- False --isNothing :: Maybe a -> Bool -- | The fromMaybe function takes a default value and a Maybe -- value. If the Maybe is Nothing, it returns the default -- value; otherwise, it returns the value contained in the Maybe. -- --
-- >>> fromMaybe "" (Just "Hello, World!") -- "Hello, World!" ---- --
-- >>> fromMaybe "" Nothing -- "" ---- -- Read an integer from a string using readMaybe. If we fail to -- parse an integer, we want to return 0 by default: -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> fromMaybe 0 (readMaybe "5") -- 5 -- -- >>> fromMaybe 0 (readMaybe "") -- 0 --fromMaybe :: a -> Maybe a -> a -- | The maybeToList function returns an empty list when given -- Nothing or a singleton list when given Just. -- --
-- >>> maybeToList (Just 7) -- [7] ---- --
-- >>> maybeToList Nothing -- [] ---- -- One can use maybeToList to avoid pattern matching when combined -- with a function that (safely) works on lists: -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> sum $ maybeToList (readMaybe "3") -- 3 -- -- >>> sum $ maybeToList (readMaybe "") -- 0 --maybeToList :: Maybe a -> [a] -- | The listToMaybe function returns Nothing on an empty -- list or Just a where a is the first element -- of the list. -- --
-- >>> listToMaybe [] -- Nothing ---- --
-- >>> listToMaybe [9] -- Just 9 ---- --
-- >>> listToMaybe [1,2,3] -- Just 1 ---- -- Composing maybeToList with listToMaybe should be the -- identity on singleton/empty lists: -- --
-- >>> maybeToList $ listToMaybe [5] -- [5] -- -- >>> maybeToList $ listToMaybe [] -- [] ---- -- But not on lists with more than one element: -- --
-- >>> maybeToList $ listToMaybe [1,2,3] -- [1] --listToMaybe :: [a] -> Maybe a -- | The catMaybes function takes a list of Maybes and -- returns a list of all the Just values. -- --
-- >>> catMaybes [Just 1, Nothing, Just 3] -- [1,3] ---- -- When constructing a list of Maybe values, catMaybes can -- be used to return all of the "success" results (if the list is the -- result of a map, then mapMaybe would be more -- appropriate): -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ] -- [Just 1,Nothing,Just 3] -- -- >>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ] -- [1,3] --catMaybes :: [Maybe a] -> [a] -- | The mapMaybe function is a version of map which can -- throw out elements. In particular, the functional argument returns -- something of type Maybe b. If this is Nothing, -- no element is added on to the result list. If it is Just -- b, then b is included in the result list. -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> let readMaybeInt = readMaybe :: String -> Maybe Int -- -- >>> mapMaybe readMaybeInt ["1", "Foo", "3"] -- [1,3] -- -- >>> catMaybes $ map readMaybeInt ["1", "Foo", "3"] -- [1,3] ---- -- If we map the Just constructor, the entire list should be -- returned: -- --
-- >>> mapMaybe Just [1,2,3] -- [1,2,3] --mapMaybe :: (a -> Maybe b) -> [a] -> [b] -- | replicate n x is a list of length n with -- x the value of every element. It is an instance of the more -- general genericReplicate, in which n may be of any -- integral type. -- --
-- >>> replicate 0 True -- [] -- -- >>> replicate (-1) True -- [] -- -- >>> replicate 4 True -- [True,True,True,True] --replicate :: Int -> a -> [a] -- | takeWhile, applied to a predicate p and a list -- xs, returns the longest prefix (possibly empty) of -- xs of elements that satisfy p. -- --
-- >>> takeWhile (< 3) [1,2,3,4,1,2,3,4] -- [1,2] -- -- >>> takeWhile (< 9) [1,2,3] -- [1,2,3] -- -- >>> takeWhile (< 0) [1,2,3] -- [] --takeWhile :: (a -> Bool) -> [a] -> [a] -- | dropWhile p xs returns the suffix remaining after -- takeWhile p xs. -- --
-- >>> dropWhile (< 3) [1,2,3,4,5,1,2,3] -- [3,4,5,1,2,3] -- -- >>> dropWhile (< 9) [1,2,3] -- [] -- -- >>> dropWhile (< 0) [1,2,3] -- [1,2,3] --dropWhile :: (a -> Bool) -> [a] -> [a] -- | take n, applied to a list xs, returns the -- prefix of xs of length n, or xs itself if -- n >= length xs. -- --
-- >>> 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] -- [] ---- -- It is an instance of the more general genericTake, in which -- n may be of any integral type. take :: Int -> [a] -> [a] -- | drop n xs returns the suffix of xs after the -- first n elements, or [] if n >= length -- xs. -- --
-- >>> 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] ---- -- It is an instance of the more general genericDrop, in which -- n may be of any integral type. drop :: Int -> [a] -> [a] -- | span, applied to a predicate p and a list xs, -- returns a tuple where first element is longest prefix (possibly empty) -- of xs of elements that satisfy p and second element -- is the remainder of the list: -- --
-- >>> span (< 3) [1,2,3,4,1,2,3,4] -- ([1,2],[3,4,1,2,3,4]) -- -- >>> span (< 9) [1,2,3] -- ([1,2,3],[]) -- -- >>> span (< 0) [1,2,3] -- ([],[1,2,3]) ---- -- span p xs is equivalent to (takeWhile p xs, -- dropWhile p xs) span :: (a -> Bool) -> [a] -> ([a], [a]) -- | break, applied to a predicate p and a list -- xs, returns a tuple where first element is longest prefix -- (possibly empty) of xs of elements that do not satisfy -- p and second element is the remainder of the list: -- --
-- >>> break (> 3) [1,2,3,4,1,2,3,4] -- ([1,2,3],[4,1,2,3,4]) -- -- >>> break (< 9) [1,2,3] -- ([],[1,2,3]) -- -- >>> break (> 9) [1,2,3] -- ([1,2,3],[]) ---- -- break p is equivalent to span (not . -- p). break :: (a -> Bool) -> [a] -> ([a], [a]) -- | reverse xs returns the elements of xs in -- reverse order. xs must be finite. -- --
-- >>> reverse [] -- [] -- -- >>> reverse [42] -- [42] -- -- >>> reverse [2,5,7] -- [7,5,2] -- -- >>> reverse [1..] -- * Hangs forever * --reverse :: [a] -> [a] -- | <math>. lookup key assocs looks up a key in an -- association list. For the result to be Nothing, the list must -- be finite. -- --
-- >>> lookup 2 [] -- Nothing -- -- >>> lookup 2 [(1, "first")] -- Nothing -- -- >>> lookup 2 [(1, "first"), (2, "second"), (3, "third")] -- Just "second" --lookup :: Eq a => a -> [(a, b)] -> Maybe b -- | <math>. zipWith generalises zip by zipping with -- the function given as the first argument, instead of a tupling -- function. -- --
-- zipWith (,) xs ys == zip xs ys -- zipWith f [x1,x2,x3..] [y1,y2,y3..] == [f x1 y1, f x2 y2, f x3 y3..] ---- -- For example, zipWith (+) is applied to two lists to -- produce the list of corresponding sums: -- --
-- >>> zipWith (+) [1, 2, 3] [4, 5, 6] -- [5,7,9] ---- -- zipWith is right-lazy: -- --
-- >>> let f = undefined -- -- >>> zipWith f [] undefined -- [] ---- -- zipWith is capable of list fusion, but it is restricted to its -- first list argument and its resulting list. zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] 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 ^^ -- | gcd x y is the non-negative factor of both x -- and y of which every common factor of x and -- y is also a factor; for example gcd 4 2 = 2, -- gcd (-4) 6 = 2, gcd 0 4 = 4. -- gcd 0 0 = 0. (That is, the common divisor -- that is "greatest" in the divisibility preordering.) -- -- Note: Since for signed fixed-width integer types, abs -- minBound < 0, the result may be negative if one of the -- arguments is minBound (and necessarily is if the other -- is 0 or minBound) for such types. gcd :: Integral a => a -> a -> a -- | lcm x y is the smallest positive integer that both -- x and y divide. lcm :: Integral a => a -> a -> a -- | Extract the first component of a pair. fst :: (a, b) -> a -- | Extract the second component of a pair. snd :: (a, b) -> b -- | curry converts an uncurried function to a curried function. -- --
-- >>> curry fst 1 2 -- 1 --curry :: ((a, b) -> c) -> a -> b -> c -- | uncurry converts a curried function to a function on pairs. -- --
-- >>> uncurry (+) (1,2) -- 3 ---- --
-- >>> uncurry ($) (show, 1) -- "1" ---- --
-- >>> map (uncurry max) [(1,2), (3,4), (6,8)] -- [2,4,8] --uncurry :: (a -> b -> c) -> (a, b) -> c -- | An infix synonym for fmap. -- -- The name of this operator is an allusion to $. Note the -- similarities between their types: -- --
-- ($) :: (a -> b) -> a -> b -- (<$>) :: Functor f => (a -> b) -> f a -> f b ---- -- Whereas $ is function application, <$> is function -- application lifted over a Functor. -- --
-- >>> show <$> Nothing -- Nothing -- -- >>> show <$> Just 3 -- Just "3" ---- -- Convert from an Either Int Int to an -- Either Int String using show: -- --
-- >>> show <$> Left 17 -- Left 17 -- -- >>> show <$> Right 17 -- Right "17" ---- -- Double each element of a list: -- --
-- >>> (*2) <$> [1,2,3] -- [2,4,6] ---- -- Apply even to the second element of a pair: -- --
-- >>> even <$> (2,2) -- (2,True) --(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 <$> -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- --
-- >>> void Nothing -- Nothing -- -- >>> void (Just 3) -- Just () ---- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int (): -- --
-- >>> void (Left 8675309) -- Left 8675309 -- -- >>> void (Right 8675309) -- Right () ---- -- Replace every element of a list with unit: -- --
-- >>> void [1,2,3] -- [(),(),()] ---- -- Replace the second element of a pair with unit: -- --
-- >>> void (1,2) -- (1,()) ---- -- Discard the result of an IO action: -- --
-- >>> mapM print [1,2] -- 1 -- 2 -- [(),()] -- -- >>> void $ mapM print [1,2] -- 1 -- 2 --void :: Functor f => f a -> f () -- | on b u x y runs the binary function b -- on the results of applying unary function u to two -- arguments x and y. From the opposite perspective, it -- transforms two inputs and combines the outputs. -- --
-- ((+) `on` f) x y = f x + f y ---- -- Typical usage: sortBy (compare `on` -- fst). -- -- Algebraic properties: -- --
(*) `on` id = (*) -- (if (*) ∉ {⊥, const -- ⊥})
((*) `on` f) `on` g = (*) `on` (f . g)
flip on f . flip on g = flip on (g . -- f)
-- >>> let s = Left "foo" :: Either String Int -- -- >>> let n = Right 3 :: Either String Int -- -- >>> either length (*2) s -- 3 -- -- >>> either length (*2) n -- 6 --either :: (a -> c) -> (b -> c) -> Either a b -> c -- | Partitions a list of Either into two lists. All the Left -- elements are extracted, in order, to the first component of the -- output. Similarly the Right elements are extracted to the -- second component of the output. -- --
-- >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ] -- -- >>> partitionEithers list -- (["foo","bar","baz"],[3,7]) ---- -- The pair returned by partitionEithers x should be the -- same pair as (lefts x, rights x): -- --
-- >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ] -- -- >>> partitionEithers list == (lefts list, rights list) -- True --partitionEithers :: [Either a b] -> ([a], [b]) -- | Parse a string using the Read instance. Succeeds if there is -- exactly one valid result. -- --
-- >>> readMaybe "123" :: Maybe Int -- Just 123 ---- --
-- >>> readMaybe "hello" :: Maybe Int -- Nothing --readMaybe :: Read a => String -> Maybe a -- | Map each element of a structure to an Applicative action, -- evaluate these actions from left to right, and ignore the results. For -- a version that doesn't ignore the results see traverse. -- -- traverse_ is just like mapM_, but generalised to -- Applicative actions. -- --
-- >>> traverse_ print ["Hello", "world", "!"] -- "Hello" -- "world" -- "!" --traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f () -- | for_ is traverse_ with its arguments flipped. For a -- version that doesn't ignore the results see for. This is -- forM_ generalised to Applicative actions. -- -- for_ is just like forM_, but generalised to -- Applicative actions. -- --
-- >>> for_ [1..4] print -- 1 -- 2 -- 3 -- 4 --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 -- sequence. -- -- sequence_ is just like sequenceA_, but specialised to -- monadic actions. sequence_ :: (Foldable t, Monad m) => t (m a) -> m () -- | The concatenation of all the elements of a container of lists. -- --
-- >>> concat (Just [1, 2, 3]) -- [1,2,3] ---- --
-- >>> concat (Left 42) -- [] ---- --
-- >>> concat [[1, 2, 3], [4, 5], [6], []] -- [1,2,3,4,5,6] --concat :: Foldable t => t [a] -> [a] -- | Map a function over all the elements of a container and concatenate -- the resulting lists. -- --
-- >>> concatMap (take 3) [[1..], [10..], [100..], [1000..]] -- [1,2,3,10,11,12,100,101,102,1000,1001,1002] ---- --
-- >>> concatMap (take 3) (Just [1..]) -- [1,2,3] --concatMap :: Foldable t => (a -> [b]) -> t a -> [b] -- | and returns the conjunction of a container of Bools. For the -- result to be True, the container must be finite; False, -- however, results from a False value finitely far from the left -- end. -- --
-- >>> and [] -- True ---- --
-- >>> and [True] -- True ---- --
-- >>> and [False] -- False ---- --
-- >>> and [True, True, False] -- False ---- --
-- >>> and (False : repeat True) -- Infinite list [False,True,True,True,... -- False ---- --
-- >>> and (repeat True) -- * Hangs forever * --and :: Foldable t => t Bool -> Bool -- | or returns the disjunction of a container of Bools. For the -- result to be False, the container must be finite; True, -- however, results from a True value finitely far from the left -- end. -- --
-- >>> or [] -- False ---- --
-- >>> or [True] -- True ---- --
-- >>> or [False] -- False ---- --
-- >>> or [True, True, False] -- True ---- --
-- >>> or (True : repeat False) -- Infinite list [True,False,False,False,... -- True ---- --
-- >>> or (repeat False) -- * Hangs forever * --or :: Foldable t => t Bool -> Bool -- | Determines whether any element of the structure satisfies the -- predicate. -- --
-- >>> any (> 3) [] -- False ---- --
-- >>> any (> 3) [1,2] -- False ---- --
-- >>> any (> 3) [1,2,3,4,5] -- True ---- --
-- >>> any (> 3) [1..] -- True ---- --
-- >>> any (> 3) [0, -1..] -- * Hangs forever * --any :: Foldable t => (a -> Bool) -> t a -> Bool -- | Determines whether all elements of the structure satisfy the -- predicate. -- --
-- >>> all (> 3) [] -- True ---- --
-- >>> all (> 3) [1,2] -- False ---- --
-- >>> all (> 3) [1,2,3,4,5] -- False ---- --
-- >>> all (> 3) [1..] -- False ---- --
-- >>> all (> 3) [4..] -- * Hangs forever * --all :: Foldable t => (a -> Bool) -> t a -> Bool -- | notElem is the negation of elem. -- --
-- >>> 3 `notElem` [] -- True ---- --
-- >>> 3 `notElem` [1,2] -- True ---- --
-- >>> 3 `notElem` [1,2,3,4,5] -- False ---- -- For infinite structures, notElem terminates if the value exists -- at a finite distance from the left side of the structure: -- --
-- >>> 3 `notElem` [1..] -- False ---- --
-- >>> 3 `notElem` ([4..] ++ [3]) -- * Hangs forever * --notElem :: (Foldable t, Eq a) => a -> t a -> Bool infix 4 `notElem` -- | Splits the argument into a list of lines stripped of their -- terminating \n characters. The \n terminator is -- optional in a final non-empty line of the argument string. -- -- For example: -- --
-- >>> lines "" -- empty input contains no lines -- [] -- -- >>> lines "\n" -- single empty line -- [""] -- -- >>> lines "one" -- single unterminated line -- ["one"] -- -- >>> lines "one\n" -- single non-empty line -- ["one"] -- -- >>> lines "one\n\n" -- second line is empty -- ["one",""] -- -- >>> lines "one\ntwo" -- second line is unterminated -- ["one","two"] -- -- >>> lines "one\ntwo\n" -- two non-empty lines -- ["one","two"] ---- -- When the argument string is empty, or ends in a \n character, -- it can be recovered by passing the result of lines to the -- unlines function. Otherwise, unlines appends the missing -- terminating \n. This makes unlines . lines -- idempotent: -- --
-- (unlines . lines) . (unlines . lines) = (unlines . lines) --lines :: String -> [String] -- | Appends a \n character to each input string, then -- concatenates the results. Equivalent to foldMap (s -> -- s ++ "\n"). -- --
-- >>> unlines ["Hello", "World", "!"] -- "Hello\nWorld\n!\n" ---- -- Note that unlines . lines /= -- id when the input is not \n-terminated: -- --
-- >>> unlines . lines $ "foo\nbar" -- "foo\nbar\n" --unlines :: [String] -> String -- | words breaks a string up into a list of words, which were -- delimited by white space (as defined by isSpace). This function -- trims any white spaces at the beginning and at the end. -- --
-- >>> words "Lorem ipsum\ndolor" -- ["Lorem","ipsum","dolor"] -- -- >>> words " foo bar " -- ["foo","bar"] --words :: String -> [String] -- | unwords joins words with separating spaces (U+0020 SPACE). -- --
-- >>> unwords ["Lorem", "ipsum", "dolor"] -- "Lorem ipsum dolor" ---- -- unwords is neither left nor right inverse of words: -- --
-- >>> words (unwords [" "]) -- [] -- -- >>> unwords (words "foo\nbar") -- "foo bar" --unwords :: [String] -> String -- | Catch a synchronous (but not asynchronous) exception and recover from -- it. -- -- This is parameterized on the exception type. To catch all synchronous -- exceptions, use catchAny. catch :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a -- | Synchronously throw the given exception. -- -- Note that, if you provide an exception value which is of an -- asynchronous type, it will be wrapped up in -- SyncExceptionWrapper. See toSyncException. throwIO :: (MonadIO m, Exception e) => e -> m a -- | Lifted version of evaluate. evaluate :: MonadIO m => a -> m a -- | for is traverse with its arguments flipped. For a -- version that ignores the results see for_. for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b) -- | This generalizes the list-based filter function. filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a] -- | The foldM function is analogous to foldl, except that -- its result is encapsulated in a monad. Note that foldM works -- from left-to-right over the list arguments. This could be an issue -- where (>>) and the `folded function' are not -- commutative. -- --
-- foldM f a1 [x1, x2, ..., xm] -- -- == -- -- do -- a2 <- f a1 x1 -- a3 <- f a2 x2 -- ... -- f am xm ---- -- If right-to-left evaluation is required, the input list should be -- reversed. -- -- Note: foldM is the same as foldlM foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | Lifted version of "System.Exit.exitWith". -- -- @since 0.1.9.0. exitWith :: MonadIO m => ExitCode -> m a -- | Lifted version of "System.Exit.exitFailure". -- -- @since 0.1.9.0. exitFailure :: MonadIO m => m a -- | Lifted version of "System.Exit.exitSuccess". -- -- @since 0.1.9.0. exitSuccess :: MonadIO m => m a -- | a variant of deepseq that is useful in some circumstances: -- --
-- force x = x `deepseq` x ---- -- force x fully evaluates x, and then returns it. Note -- that force x only performs evaluation when the value of -- force x itself is demanded, so essentially it turns shallow -- evaluation into deep evaluation. -- -- force can be conveniently used in combination with -- ViewPatterns: -- --
-- {-# LANGUAGE BangPatterns, ViewPatterns #-}
-- import Control.DeepSeq
--
-- someFun :: ComplexData -> SomeResult
-- someFun (force -> !arg) = {- 'arg' will be fully evaluated -}
--
--
-- Another useful application is to combine force with
-- evaluate in order to force deep evaluation relative to other
-- IO operations:
--
--
-- import Control.Exception (evaluate)
-- import Control.DeepSeq
--
-- main = do
-- result <- evaluate $ force $ pureComputation
-- {- 'result' will be fully evaluated at this point -}
-- return ()
--
--
-- Finally, here's an exception safe variant of the readFile'
-- example:
--
-- -- readFile' :: FilePath -> IO String -- readFile' fn = bracket (openFile fn ReadMode) hClose $ \h -> -- evaluate . force =<< hGetContents h --force :: NFData a => a -> a -- | try specialized to only catching IOExceptions. tryIO :: MonadUnliftIO m => m a -> m (Either IOException a) -- | catch specialized to only catching IOExceptions. catchIO :: MonadUnliftIO m => m a -> (IOException -> m a) -> m a trace :: Text -> a -> a traceShowId :: Show a => a -> a traceShow :: Show a => a -> b -> b -- | Lifted version of hClose hClose :: MonadIO m => Handle -> m () -- | forM_ is mapM_ with its arguments flipped. For a version -- that doesn't ignore the results see forM. -- -- forM_ is just like for_, but specialised to monadic -- actions. forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m () stderr :: Handle stdout :: Handle -- | If the first argument evaluates to True, then the result is the -- second argument. Otherwise an AssertionFailed exception is -- raised, containing a String with the source file and line -- number of the call to assert. -- -- Assertions can normally be turned on or off with a compiler flag (for -- GHC, assertions are normally on unless optimisation is turned on with -- -O or the -fignore-asserts option is given). When -- assertions are turned off, the first argument to assert is -- ignored, and the second argument is returned as the result. assert :: Bool -> a -> a -- | One or none. -- -- It is useful for modelling any computation that is allowed to fail. -- --
-- >>> import Control.Monad.Except ---- --
-- >>> canFail = throwError "it failed" :: Except String Int -- -- >>> final = return 42 :: Except String Int ---- -- Can be combined by allowing the first function to fail: -- --
-- >>> runExcept $ canFail *> final -- Left "it failed" -- -- >>> runExcept $ optional canFail *> final -- Right 42 --optional :: Alternative f => f a -> f (Maybe a) -- | Run the given action and catch any synchronous exceptions as a -- Left value. -- -- This is parameterized on the exception type. To catch all synchronous -- exceptions, use tryAny. try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a) -- | view is a synonym for (^.), generalised for -- MonadReader (we are able to use it instead of (^.) since -- functions are instances of the MonadReader class): -- --
-- >>> view _1 (1, 2) -- 1 ---- -- When you're using Reader for config and your config type has -- lenses generated for it, most of the time you'll be using view -- instead of asks: -- --
-- doSomething :: (MonadReader Config m) => m Int -- doSomething = do -- thingy <- view setting1 -- same as “asks (^. setting1)” -- anotherThingy <- view setting2 -- ... --view :: MonadReader s m => Getting a s a -> m a -- | set is a synonym for (.~). -- -- Setting the 1st component of a pair: -- --
-- set _1 :: x -> (a, b) -> (x, b) -- set _1 = \x t -> (x, snd t) ---- -- Using it to rewrite (<$): -- --
-- set mapped :: Functor f => a -> f b -> f a -- set mapped = (<$) --set :: ASetter s t a b -> b -> s -> t -- | over is a synonym for (%~). -- -- Getting fmap in a roundabout way: -- --
-- over mapped :: Functor f => (a -> b) -> f a -> f b -- over mapped = fmap ---- -- Applying a function to both components of a pair: -- --
-- over both :: (a -> b) -> (a, a) -> (b, b) -- over both = \f t -> (f (fst t), f (snd t)) ---- -- Using over _2 as a replacement for -- second: -- --
-- >>> over _2 show (10,20) -- (10,"20") --over :: ASetter s t a b -> (a -> b) -> s -> t -- | & is a reverse application operator. This provides -- notational convenience. Its precedence is one higher than that of the -- forward application operator $, which allows & to be -- nested in $. -- --
-- >>> 5 & (+1) & show -- "6" --(&) :: a -> (a -> b) -> b infixl 1 & -- | (^.) 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: -- --
-- (^. _1) :: (a, b) -> a -- (^. _1) = fst ---- -- When (^.) is used with a traversal, it combines all results -- using the Monoid instance for the resulting type. For instance, -- for lists it would be simple concatenation: -- --
-- >>> ("str","ing") ^. each
-- "string"
--
--
-- The reason for this is that traversals use Applicative, and the
-- Applicative instance for Const uses monoid concatenation
-- to combine “effects” of Const.
--
-- A non-operator version of (^.) is called view, and
-- it's a bit more general than (^.) (it works in
-- MonadReader). If you need the general version, you can get it
-- from microlens-mtl; otherwise there's view available in
-- Lens.Micro.Extras.
(^.) :: s -> Getting a s a -> a
infixl 8 ^.
-- | (.~) assigns a value to the target. It's the same thing as
-- using (%~) with const:
--
-- -- l .~ x = l %~ const x ---- -- See set if you want a non-operator synonym. -- -- Here it is used to change 2 fields of a 3-tuple: -- --
-- >>> (0,0,0) & _1 .~ 1 & _3 .~ 3 -- (1,0,3) --(.~) :: ASetter s t a b -> b -> s -> t infixr 4 .~ -- | (%~) applies a function to the target; an alternative -- explanation is that it is an inverse of sets, which turns a -- setter into an ordinary function. mapped %~ -- reverse is the same thing as fmap -- reverse. -- -- See over if you want a non-operator synonym. -- -- Negating the 1st element of a pair: -- --
-- >>> (1,2) & _1 %~ negate -- (-1,2) ---- -- Turning all Lefts in a list to upper case: -- --
-- >>> (mapped._Left.mapped %~ toUpper) [Left "foo", Right "bar"] -- [Left "FOO",Right "bar"] --(%~) :: ASetter s t a b -> (a -> b) -> s -> t infixr 4 %~ -- | Convert to a FilePath type. -- -- All directories have a trailing slash, so if you want no trailing -- slash, you can use dropTrailingPathSeparator from the filepath -- package. toFilePath :: Path b t -> FilePath -- | Reverse order of bytes in Word16. byteSwap16 :: Word16 -> Word16 -- | Reverse order of bytes in Word32. byteSwap32 :: Word32 -> Word32 -- | Reverse order of bytes in Word64. byteSwap64 :: Word64 -> Word64 -- | Return True if the given value is a Left-value, -- False otherwise. -- --
-- >>> isLeft (Left "foo") -- True -- -- >>> isLeft (Right 3) -- False ---- -- Assuming a Left value signifies some sort of error, we can use -- isLeft 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 isLeft might be used to avoid pattern -- matching when one does not care about the value contained in the -- constructor: -- --
-- >>> import Control.Monad ( when ) -- -- >>> let report e = when (isLeft e) $ putStrLn "ERROR" -- -- >>> report (Right 1) -- -- >>> report (Left "parse error") -- ERROR --isLeft :: Either a b -> Bool -- | Return the contents of a Left-value or a default value -- otherwise. -- --
-- >>> fromLeft 1 (Left 3) -- 3 -- -- >>> fromLeft 1 (Right "foo") -- 1 --fromLeft :: a -> Either a b -> a -- | Strip out duplicates nubOrd :: Ord a => [a] -> [a] -- | Perform thing, guaranteeing that after will run -- after, even if an exception occurs. -- -- Same interruptible vs uninterrupible points apply as with -- bracket. See base's finally for more -- information. finally :: MonadUnliftIO m => m a -> m b -> m a -- | Flipped version of catch. handle :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a stdin :: Handle -- | Case analysis for the Bool type. bool x y p -- evaluates to x when p is False, and evaluates -- to y when p is True. -- -- This is equivalent to if p then y else x; that is, one can -- think of it as an if-then-else construct with its arguments reordered. -- --
-- >>> bool "foo" "bar" True -- "bar" -- -- >>> bool "foo" "bar" False -- "foo" ---- -- Confirm that bool x y p and if p then y else -- x are equivalent: -- --
-- >>> let p = True; x = "bar"; y = "foo" -- -- >>> bool x y p == if p then y else x -- True -- -- >>> let p = False -- -- >>> bool x y p == if p then y else x -- True --bool :: a -> a -> Bool -> a -- | Same as bracket, but does not pass the acquired resource to -- cleanup and use functions. -- -- For more information, see base's bracket_. bracket_ :: MonadUnliftIO m => m a -> m b -> m c -> m c -- | Lifted version of hIsTerminalDevice hIsTerminalDevice :: MonadIO m => Handle -> m Bool -- | Unlifted asyncBound. asyncBound :: MonadUnliftIO m => m a -> m (Async a) -- | Unlifted asyncOn. asyncOn :: MonadUnliftIO m => Int -> m a -> m (Async a) -- | Unlifted asyncWithUnmask. asyncWithUnmask :: MonadUnliftIO m => ((forall b. () => m b -> m b) -> m a) -> m (Async a) -- | Unlifted asyncOnWithUnmask. asyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall b. () => m b -> m b) -> m a) -> m (Async a) -- | Unlifted withAsyncBound. withAsyncBound :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b -- | Unlifted withAsyncOn. withAsyncOn :: MonadUnliftIO m => Int -> m a -> (Async a -> m b) -> m b -- | Unlifted withAsyncWithUnmask. withAsyncWithUnmask :: MonadUnliftIO m => ((forall c. () => m c -> m c) -> m a) -> (Async a -> m b) -> m b -- | Unlifted withAsyncOnWithMask. withAsyncOnWithUnmask :: MonadUnliftIO m => Int -> ((forall c. () => m c -> m c) -> m a) -> (Async a -> m b) -> m b -- | Lifted poll. poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a)) -- | A version of wait that can be used inside an STM transaction. waitSTM :: Async a -> STM a -- | A version of waitCatch that can be used inside an STM -- transaction. waitCatchSTM :: Async a -> STM (Either SomeException a) -- | A version of poll that can be used inside an STM transaction. pollSTM :: Async a -> STM (Maybe (Either SomeException a)) -- | Lifted cancelWith. Additionally uses toAsyncException to -- ensure async exception safety. cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m () -- | Lifted waitAnyCatch. waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) -- | A version of waitAnyCatch that can be used inside an STM -- transaction. waitAnyCatchSTM :: [Async a] -> STM (Async a, Either SomeException a) -- | Lifted waitAnyCatchCancel. waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) -- | Lifted waitAny. waitAny :: MonadIO m => [Async a] -> m (Async a, a) -- | A version of waitAny that can be used inside an STM -- transaction. waitAnySTM :: [Async a] -> STM (Async a, a) -- | Lifted waitAnyCancel. waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a) -- | Lifted waitEitherCatch. waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) -- | A version of waitEitherCatch that can be used inside an STM -- transaction. waitEitherCatchSTM :: Async a -> Async b -> STM (Either (Either SomeException a) (Either SomeException b)) -- | Lifted waitEitherCatchCancel. waitEitherCatchCancel :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) -- | Lifted waitEither. waitEither :: MonadIO m => Async a -> Async b -> m (Either a b) -- | A version of waitEither that can be used inside an STM -- transaction. waitEitherSTM :: Async a -> Async b -> STM (Either a b) -- | Lifted waitEither_. waitEither_ :: MonadIO m => Async a -> Async b -> m () -- | A version of waitEither_ that can be used inside an STM -- transaction. waitEitherSTM_ :: Async a -> Async b -> STM () -- | Lifted waitEitherCancel. waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a b) -- | Lifted waitBoth. waitBoth :: MonadIO m => Async a -> Async b -> m (a, b) -- | A version of waitBoth that can be used inside an STM -- transaction. waitBothSTM :: Async a -> Async b -> STM (a, b) -- | Lifted link. link :: MonadIO m => Async a -> m () -- | Lifted link2. link2 :: MonadIO m => Async a -> Async b -> m () -- | Unlifted race. race :: MonadUnliftIO m => m a -> m b -> m (Either a b) -- | Unlifted race_. race_ :: MonadUnliftIO m => m a -> m b -> m () -- | Unlifted concurrently_. concurrently_ :: MonadUnliftIO m => m a -> m b -> m () -- | Executes a Traversable container of items concurrently, it uses -- the Flat type internally. mapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b) -- | Similar to mapConcurrently but with arguments flipped forConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b) -- | Executes a Traversable container of items concurrently, it uses -- the Flat type internally. This function ignores the results. mapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m () -- | Similar to mapConcurrently_ but with arguments flipped forConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m () -- | Unlifted replicateConcurrently. replicateConcurrently :: MonadUnliftIO f => Int -> f a -> f [a] -- | Unlifted replicateConcurrently_. replicateConcurrently_ :: (Applicative m, MonadUnliftIO m) => Int -> m a -> 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 mapM. -- -- mapM_ is just like traverse_, but specialised to monadic -- actions. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m () -- | Lifted version of threadDelay. threadDelay :: MonadIO m => Int -> m () -- | Lifted atomicModifyIORef'. atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b -- | Lifted version of atomically atomically :: MonadIO m => STM a -> m a -- | Allocate and clean up a resource safely. -- -- For more information on motivation and usage of this function, see -- base's bracket. This function has two differences from -- the one in base. The first, and more obvious, is that it -- works on any MonadUnliftIO instance, not just IO. -- -- The more subtle difference is that this function will use -- uninterruptible masking for its cleanup handler. This is a subtle -- distinction, but at a high level, means that resource cleanup has more -- guarantees to complete. This comes at the cost that an incorrectly -- written cleanup function cannot be interrupted. -- -- For more information, please see -- https://github.com/fpco/safe-exceptions/issues/3. bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c -- | Lifted version of openFile openFile :: MonadIO m => FilePath -> IOMode -> m Handle -- | forM is mapM with its arguments flipped. For a version -- that ignores the results see forM_. forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b) -- | Throw an asynchronous exception to another thread. -- -- Synchronously typed exceptions will be wrapped into an -- AsyncExceptionWrapper, see -- https://github.com/fpco/safe-exceptions#determining-sync-vs-async. -- -- It's usually a better idea to use the UnliftIO.Async module, -- see https://github.com/fpco/safe-exceptions#quickstart. throwTo :: (Exception e, MonadIO m) => ThreadId -> e -> m () -- | Lifted atomicWriteIORef. atomicWriteIORef :: MonadIO m => IORef a -> a -> m () -- | Lifted atomicModifyIORef. atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b -- | Repeat an action indefinitely. -- --
-- echoServer :: Socket -> IO () -- echoServer socket = forever $ do -- client <- accept socket -- forkFinally (echo client) (\_ -> hClose client) -- where -- echo :: Handle -> IO () -- echo client = forever $ -- hGetLine client >>= hPutStrLn client ---- -- Note that "forever" isn't necessarily non-terminating. If the action -- is in a MonadPlus and short-circuits after some number -- of iterations. then forever actually returns -- mzero, effectively short-circuiting its caller. forever :: Applicative f => f a -> f b -- | Lifted version of hSeek hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> m () -- | Lifted version of hFlush hFlush :: MonadIO m => Handle -> m () -- | Unlifted version of mask. mask :: MonadUnliftIO m => ((forall a. () => m a -> m a) -> m b) -> m b -- | Lifted version of newTChanIO newTChanIO :: MonadIO m => m (TChan a) -- | Lifted version of newBroadcastTChanIO newBroadcastTChanIO :: MonadIO m => m (TChan a) -- | Lifted version of newTQueueIO newTQueueIO :: MonadIO m => m (TQueue a) -- | Lifted version of newTBQueueIO newTBQueueIO :: MonadIO m => Natural -> m (TBQueue a) -- | Lifted version of newTMVarIO newTMVarIO :: MonadIO m => a -> m (TMVar a) -- | bifor is bitraverse with the structure as the first -- argument. For a version that ignores the results, see bifor_. -- --
-- >>> bifor (Left []) listToMaybe (find even) -- Nothing ---- --
-- >>> bifor (Left [1, 2, 3]) listToMaybe (find even) -- Just (Left 1) ---- --
-- >>> bifor (Right [4, 5]) listToMaybe (find even) -- Just (Right 4) ---- --
-- >>> bifor ([1, 2, 3], [4, 5]) listToMaybe (find even) -- Just (1,4) ---- --
-- >>> bifor ([], [4, 5]) listToMaybe (find even) -- Nothing --bifor :: (Bitraversable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f (t c d) -- | Sequences all the actions in a structure, building a new structure -- with the same shape using the results of the actions. For a version -- that ignores the results, see bisequence_. -- --
-- bisequence ≡ bitraverse id id ---- --
-- >>> bisequence (Just 4, Nothing) -- Nothing ---- --
-- >>> bisequence (Just 4, Just 5) -- Just (4,5) ---- --
-- >>> bisequence ([1, 2, 3], [4, 5]) -- [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)] --bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b) -- | Lifted version of hWaitForInput hWaitForInput :: MonadIO m => Handle -> Int -> m Bool -- | Left-to-right composition (>>>) :: forall {k} cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c infixr 1 >>> -- | Lift a function to actions. Equivalent to Functor's fmap but -- implemented using only Applicative's methods: liftA -- f a = pure f <*> a -- -- As such this function may be used to implement a Functor -- instance from an Applicative one. -- --
-- >>> liftA (+1) [1, 2] -- [2,3] ---- -- Or the Applicative instance for Maybe -- --
-- >>> liftA (+1) (Just 3) -- Just 4 --liftA :: Applicative f => (a -> b) -> f a -> f b -- | Lift a ternary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d -- | Return the value computed by a state thread. The forall -- ensures that the internal state used by the ST computation is -- inaccessible to the rest of the program. runST :: (forall s. () => ST s a) -> a -- | Lifted newEmptyMVar. newEmptyMVar :: MonadIO m => m (MVar a) -- | Lifted newMVar. newMVar :: MonadIO m => a -> m (MVar a) -- | Lifted takeMVar. takeMVar :: MonadIO m => MVar a -> m a -- | Lifted readMVar. readMVar :: MonadIO m => MVar a -> m a -- | Lifted putMVar. putMVar :: MonadIO m => MVar a -> a -> m () -- | Lifted tryTakeMVar. tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a) -- | Lifted tryPutMVar. tryPutMVar :: MonadIO m => MVar a -> a -> m Bool -- | Lifted tryReadMVar. tryReadMVar :: MonadIO m => MVar a -> m (Maybe a) -- | Lifted isEmptyMVar. isEmptyMVar :: MonadIO m => MVar a -> m Bool -- | Flipped version of <$>. -- --
-- (<&>) = flip fmap ---- --
-- >>> Just 2 <&> (+1) -- Just 3 ---- --
-- >>> [1,2,3] <&> (+1) -- [2,3,4] ---- --
-- >>> Right 3 <&> (+1) -- Right 4 --(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 <&> -- | Flipped version of <$. -- --
-- >>> Nothing $> "foo" -- Nothing -- -- >>> Just 90210 $> "foo" -- Just "foo" ---- -- Replace the contents of an Either Int -- Int with a constant String, resulting in an -- Either Int String: -- --
-- >>> Left 8675309 $> "foo" -- Left 8675309 -- -- >>> Right 8675309 $> "foo" -- Right "foo" ---- -- Replace each element of a list with a constant String: -- --
-- >>> [1,2,3] $> "foo" -- ["foo","foo","foo"] ---- -- Replace the second element of a pair with a constant String: -- --
-- >>> (1,2) $> "foo" -- (1,"foo") --($>) :: Functor f => f a -> b -> f b infixl 4 $> -- | fix f is the least fixed point of the function -- f, i.e. the least defined x such that f x = -- x. -- -- For example, we can write the factorial function using direct -- recursion as -- --
-- >>> let fac n = if n <= 1 then 1 else n * fac (n-1) in fac 5 -- 120 ---- -- This uses the fact that Haskell’s let introduces recursive -- bindings. We can rewrite this definition using fix, -- --
-- >>> fix (\rec n -> if n <= 1 then 1 else n * rec (n-1)) 5 -- 120 ---- -- Instead of making a recursive call, we introduce a dummy parameter -- rec; when used within fix, this parameter then refers -- to fix’s argument, hence the recursion is reintroduced. fix :: (a -> a) -> a -- | Lifted version of myThreadId. myThreadId :: MonadIO m => m ThreadId -- | Extracts from a list of Either all the Left elements. -- All the Left elements are extracted in order. -- --
-- >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ] -- -- >>> lefts list -- ["foo","bar","baz"] --lefts :: [Either a b] -> [a] -- | Extracts from a list of Either all the Right elements. -- All the Right elements are extracted in order. -- --
-- >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ] -- -- >>> rights list -- [3,7] --rights :: [Either a b] -> [b] -- | Return True if the given value is a Right-value, -- False otherwise. -- --
-- >>> isRight (Left "foo") -- False -- -- >>> isRight (Right 3) -- True ---- -- Assuming a Left value signifies some sort of error, we can use -- isRight to write a very simple reporting function that only -- outputs "SUCCESS" when a computation has succeeded. -- -- This example shows how isRight might be used to avoid pattern -- matching when one does not care about the value contained in the -- constructor: -- --
-- >>> import Control.Monad ( when ) -- -- >>> let report e = when (isRight e) $ putStrLn "SUCCESS" -- -- >>> report (Left "parse error") -- -- >>> report (Right 1) -- SUCCESS --isRight :: Either a b -> Bool -- | Return the contents of a Right-value or a default value -- otherwise. -- --
-- >>> fromRight 1 (Right 3) -- 3 -- -- >>> fromRight 1 (Left "foo") -- 1 --fromRight :: b -> Either a b -> b -- | to creates a getter from any function: -- --
-- a ^. to f = f a ---- -- 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: -- --
-- value ^. _1 . field . at 2 ---- -- However, field isn't a getter, and you have to do this -- instead: -- --
-- field (value ^. _1) ^. at 2 ---- -- but now value is in the middle and it's hard to read the -- resulting code. A variant with to is prettier and more -- readable: -- --
-- value ^. _1 . to field . at 2 --to :: (s -> a) -> SimpleGetter s 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 -- sequenceA. -- -- sequenceA_ is just like sequence_, but generalised to -- Applicative actions. -- --
-- >>> sequenceA_ [print "Hello", print "world", print "!"] -- "Hello" -- "world" -- "!" --sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f () -- | The sum of a collection of actions using (<|>), -- generalizing concat. -- -- asum is just like msum, but generalised to -- Alternative. -- --
-- >>> asum [Just "Hello", Nothing, Just "World"] -- Just "Hello" --asum :: (Foldable t, Alternative f) => t (f a) -> f a -- | The sum of a collection of actions using (<|>), -- generalizing concat. -- -- msum is just like asum, but specialised to -- MonadPlus. -- --
-- >>> msum [Just "Hello", Nothing, Just "World"] -- Just "Hello" --msum :: (Foldable t, MonadPlus m) => t (m a) -> m a -- | catch specialized to catch all synchronous exceptions. catchAny :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a -- | Like finally, but only call after if an exception -- occurs. onException :: MonadUnliftIO m => m a -> m b -> m a -- | Unlifted version of mask_. mask_ :: MonadUnliftIO m => m a -> m a -- | Unlifted version of uninterruptibleMask_. uninterruptibleMask_ :: MonadUnliftIO m => m a -> m a -- | Unlifted version of uninterruptibleMask. uninterruptibleMask :: MonadUnliftIO m => ((forall a. () => m a -> m a) -> m b) -> m b -- | Lifted newIORef. newIORef :: MonadIO m => a -> m (IORef a) -- | Lifted readIORef. readIORef :: MonadIO m => IORef a -> m a -- | Lifted writeIORef. writeIORef :: MonadIO m => IORef a -> a -> m () -- | Unlifted mkWeakIORef. mkWeakIORef :: MonadUnliftIO m => IORef a -> m () -> m (Weak (IORef a)) -- | Lifted modifyIORef. modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m () -- | Lifted modifyIORef'. modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m () asyncExceptionToException :: Exception e => e -> SomeException asyncExceptionFromException :: Exception e => SomeException -> Maybe e -- | Compose two alternative STM actions (GHC only). -- -- If the first action completes without retrying then it forms the -- result of the orElse. Otherwise, if the first action retries, -- then the second action is tried in its place. If both actions retry -- then the orElse as a whole retries. orElse :: STM a -> STM a -> STM a -- | Create a new TVar holding a value supplied newTVar :: a -> STM (TVar a) -- | Lifted version of newTVarIO newTVarIO :: MonadIO m => a -> m (TVar a) -- | Lifted version of readTVarIO readTVarIO :: MonadIO m => TVar a -> m a -- | Return the current value stored in a TVar. readTVar :: TVar a -> STM a -- | Write the supplied value into a TVar. writeTVar :: TVar a -> a -> STM () -- | Unlifted withMVar. withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b -- | Unlifted modifyMVar_. modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () -- | catchJust is like catch 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 catchJust. handleJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a -- | A variant of try 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) -- | Same as bracket, but only perform the cleanup if an exception -- is thrown. bracketOnError :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c -- | Similar to catch, but provides multiple different handler -- functions. -- -- For more information on motivation, see base's -- catches. Note that, unlike that function, this function will -- not catch asynchronous exceptions. catches :: MonadUnliftIO m => m a -> [Handler m a] -> m a -- | Lifted swapMVar. swapMVar :: MonadIO m => MVar a -> a -> m a -- | Unlifted withMVarMasked. withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b -- | Unlifted modifyMVar. modifyMVar :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b -- | Unlifted modifyMVarMasked_. modifyMVarMasked_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () -- | Unlifted modifyMVarMasked. modifyMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m (a, b)) -> m b -- | Unlifted mkWeakMVar. mkWeakMVar :: MonadUnliftIO m => MVar a -> m () -> m (Weak (MVar a)) traceIO :: MonadIO m => Text -> m () -- | Like onException, but provides the handler the thrown -- exception. withException :: (MonadUnliftIO m, Exception e) => m a -> (e -> m b) -> m a -- | Lifted version of registerDelay registerDelay :: MonadIO m => Int -> m (TVar Bool) -- | Lifted version of threadWaitRead. threadWaitRead :: MonadIO m => Fd -> m () -- | Lifted version of threadWaitWrite. threadWaitWrite :: MonadIO m => Fd -> m () -- | Unlifted version of withFile. withFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a -- | Unlifted version of withBinaryFile. withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a -- | Lifted version of hFileSize hFileSize :: MonadIO m => Handle -> m Integer -- | Lifted version of hSetFileSize hSetFileSize :: MonadIO m => Handle -> Integer -> m () -- | Lifted version of hIsEOF hIsEOF :: MonadIO m => Handle -> m Bool -- | Lifted version of hSetBuffering hSetBuffering :: MonadIO m => Handle -> BufferMode -> m () -- | Lifted version of hTell hTell :: MonadIO m => Handle -> m Integer -- | Lifted version of hIsOpen hIsOpen :: MonadIO m => Handle -> m Bool -- | Lifted version of hIsClosed hIsClosed :: MonadIO m => Handle -> m Bool -- | Lifted version of hIsReadable hIsReadable :: MonadIO m => Handle -> m Bool -- | Lifted version of hIsWritable hIsWritable :: MonadIO m => Handle -> m Bool -- | Lifted version of hGetBuffering hGetBuffering :: MonadIO m => Handle -> m BufferMode -- | Lifted version of hIsSeekable hIsSeekable :: MonadIO m => Handle -> m Bool -- | Lifted version of hSetEcho hSetEcho :: MonadIO m => Handle -> Bool -> m () -- | Lifted version of hGetEcho hGetEcho :: MonadIO m => Handle -> m Bool -- | Lifted version of hReady hReady :: MonadIO m => Handle -> m Bool parseVersion :: String -> Maybe Version -- | Left-to-right composition of Kleisli arrows. -- -- '(bs >=> cs) a' can be understood as the -- do expression -- --
-- do b <- bs a -- cs b --(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 >=> -- | Right-to-left composition of Kleisli arrows. -- (>=>), with the arguments flipped. -- -- Note how this operator resembles function composition -- (.): -- --
-- (.) :: (b -> c) -> (a -> b) -> a -> c -- (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c --(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c infixr 1 <=< -- | The zipWithM function generalizes zipWith to arbitrary -- applicative functors. zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c] -- | zipWithM_ is the extension of zipWithM which ignores the -- final result. zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m () -- | Like foldM, but discards the result. foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () -- | Like replicateM, but discards the result. -- --
-- >>> replicateM_ 3 (putStrLn "a") -- a -- a -- a --replicateM_ :: Applicative m => Int -> m a -> m () -- | Strict version of <$>. (<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 <$!> -- | Direct MonadPlus equivalent of filter. -- --
-- filter = ( mfilter :: (a -> Bool) -> [a] -> [a] ) ---- -- An example using mfilter with the Maybe monad: -- --
-- >>> mfilter odd (Just 1) -- Just 1 -- -- >>> mfilter odd (Just 2) -- Nothing --mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a -- | Lifted newQSemN. newQSemN :: MonadIO m => Int -> m QSemN -- | Lifted waitQSemN. waitQSemN :: MonadIO m => QSemN -> Int -> m () -- | Lifted signalQSemN. signalQSemN :: MonadIO m => QSemN -> Int -> m () -- | Lifted newQSem. newQSem :: MonadIO m => Int -> m QSem -- | Lifted waitQSem. waitQSem :: MonadIO m => QSem -> m () -- | Lifted signalQSem. signalQSem :: MonadIO m => QSem -> m () -- | Lifted newChan. newChan :: MonadIO m => m (Chan a) -- | Lifted writeChan. writeChan :: MonadIO m => Chan a -> a -> m () -- | Lifted readChan. readChan :: MonadIO m => Chan a -> m a -- | Lifted dupChan. dupChan :: MonadIO m => Chan a -> m (Chan a) -- | Lifted getChanContents. getChanContents :: MonadIO m => Chan a -> m [a] -- | Lifted writeList2Chan. writeList2Chan :: MonadIO m => Chan a -> [a] -> m () -- | Lifted version of isCurrentThreadBound. isCurrentThreadBound :: MonadIO m => 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 traceMarkerIO :: MonadIO m => Text -> m () traceMarker :: Text -> a -> a traceEventIO :: MonadIO m => Text -> m () traceEvent :: Text -> a -> a traceStack :: Text -> a -> a traceShowM :: (Show a, Applicative f) => a -> f () traceM :: Applicative f => Text -> f () traceId :: Text -> Text -- | Unlifted timeout. timeout :: MonadUnliftIO m => Int -> m a -> m (Maybe a) -- | As bifoldr, but strict in the result of the reduction functions -- at each step. bifoldr' :: Bifoldable t => (a -> c -> c) -> (b -> c -> c) -> c -> t a b -> c -- | A variant of bifoldr that has no base case, and thus may only -- be applied to non-empty structures. -- --
-- >>> bifoldr1 (+) (5, 7) -- 12 ---- --
-- >>> bifoldr1 (+) (Right 7) -- 7 ---- --
-- >>> bifoldr1 (+) (Left 5) -- 5 ---- --
-- > bifoldr1 (+) (BiList [1, 2] [3, 4]) -- 10 -- 1 + (2 + (3 + 4)) ---- --
-- >>> bifoldr1 (+) (BiList [1, 2] []) -- 3 ---- -- On empty structures, this function throws an exception: -- --
-- >>> bifoldr1 (+) (BiList [] []) -- *** Exception: bifoldr1: empty structure -- ... --bifoldr1 :: Bifoldable t => (a -> a -> a) -> t a a -> a -- | Right associative monadic bifold over a structure. bifoldrM :: (Bifoldable t, Monad m) => (a -> c -> m c) -> (b -> c -> m c) -> c -> t a b -> m c -- | As bifoldl, but strict in the result of the reduction functions -- at each step. -- -- This ensures that each step of the bifold 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 structure to a single, monolithic result (e.g., -- bilength). bifoldl' :: Bifoldable t => (a -> b -> a) -> (a -> c -> a) -> a -> t b c -> a -- | A variant of bifoldl that has no base case, and thus may only -- be applied to non-empty structures. -- --
-- >>> bifoldl1 (+) (5, 7) -- 12 ---- --
-- >>> bifoldl1 (+) (Right 7) -- 7 ---- --
-- >>> bifoldl1 (+) (Left 5) -- 5 ---- --
-- > bifoldl1 (+) (BiList [1, 2] [3, 4]) -- 10 -- ((1 + 2) + 3) + 4 ---- --
-- >>> bifoldl1 (+) (BiList [1, 2] []) -- 3 ---- -- On empty structures, this function throws an exception: -- --
-- >>> bifoldl1 (+) (BiList [] []) -- *** Exception: bifoldl1: empty structure -- ... --bifoldl1 :: Bifoldable t => (a -> a -> a) -> t a a -> a -- | Left associative monadic bifold over a structure. -- --
-- >>> bifoldlM (\a b -> print b >> pure a) (\a c -> print (show c) >> pure a) 42 ("Hello", True)
-- "Hello"
-- "True"
-- 42
--
--
-- -- >>> bifoldlM (\a b -> print b >> pure a) (\a c -> print (show c) >> pure a) 42 (Right True) -- "True" -- 42 ---- --
-- >>> bifoldlM (\a b -> print b >> pure a) (\a c -> print (show c) >> pure a) 42 (Left "Hello") -- "Hello" -- 42 --bifoldlM :: (Bifoldable t, Monad m) => (a -> b -> m a) -> (a -> c -> m a) -> a -> t b c -> m a -- | Map each element of a structure using one of two actions, evaluate -- these actions from left to right, and ignore the results. For a -- version that doesn't ignore the results, see bitraverse. -- --
-- >>> bitraverse_ print (print . show) ("Hello", True)
-- "Hello"
-- "True"
--
--
-- -- >>> bitraverse_ print (print . show) (Right True) -- "True" ---- --
-- >>> bitraverse_ print (print . show) (Left "Hello") -- "Hello" --bitraverse_ :: (Bifoldable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f () -- | As bitraverse_, but with the structure as the primary argument. -- For a version that doesn't ignore the results, see bifor. -- --
-- >>> bifor_ ("Hello", True) print (print . show)
-- "Hello"
-- "True"
--
--
-- -- >>> bifor_ (Right True) print (print . show) -- "True" ---- --
-- >>> bifor_ (Left "Hello") print (print . show) -- "Hello" --bifor_ :: (Bifoldable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f () -- | Evaluate each action in the structure from left to right, and ignore -- the results. For a version that doesn't ignore the results, see -- bisequence. -- --
-- >>> bisequence_ (print "Hello", print "World") -- "Hello" -- "World" ---- --
-- >>> bisequence_ (Left (print "Hello")) -- "Hello" ---- --
-- >>> bisequence_ (Right (print "World")) -- "World" --bisequence_ :: (Bifoldable t, Applicative f) => t (f a) (f b) -> f () -- | The sum of a collection of actions, generalizing biconcat. -- --
-- >>> biasum (Nothing, Nothing) -- Nothing ---- --
-- >>> biasum (Nothing, Just 42) -- Just 42 ---- --
-- >>> biasum (Just 18, Nothing) -- Just 18 ---- --
-- >>> biasum (Just 18, Just 42) -- Just 18 --biasum :: (Bifoldable t, Alternative f) => t (f a) (f a) -> f a -- | Collects the list of elements of a structure, from left to right. -- --
-- >>> biList (18, 42) -- [18,42] ---- --
-- >>> biList (Left 18) -- [18] --biList :: Bifoldable t => t a a -> [a] -- | Test whether the structure is empty. -- --
-- >>> binull (18, 42) -- False ---- --
-- >>> binull (Right 42) -- False ---- --
-- >>> binull (BiList [] []) -- True --binull :: Bifoldable t => t a b -> Bool -- | Returns the size/length of a finite structure as an Int. -- --
-- >>> bilength (True, 42) -- 2 ---- --
-- >>> bilength (Right 42) -- 1 ---- --
-- >>> bilength (BiList [1,2,3] [4,5]) -- 5 ---- --
-- >>> bilength (BiList [] []) -- 0 ---- -- On infinite structures, this function hangs: -- --
-- > bilength (BiList [1..] []) -- * Hangs forever * --bilength :: Bifoldable t => t a b -> Int -- | Does the element occur in the structure? -- --
-- >>> bielem 42 (17, 42) -- True ---- --
-- >>> bielem 42 (17, 43) -- False ---- --
-- >>> bielem 42 (Left 42) -- True ---- --
-- >>> bielem 42 (Right 13) -- False ---- --
-- >>> bielem 42 (BiList [1..5] [1..100]) -- True ---- --
-- >>> bielem 42 (BiList [1..5] [1..41]) -- False --bielem :: (Bifoldable t, Eq a) => a -> t a a -> Bool -- | Reduces a structure of lists to the concatenation of those lists. -- --
-- >>> biconcat ([1, 2, 3], [4, 5]) -- [1,2,3,4,5] ---- --
-- >>> biconcat (Left [1, 2, 3]) -- [1,2,3] ---- --
-- >>> biconcat (BiList [[1, 2, 3, 4, 5], [6, 7, 8]] [[9]]) -- [1,2,3,4,5,6,7,8,9] --biconcat :: Bifoldable t => t [a] [a] -> [a] -- | The largest element of a non-empty structure. -- --
-- >>> bimaximum (42, 17) -- 42 ---- --
-- >>> bimaximum (Right 42) -- 42 ---- --
-- >>> bimaximum (BiList [13, 29, 4] [18, 1, 7]) -- 29 ---- --
-- >>> bimaximum (BiList [13, 29, 4] []) -- 29 ---- -- On empty structures, this function throws an exception: -- --
-- >>> bimaximum (BiList [] []) -- *** Exception: bimaximum: empty structure -- ... --bimaximum :: (Bifoldable t, Ord a) => t a a -> a -- | The least element of a non-empty structure. -- --
-- >>> biminimum (42, 17) -- 17 ---- --
-- >>> biminimum (Right 42) -- 42 ---- --
-- >>> biminimum (BiList [13, 29, 4] [18, 1, 7]) -- 1 ---- --
-- >>> biminimum (BiList [13, 29, 4] []) -- 4 ---- -- On empty structures, this function throws an exception: -- --
-- >>> biminimum (BiList [] []) -- *** Exception: biminimum: empty structure -- ... --biminimum :: (Bifoldable t, Ord a) => t a a -> a -- | The bisum function computes the sum of the numbers of a -- structure. -- --
-- >>> bisum (42, 17) -- 59 ---- --
-- >>> bisum (Right 42) -- 42 ---- --
-- >>> bisum (BiList [13, 29, 4] [18, 1, 7]) -- 72 ---- --
-- >>> bisum (BiList [13, 29, 4] []) -- 46 ---- --
-- >>> bisum (BiList [] []) -- 0 --bisum :: (Bifoldable t, Num a) => t a a -> a -- | The biproduct function computes the product of the numbers of a -- structure. -- --
-- >>> biproduct (42, 17) -- 714 ---- --
-- >>> biproduct (Right 42) -- 42 ---- --
-- >>> biproduct (BiList [13, 29, 4] [18, 1, 7]) -- 190008 ---- --
-- >>> biproduct (BiList [13, 29, 4] []) -- 1508 ---- --
-- >>> biproduct (BiList [] []) -- 1 --biproduct :: (Bifoldable t, Num a) => t a a -> a -- | Given a means of mapping the elements of a structure to lists, -- computes the concatenation of all such lists in order. -- --
-- >>> biconcatMap (take 3) (fmap digitToInt) ([1..], "89") -- [1,2,3,8,9] ---- --
-- >>> biconcatMap (take 3) (fmap digitToInt) (Left [1..]) -- [1,2,3] ---- --
-- >>> biconcatMap (take 3) (fmap digitToInt) (Right "89") -- [8,9] --biconcatMap :: Bifoldable t => (a -> [c]) -> (b -> [c]) -> t a b -> [c] -- | biand returns the conjunction of a container of Bools. For the -- result to be True, the container must be finite; False, -- however, results from a False value finitely far from the left -- end. -- --
-- >>> biand (True, False) -- False ---- --
-- >>> biand (True, True) -- True ---- --
-- >>> biand (Left True) -- True ---- -- Empty structures yield True: -- --
-- >>> biand (BiList [] []) -- True ---- -- A False value finitely far from the left end yields -- False (short circuit): -- --
-- >>> biand (BiList [True, True, False, True] (repeat True)) -- False ---- -- A False value infinitely far from the left end hangs: -- --
-- > biand (BiList (repeat True) [False]) -- * Hangs forever * ---- -- An infinitely True value hangs: -- --
-- > biand (BiList (repeat True) []) -- * Hangs forever * --biand :: Bifoldable t => t Bool Bool -> Bool -- | bior returns the disjunction of a container of Bools. For the -- result to be False, the container must be finite; True, -- however, results from a True value finitely far from the left -- end. -- --
-- >>> bior (True, False) -- True ---- --
-- >>> bior (False, False) -- False ---- --
-- >>> bior (Left True) -- True ---- -- Empty structures yield False: -- --
-- >>> bior (BiList [] []) -- False ---- -- A True value finitely far from the left end yields True -- (short circuit): -- --
-- >>> bior (BiList [False, False, True, False] (repeat False)) -- True ---- -- A True value infinitely far from the left end hangs: -- --
-- > bior (BiList (repeat False) [True]) -- * Hangs forever * ---- -- An infinitely False value hangs: -- --
-- > bior (BiList (repeat False) []) -- * Hangs forever * --bior :: Bifoldable t => t Bool Bool -> Bool -- | Determines whether any element of the structure satisfies its -- appropriate predicate argument. Empty structures yield False. -- --
-- >>> biany even isDigit (27, 't') -- False ---- --
-- >>> biany even isDigit (27, '8') -- True ---- --
-- >>> biany even isDigit (26, 't') -- True ---- --
-- >>> biany even isDigit (Left 27) -- False ---- --
-- >>> biany even isDigit (Left 26) -- True ---- --
-- >>> biany even isDigit (BiList [27, 53] ['t', '8']) -- True ---- -- Empty structures yield False: -- --
-- >>> biany even isDigit (BiList [] []) -- False --biany :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool -- | Determines whether all elements of the structure satisfy their -- appropriate predicate argument. Empty structures yield True. -- --
-- >>> biall even isDigit (27, 't') -- False ---- --
-- >>> biall even isDigit (26, '8') -- True ---- --
-- >>> biall even isDigit (Left 27) -- False ---- --
-- >>> biall even isDigit (Left 26) -- True ---- --
-- >>> biall even isDigit (BiList [26, 52] ['3', '8']) -- True ---- -- Empty structures yield True: -- --
-- >>> biall even isDigit (BiList [] []) -- True --biall :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool -- | The largest element of a non-empty structure with respect to the given -- comparison function. -- --
-- >>> bimaximumBy compare (42, 17) -- 42 ---- --
-- >>> bimaximumBy compare (Left 17) -- 17 ---- --
-- >>> bimaximumBy compare (BiList [42, 17, 23] [-5, 18]) -- 42 ---- -- On empty structures, this function throws an exception: -- --
-- >>> bimaximumBy compare (BiList [] []) -- *** Exception: bifoldr1: empty structure -- ... --bimaximumBy :: Bifoldable t => (a -> a -> Ordering) -> t a a -> a -- | The least element of a non-empty structure with respect to the given -- comparison function. -- --
-- >>> biminimumBy compare (42, 17) -- 17 ---- --
-- >>> biminimumBy compare (Left 17) -- 17 ---- --
-- >>> biminimumBy compare (BiList [42, 17, 23] [-5, 18]) -- -5 ---- -- On empty structures, this function throws an exception: -- --
-- >>> biminimumBy compare (BiList [] []) -- *** Exception: bifoldr1: empty structure -- ... --biminimumBy :: Bifoldable t => (a -> a -> Ordering) -> t a a -> a -- | binotElem is the negation of bielem. -- --
-- >>> binotElem 42 (17, 42) -- False ---- --
-- >>> binotElem 42 (17, 43) -- True ---- --
-- >>> binotElem 42 (Left 42) -- False ---- --
-- >>> binotElem 42 (Right 13) -- True ---- --
-- >>> binotElem 42 (BiList [1..5] [1..100]) -- False ---- --
-- >>> binotElem 42 (BiList [1..5] [1..41]) -- True --binotElem :: (Bifoldable t, Eq a) => a -> t a a -> Bool -- | The bifind function takes a predicate and a structure and -- returns the leftmost element of the structure matching the predicate, -- or Nothing if there is no such element. -- --
-- >>> bifind even (27, 53) -- Nothing ---- --
-- >>> bifind even (27, 52) -- Just 52 ---- --
-- >>> bifind even (26, 52) -- Just 26 ---- -- Empty structures always yield Nothing: -- --
-- >>> bifind even (BiList [] []) -- Nothing --bifind :: Bifoldable t => (a -> Bool) -> t a a -> Maybe a -- | The bimapAccumL function behaves like a combination of -- bimap and bifoldl; it traverses a structure from left to -- right, threading a state of type a and using the given -- actions to compute new elements for the structure. -- --
-- >>> bimapAccumL (\acc bool -> (acc + 1, show bool)) (\acc string -> (acc * 2, reverse string)) 3 (True, "foo")
-- (8,("True","oof"))
--
bimapAccumL :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e)) -> a -> t b d -> (a, t c e)
-- | The bimapAccumR function behaves like a combination of
-- bimap and bifoldr; it traverses a structure from right
-- to left, threading a state of type a and using the given
-- actions to compute new elements for the structure.
--
--
-- >>> bimapAccumR (\acc bool -> (acc + 1, show bool)) (\acc string -> (acc * 2, reverse string)) 3 (True, "foo")
-- (7,("True","oof"))
--
bimapAccumR :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e)) -> a -> t b d -> (a, t c e)
-- | Runs a Reader and extracts the final value from it. (The
-- inverse of reader.)
runReader :: Reader r a -> r -> a
-- | O(n). Convert a ShortByteString into a
-- ByteString.
fromShort :: ShortByteString -> ByteString
-- | O(n). Convert a ByteString into a
-- ShortByteString.
--
-- This makes a copy, so does not retain the input string.
toShort :: ByteString -> ShortByteString
hPutBuilder :: MonadIO m => Handle -> Builder -> m ()
-- | Retrieves a function of the current environment.
asks :: MonadReader r m => (r -> a) -> m a
-- | Combine two Conduits together into a new Conduit
-- (aka fuse).
--
-- 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
-- Conduit will be discarded.
--
-- Equivalent to fuse and =$=, however the latter is
-- deprecated and will be removed in a future version.
--
-- Note that, while this operator looks like categorical composition
-- (from Control.Category), there are a few reasons it's
-- different:
--
-- -- >>> Just 3 ^.. _Just -- [3] ---- -- Gathering all values in a list of tuples: -- --
-- >>> [(1,2),(3,4)] ^.. each.each -- [1,2,3,4] --(^..) :: s -> Getting (Endo [a]) s a -> [a] infixl 8 ^.. -- | s ^? t returns the 1st element t returns, or -- Nothing if t doesn't return anything. It's trivially -- implemented by passing the First monoid to the getter. -- -- Safe head: -- --
-- >>> [] ^? each -- Nothing ---- --
-- >>> [1..3] ^? each -- Just 1 ---- -- Converting Either to Maybe: -- --
-- >>> Left 1 ^? _Right -- Nothing ---- --
-- >>> Right 1 ^? _Right -- Just 1 ---- -- A non-operator version of (^?) is called preview, and -- – like view – it's a bit more general than (^?) (it -- works in MonadReader). If you need the general version, you -- can get it from microlens-mtl; otherwise there's preview -- available in Lens.Micro.Extras. (^?) :: s -> Getting (First a) s a -> Maybe a infixl 8 ^? -- | preview is a synonym for (^?), generalised for -- MonadReader (just like view, which is a synonym for -- (^.)). -- --
-- >>> preview each [1..5] -- Just 1 --preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a) -- | sets creates an ASetter from an ordinary function. (The -- only thing it does is wrapping and unwrapping Identity.) sets :: ((a -> b) -> s -> t) -> ASetter s t a b -- | lens creates a Lens 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: -- --
-- ix :: Int -> Lens' [a] a -- ix i = lens (!! i) -- getter -- (\s b -> take i s ++ b : drop (i+1) s) -- setter ---- -- Usage: -- --
-- >>> [1..9] ^. ix 3 -- 4 -- -- >>> [1..9] & ix 3 %~ negate -- [1,2,3,-4,5,6,7,8,9] ---- -- 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 undefined. Then we use -- the resulting lens for setting and it works, which proves that -- the getter wasn't used: -- --
-- >>> [1,2,3] & lens undefined (\s b -> b : tail s) .~ 10 -- [10,2,3] --lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b -- | Log a debug level message with no source. logDebug :: (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 warn level message with no source. logWarn :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () -- | Log an error level message with no source. logError :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => 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 a debug level message with the given source. logDebugS :: (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 warn level message with the given source. logWarnS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => 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 message with the specified textual level and the given source. logOtherS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> LogSource -> Utf8Builder -> m () snapshotLocation :: HasPantryConfig env => SnapName -> RIO env RawSnapshotLocation resolvePaths :: MonadIO m => Maybe (Path Abs Dir) -> Unresolved a -> m a toRawPL :: PackageLocation -> RawPackageLocation defaultHackageSecurityConfig :: HackageSecurityConfig parseHackageText :: Text -> Either PantryException (PackageIdentifier, BlobKey) parsePackageIdentifierRevision :: Text -> Either PantryException PackageIdentifierRevision mkSafeFilePath :: Text -> Maybe SafeFilePath parsePackageIdentifier :: String -> Maybe PackageIdentifier parsePackageName :: String -> Maybe PackageName parsePackageNameThrowing :: MonadThrow m => String -> m PackageName parseVersionThrowing :: MonadThrow m => String -> m Version parseFlagName :: String -> Maybe FlagName packageNameString :: PackageName -> String packageIdentifierString :: PackageIdentifier -> String versionString :: Version -> String flagNameString :: FlagName -> String moduleNameString :: ModuleName -> String toCabalStringMap :: Map a v -> Map (CabalString a) v unCabalStringMap :: Map (CabalString a) v -> Map a v parseWantedCompiler :: Text -> Either PantryException WantedCompiler parseRawSnapshotLocation :: Text -> Unresolved RawSnapshotLocation defaultSnapshotLocation :: SnapName -> RawSnapshotLocation parseSnapName :: MonadThrow m => Text -> m SnapName toRawSL :: SnapshotLocation -> RawSnapshotLocation toRawSnapshotLayer :: SnapshotLayer -> RawSnapshotLayer warnMissingCabalFile :: HasLogFunc env => RawPackageLocationImmutable -> RIO env () -- | Where does pantry download its 01-index.tar file from Hackage? hackageIndexTarballL :: HasPantryConfig env => SimpleGetter env (Path Abs File) -- | Download the most recent 01-index.tar file from Hackage and update the -- database tables. -- -- This function will only perform an update once per PantryConfig -- for user sanity. See the return value to find out if it happened. updateHackageIndex :: (HasPantryConfig env, HasLogFunc env) => Maybe Utf8Builder -> RIO env DidUpdateOccur -- | Try to come up with typo corrections for given package identifier -- using Hackage package names. This can provide more user-friendly -- information in error messages. getHackageTypoCorrections :: (HasPantryConfig env, HasLogFunc env) => PackageName -> RIO env [PackageName] -- | Returns the versions of the package available on Hackage. getHackagePackageVersions :: (HasPantryConfig env, HasLogFunc env) => RequireHackageIndex -> UsePreferredVersions -> PackageName -> RIO env (Map Version (Map Revision BlobKey)) -- | Like fetchRepos, except with RawPackageMetadata instead -- of PackageMetadata. fetchReposRaw :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => [(Repo, RawPackageMetadata)] -> RIO env () -- | Fetch the given repositories at once and populate the pantry database. fetchRepos :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => [(Repo, PackageMetadata)] -> RIO env () -- | Clone the repository (and, in the case of Git and if necessary, fetch -- the specific commit) and execute the action with the working directory -- set to the repository root. withRepo :: (HasLogFunc env, HasProcessContext env) => SimpleRepo -> RIO env a -> RIO env a -- | Create a new PantryConfig with the given settings. For a -- version where the use of Casa (content-addressable storage archive) is -- optional, see withPantryConfig'. -- -- For something easier to use in simple cases, see runPantryApp. withPantryConfig :: HasLogFunc env => Path Abs Dir -> PackageIndexConfig -> HpackExecutable -> Int -> CasaRepoPrefix -> Int -> (SnapName -> RawSnapshotLocation) -> (PantryConfig -> RIO env a) -> RIO env a -- | Create a new PantryConfig with the given settings. -- -- For something easier to use in simple cases, see runPantryApp. withPantryConfig' :: HasLogFunc env => Path Abs Dir -> PackageIndexConfig -> HpackExecutable -> Int -> Maybe (CasaRepoPrefix, Int) -> (SnapName -> RawSnapshotLocation) -> (PantryConfig -> RIO env a) -> RIO env a -- | Default pull URL for Casa. defaultCasaRepoPrefix :: CasaRepoPrefix -- | Default max keys to pull per request. defaultCasaMaxPerRequest :: Int -- | Default PackageIndexConfig value using the official Hackage -- server. defaultPackageIndexConfig :: PackageIndexConfig -- | The download prefix for the official Hackage server. defaultDownloadPrefix :: Text -- | Returns the latest version of the given package available from -- Hackage. getLatestHackageVersion :: (HasPantryConfig env, HasLogFunc env) => RequireHackageIndex -> PackageName -> UsePreferredVersions -> RIO env (Maybe PackageIdentifierRevision) -- | Returns location of the latest version of the given package available -- from Hackage. getLatestHackageLocation :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RequireHackageIndex -> PackageName -> UsePreferredVersions -> RIO env (Maybe PackageLocationImmutable) -- | Returns the latest revision of the given package version available -- from Hackage. getLatestHackageRevision :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RequireHackageIndex -> PackageName -> Version -> RIO env (Maybe (Revision, BlobKey, TreeKey)) -- | Download all of the packages provided into the local cache without -- performing any unpacking. Can be useful for build tools wanting to -- prefetch or provide an offline mode. fetchPackages :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env, Foldable f) => f PackageLocationImmutable -> RIO env () -- | Unpack a given RawPackageLocationImmutable into the given -- directory. Does not generate any extra subdirectories. unpackPackageLocationRaw :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Path Abs Dir -> RawPackageLocationImmutable -> RIO env () -- | Unpack a given PackageLocationImmutable into the given -- directory. Does not generate any extra subdirectories. unpackPackageLocation :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Path Abs Dir -> PackageLocationImmutable -> RIO env () -- | Load the cabal file for the given PackageLocationImmutable. -- -- This function ignores all warnings. loadCabalFileImmutable :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageLocationImmutable -> RIO env GenericPackageDescription -- | Load the cabal file for the given RawPackageLocationImmutable. -- -- This function ignores all warnings. -- -- Note that, for now, this will not allow support for hpack files in -- these package locations. Instead, all -- PackageLocationImmutables will require a .cabal file. This -- may be relaxed in the future. loadCabalFileRawImmutable :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawPackageLocationImmutable -> RIO env GenericPackageDescription -- | Same as loadCabalFileRawImmutable, but takes a -- RawPackageLocation. Never prints warnings, see -- loadCabalFilePath for that. loadCabalFileRaw :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Maybe Text -> RawPackageLocation -> RIO env GenericPackageDescription -- | Same as loadCabalFileImmutable, but takes a -- PackageLocation. Never prints warnings, see -- loadCabalFilePath for that. loadCabalFile :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Maybe Text -> PackageLocation -> RIO env GenericPackageDescription -- | Parse the Cabal file for the package inside the given directory. -- Performs various sanity checks, such as the file name being correct -- and having only a single Cabal file. loadCabalFilePath :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Maybe Text -> Path Abs Dir -> RIO env (PrintWarnings -> IO GenericPackageDescription, PackageName, Path Abs File) -- | Get the file name for the Cabal file in the given directory. -- -- If no Cabal file is present, or more than one is present, an exception -- is thrown via throwM. -- -- If the directory contains a file named package.yaml, Hpack is used to -- generate a Cabal file from it. findOrGenerateCabalFile :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Maybe Text -> Path Abs Dir -> RIO env (PackageName, Path Abs File) -- | Get the PackageIdentifier from a -- GenericPackageDescription. gpdPackageIdentifier :: GenericPackageDescription -> PackageIdentifier -- | Get the PackageName from a GenericPackageDescription. gpdPackageName :: GenericPackageDescription -> PackageName -- | Get the Version from a GenericPackageDescription. gpdVersion :: GenericPackageDescription -> Version -- | Load a Package from a PackageLocationImmutable. loadPackage :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageLocationImmutable -> RIO env Package -- | Load a Package from a RawPackageLocationImmutable. -- -- Load the package either from the local DB, Casa, or as a last resort, -- the third party (hackage, archive or repo). loadPackageRaw :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawPackageLocationImmutable -> RIO env Package -- | Maybe load the package from Casa. tryLoadPackageRawViaCasa :: (HasLogFunc env, HasPantryConfig env, HasProcessContext env) => RawPackageLocationImmutable -> TreeKey -> RIO env (Maybe Package) -- | Fill in optional fields in a PackageLocationImmutable for more -- reproducible builds. completePackageLocation :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawPackageLocationImmutable -> RIO env CompletePackageLocation -- | Add in hashes to make a SnapshotLocation reproducible. completeSnapshotLocation :: (HasPantryConfig env, HasLogFunc env) => RawSnapshotLocation -> RIO env SnapshotLocation -- | Parse a Snapshot (all layers) from a SnapshotLocation -- noting any incomplete package locations. Debug output will include the -- raw snapshot layer. loadAndCompleteSnapshot :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => SnapshotLocation -> Map RawSnapshotLocation SnapshotLocation -> Map RawPackageLocationImmutable PackageLocationImmutable -> RIO env (Snapshot, [CompletedSL], [CompletedPLI]) -- | As for loadAndCompleteSnapshot but allows toggling of the debug -- output of the raw snapshot layer. loadAndCompleteSnapshot' :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Bool -> SnapshotLocation -> Map RawSnapshotLocation SnapshotLocation -> Map RawPackageLocationImmutable PackageLocationImmutable -> RIO env (Snapshot, [CompletedSL], [CompletedPLI]) -- | Parse a Snapshot (all layers) from a RawSnapshotLocation -- completing any incomplete package locations. Debug output will include -- the raw snapshot layer. loadAndCompleteSnapshotRaw :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawSnapshotLocation -> Map RawSnapshotLocation SnapshotLocation -> Map RawPackageLocationImmutable PackageLocationImmutable -> RIO env (Snapshot, [CompletedSL], [CompletedPLI]) -- | As for loadAndCompleteSnapshotRaw but allows toggling of the -- debug output of the raw snapshot layer. loadAndCompleteSnapshotRaw' :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Bool -> RawSnapshotLocation -> Map RawSnapshotLocation SnapshotLocation -> Map RawPackageLocationImmutable PackageLocationImmutable -> RIO env (Snapshot, [CompletedSL], [CompletedPLI]) -- | Add more packages to a snapshot -- -- Note that any settings on a parent flag which is being replaced will -- be ignored. For example, if package foo is in the parent and -- has flag bar set, and foo also appears in new -- packages, then bar will no longer be set. -- -- Returns any of the AddPackagesConfig values not used. addPackagesToSnapshot :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => Utf8Builder -> [RawPackageLocationImmutable] -> AddPackagesConfig -> Map PackageName RawSnapshotPackage -> RIO env (Map PackageName RawSnapshotPackage, AddPackagesConfig) -- | Parse a SnapshotLayer value from a SnapshotLocation. -- -- Returns a Left value if provided an SLCompiler -- constructor. Otherwise, returns a Right value providing both -- the Snapshot and a hash of the input configuration file. loadRawSnapshotLayer :: (HasPantryConfig env, HasLogFunc env) => RawSnapshotLocation -> RIO env (Either WantedCompiler (RawSnapshotLayer, CompletedSL)) -- | Parse a SnapshotLayer value from a SnapshotLocation. -- -- Returns a Left value if provided an SLCompiler -- constructor. Otherwise, returns a Right value providing both -- the Snapshot and a hash of the input configuration file. loadSnapshotLayer :: (HasPantryConfig env, HasLogFunc env) => SnapshotLocation -> RIO env (Either WantedCompiler RawSnapshotLayer) -- | Get the PackageName of the package at the given location. getPackageLocationName :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawPackageLocationImmutable -> RIO env PackageName -- | Get the PackageIdentifier of the package at the given location. packageLocationIdent :: PackageLocationImmutable -> PackageIdentifier -- | Get version of the package at the given location. packageLocationVersion :: PackageLocationImmutable -> Version -- | Get the PackageIdentifier of the package at the given location. getRawPackageLocationIdent :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawPackageLocationImmutable -> RIO env PackageIdentifier -- | Get the TreeKey of the package at the given location. getRawPackageLocationTreeKey :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => RawPackageLocationImmutable -> RIO env TreeKey -- | Get the TreeKey of the package at the given location. getPackageLocationTreeKey :: (HasPantryConfig env, HasLogFunc env, HasProcessContext env) => PackageLocationImmutable -> RIO env TreeKey -- | Lens to view or modify the HpackExecutable of a -- PantryConfig hpackExecutableL :: Lens' PantryConfig HpackExecutable -- | Run some code against pantry using basic sane settings. -- -- For testing, see runPantryAppClean. runPantryApp :: MonadIO m => RIO PantryApp a -> m a -- | Run some code against pantry using basic sane settings. -- -- For testing, see runPantryAppClean. runPantryAppWith :: MonadIO m => Int -> CasaRepoPrefix -> Int -> RIO PantryApp a -> m a -- | Like runPantryApp, but uses an empty pantry directory instead -- of sharing with Stack. Useful for testing. runPantryAppClean :: MonadIO m => RIO PantryApp a -> m a -- | Load the global hints from GitHub. loadGlobalHints :: (HasTerm env, HasPantryConfig env) => WantedCompiler -> RIO env (Maybe (Map PackageName Version)) -- | Partition a map of global packages with its versions into a Set of -- replaced packages and its dependencies and a map of remaining -- (untouched) packages. partitionReplacedDependencies :: Ord id => Map PackageName a -> (a -> PackageName) -> (a -> id) -> (a -> [id]) -> Set PackageName -> (Map PackageName [PackageName], Map PackageName a) -- | Use a snapshot cache, which caches which modules are in which packages -- in a given snapshot. This is mostly intended for usage by Stack. withSnapshotCache :: (HasPantryConfig env, HasLogFunc env) => SnapshotCacheHash -> RIO env (Map PackageName (Set ModuleName)) -> ((ModuleName -> RIO env [PackageName]) -> RIO env a) -> RIO env a -- | Create and use a temporary file in the system standard temporary -- directory. -- -- Behaves exactly the same as withTempFile, except that the -- parent temporary directory will be that returned by -- getCanonicalTemporaryDirectory. withSystemTempFile :: MonadUnliftIO m => String -> (FilePath -> Handle -> m a) -> m a -- | Lift one RIO env to another. mapRIO :: (outer -> inner) -> RIO inner a -> RIO outer a -- | Replace an invalid input byte with the Unicode replacement character -- U+FFFD. lenientDecode :: OnDecodeError -- | Decode a ByteString containing UTF-8 encoded text. -- -- Surrogate code points in replacement character returned by -- OnDecodeError will be automatically remapped to the replacement -- char U+FFFD. decodeUtf8With :: OnDecodeError -> ByteString -> Text -- | Decode a ByteString 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 Builder using UTF-8 encoding. encodeUtf8Builder :: Text -> Builder -- | After a file is closed, this function opens it again and executes -- fsync() internally on both the file and the directory that -- contains it. Note that this function is intended to work around the -- non-durability of existing file APIs, as opposed to being necessary -- for the API functions provided in this module. -- -- The effectiveness of calling this function is debatable, as it -- relies on internal implementation details at the Kernel level that -- might change. We argue that, despite this fact, calling this function -- may bring benefits in terms of durability. -- -- This function does not provide the same guarantee as if you would open -- and modify a file using withBinaryFileDurable or -- writeBinaryFileDurable, since they ensure that the -- fsync() is called before the file is closed, so if possible -- use those instead. -- --
-- forMaybeA == flip mapMaybeA --forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b] -- |
-- forMaybeM == flip mapMaybeM --forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b] -- | Helper function to force an action to run in IO. Especially -- useful for overly general contexts, like hspec tests. asIO :: IO a -> IO a sappend :: Semigroup s => s -> s -> s toStrictBytes :: LByteString -> ByteString fromStrictBytes :: ByteString -> LByteString yieldThread :: MonadIO m => m () tshow :: Show a => a -> Text -- | Create a LogFunc from the given function. mkLogFunc :: (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> LogFunc -- | Generic, basic function for creating other logging functions. logGeneric :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> LogLevel -> 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 -- logStickyDone. -- -- Note that not all LogFunc implementations will support sticky -- messages as described. However, the withLogFunc implementation -- provided by this module does. logSticky :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m () -- | This will print out the given message with a newline and disable any -- further stickiness of the line until a new call to logSticky -- happens. logStickyDone :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m () -- | Create a LogOptions value which will store its data in memory. -- This is primarily intended for testing purposes. This will return both -- a LogOptions value and an IORef containing the resulting -- Builder value. -- -- This will default to non-verbose settings and assume there is a -- terminal attached. These assumptions can be overridden using the -- appropriate set functions. logOptionsMemory :: MonadIO m => m (IORef Builder, LogOptions) -- | Create a LogOptions value from the given Handle and -- whether to perform verbose logging or not. Individiual settings can be -- overridden using appropriate set functions. Logging output is -- guaranteed to be non-interleaved only for a UTF-8 Handle in a -- multi-thread environment. -- -- When Verbose Flag is True, the following happens: -- --
-- let isVerbose = False -- get from the command line instead
-- logOptions' <- logOptionsHandle stderr isVerbose
-- let logOptions = setLogUseTime True logOptions'
-- withLogFunc logOptions $ \lf -> do
-- let app = App -- application specific environment
-- { appLogFunc = lf
-- , appOtherStuff = ...
-- }
-- runRIO app $ do
-- logInfo "Starting app"
-- myApp
--
withLogFunc :: MonadUnliftIO m => LogOptions -> (LogFunc -> m a) -> m a
-- | Set the minimum log level. Messages below this level will not be
-- printed.
--
-- Default: in verbose mode, LevelDebug. Otherwise,
-- LevelInfo.
setLogMinLevel :: LogLevel -> LogOptions -> LogOptions
-- | Refer to setLogMinLevel. This modifier allows to alter the
-- verbose format value dynamically at runtime.
--
-- Default: in verbose mode, LevelDebug. Otherwise,
-- LevelInfo.
setLogMinLevelIO :: IO LogLevel -> LogOptions -> LogOptions
-- | Use the verbose format for printing log messages.
--
-- Default: follows the value of the verbose flag.
setLogVerboseFormat :: Bool -> LogOptions -> LogOptions
-- | Refer to setLogVerboseFormat. 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
-- | Do we treat output as a terminal. If True, we will enable
-- sticky logging functionality.
--
-- Default: checks if the Handle provided to
-- logOptionsHandle is a terminal with hIsTerminalDevice.
setLogTerminal :: Bool -> LogOptions -> LogOptions
-- | Include the time when printing log messages.
--
-- Default: True in debug mode, False otherwise.
setLogUseTime :: Bool -> LogOptions -> LogOptions
-- | Use ANSI color codes in the log output.
--
-- Default: True if in verbose mode and the Handle
-- is a terminal device.
setLogUseColor :: Bool -> LogOptions -> LogOptions
-- | ANSI color codes for LogLevel in the log output.
--
-- Default: LevelDebug = "\ESC[32m" -- Green LevelInfo =
-- "\ESC[34m" -- Blue LevelWarn = "\ESC[33m" -- Yellow
-- LevelError = "\ESC[31m" -- Red LevelOther _ = "\ESC[35m"
-- -- Magenta
setLogLevelColors :: (LogLevel -> Utf8Builder) -> LogOptions -> LogOptions
-- | ANSI color codes for secondary content in the log output.
--
-- Default: "\ESC[90m" -- Bright black (gray)
setLogSecondaryColor :: Utf8Builder -> LogOptions -> LogOptions
-- | ANSI color codes for accents in the log output. Accent colors are
-- indexed by Int.
--
-- Default: const "\ESC[92m" -- Bright green, for all indicies
setLogAccentColors :: (Int -> Utf8Builder) -> LogOptions -> LogOptions
-- | Use code location in the log output.
--
-- Default: True if in verbose mode, False otherwise.
setLogUseLoc :: Bool -> LogOptions -> LogOptions
-- | Set format method for messages
--
-- Default: id
setLogFormat :: (Utf8Builder -> Utf8Builder) -> LogOptions -> LogOptions
-- | Convert a CallStack value into a Utf8Builder indicating
-- the first source location.
--
-- TODO Consider showing the entire call stack instead.
displayCallStack :: CallStack -> Utf8Builder
-- | 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
-- | What color is the log func configured to use for each LogLevel?
--
-- Intended for use by code which wants to optionally add additional
-- color to its log messages.
logFuncLogLevelColorsL :: HasLogFunc env => SimpleGetter env (LogLevel -> Utf8Builder)
-- | What color is the log func configured to use for secondary content?
--
-- Intended for use by code which wants to optionally add additional
-- color to its log messages.
logFuncSecondaryColorL :: HasLogFunc env => SimpleGetter env Utf8Builder
-- | What accent colors, indexed by Int, is the log func configured
-- to use?
--
-- Intended for use by code which wants to optionally add additional
-- color to its log messages.
logFuncAccentColorsL :: HasLogFunc env => SimpleGetter env (Int -> Utf8Builder)
-- | 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
-- | A vesion of contramapMaybeGLogFunc which supports filering.
contramapMaybeGLogFunc :: (a -> Maybe b) -> GLogFunc b -> GLogFunc a
-- | A contramap. Use this to wrap sub-loggers via mapRIO.
--
-- If you are on base > 4.12.0, you can just use contramap.
contramapGLogFunc :: (a -> b) -> GLogFunc b -> GLogFunc a
-- | Make a custom generic logger. With this you could, for example, write
-- to a database or a log digestion service. For example:
--
-- -- mkGLogFunc (\stack msg -> send (Data.Aeson.encode (JsonLog stack msg))) --mkGLogFunc :: (CallStack -> msg -> IO ()) -> GLogFunc msg -- | Log a value generically. glog :: (MonadIO m, HasCallStack, HasGLogFunc env, MonadReader env m) => GMsg env -> m () -- | Make a GLogFunc via classic LogFunc. Use this if you'd -- like to log your generic data type via the classic RIO terminal -- logger. gLogFuncClassic :: (HasLogLevel msg, HasLogSource msg, Display msg) => LogFunc -> GLogFunc msg -- | Lazily get the contents of a file. Unlike readFile, this -- ensures that if an exception is thrown, the file handle is closed -- immediately. withLazyFile :: MonadUnliftIO m => FilePath -> (ByteString -> m a) -> m a -- | Lazily read a file in UTF8 encoding. withLazyFileUtf8 :: MonadUnliftIO m => FilePath -> (Text -> m a) -> m a -- | Helper function to assist with type inference, forcing usage of an -- unboxed vector. asUDeque :: UDeque s a -> UDeque s a -- | Helper function to assist with type inference, forcing usage of a -- storable vector. asSDeque :: SDeque s a -> SDeque s a -- | Helper function to assist with type inference, forcing usage of a -- boxed vector. asBDeque :: BDeque s a -> BDeque s a -- | Create a new, empty Deque newDeque :: forall (v :: Type -> Type -> Type) a m. (MVector v a, PrimMonad m) => m (Deque v (PrimState m) a) -- | O(1) - Get the number of elements that is currently in the -- Deque getDequeSize :: forall m (v :: Type -> Type -> Type) a. PrimMonad m => Deque v (PrimState m) a -> m Int -- | Pop the first value from the beginning of the Deque popFrontDeque :: forall (v :: Type -> Type -> Type) a m. (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a) -- | Pop the first value from the end of the Deque popBackDeque :: forall (v :: Type -> Type -> Type) a m. (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a) -- | Push a new value to the beginning of the Deque pushFrontDeque :: forall (v :: Type -> Type -> Type) a m. (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m () -- | Push a new value to the end of the Deque pushBackDeque :: forall (v :: Type -> Type -> Type) a m. (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m () -- | Fold over a Deque, starting at the beginning. Does not modify -- the Deque. foldlDeque :: forall (v :: Type -> Type -> Type) a m acc. (MVector v a, PrimMonad m) => (acc -> a -> m acc) -> acc -> Deque v (PrimState m) a -> m acc -- | Fold over a Deque, starting at the end. Does not modify the -- Deque. foldrDeque :: forall (v :: Type -> Type -> Type) a m acc. (MVector v a, PrimMonad m) => (a -> acc -> m acc) -> acc -> Deque v (PrimState m) a -> m acc -- | Convert a Deque into a list. Does not modify the Deque. dequeToList :: forall (v :: Type -> Type -> Type) a m. (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m [a] -- | Convert to an immutable vector of any type. If resulting pure vector -- corresponds to the mutable one used by the Deque, it will be -- more efficient to use freezeDeque instead. -- --
-- >>> :set -XTypeApplications -- -- >>> import qualified RIO.Vector.Unboxed as U -- -- >>> import qualified RIO.Vector.Storable as S -- -- >>> d <- newDeque @U.MVector @Int -- -- >>> mapM_ (pushFrontDeque d) [0..10] -- -- >>> dequeToVector @S.Vector d -- [10,9,8,7,6,5,4,3,2,1,0] --dequeToVector :: forall v' a (v :: Type -> Type -> Type) m. (Vector v' a, MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (v' a) -- | Yield an immutable copy of the underlying mutable vector. The -- difference from dequeToVector is that the the copy will be -- performed with a more efficient memcpy, rather than element -- by element. The downside is that the resulting vector type must be the -- one that corresponds to the mutable one that is used in the -- Deque. -- --
-- >>> :set -XTypeApplications -- -- >>> import qualified RIO.Vector.Unboxed as U -- -- >>> d <- newDeque @U.MVector @Int -- -- >>> mapM_ (pushFrontDeque d) [0..10] -- -- >>> freezeDeque @U.Vector d -- [10,9,8,7,6,5,4,3,2,1,0] --freezeDeque :: (Vector v a, PrimMonad m) => Deque (Mutable v) (PrimState m) a -> m (v a) -- | Create a new URef newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a) -- | Read the value in a URef readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a -- | Write a value into a URef. Note that this action is strict, and -- will force evalution of the value. writeURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> a -> m () -- | Modify a value in a URef. 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 () -- | Using the environment run in IO the action that requires that -- environment. runRIO :: MonadIO m => env -> RIO env a -> m a -- | Abstract RIO to an arbitrary MonadReader instance, which -- can handle IO. liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a -- | Read from a SomeRef readSomeRef :: MonadIO m => SomeRef a -> m a -- | Write to a SomeRef writeSomeRef :: MonadIO m => SomeRef a -> a -> m () -- | Modify a SomeRef This function is subject to change due to the lack of -- atomic operations modifySomeRef :: MonadIO m => SomeRef a -> (a -> a) -> m () -- | create a new boxed SomeRef newSomeRef :: MonadIO m => a -> m (SomeRef a) -- | create a new unboxed SomeRef newUnboxedSomeRef :: (MonadIO m, Unbox a) => a -> m (SomeRef a) -- | Constructor for SimpleApp. In case when ProcessContext -- is not supplied mkDefaultProcessContext will be used to create -- it. mkSimpleApp :: MonadIO m => LogFunc -> Maybe ProcessContext -> m SimpleApp -- | Run with a default configured SimpleApp, consisting of: -- --
-- serve :: TChan Message -> Client -> IO loop -- serve broadcastChan client = do -- myChan <- dupTChan broadcastChan -- forever $ do -- message <- readTChan myChan -- send client message ---- -- The problem with using newTChan to create the broadcast channel -- is that if it is only written to and never read, items will pile up in -- memory. By using newBroadcastTChan to create the broadcast -- channel, items can be garbage collected after clients have seen them. newBroadcastTChan :: STM (TChan a) -- | Write a value to a TChan. writeTChan :: TChan a -> a -> STM () -- | Read the next value from the TChan. readTChan :: TChan a -> STM a -- | A version of readTChan which does not retry. Instead it returns -- Nothing if no value is available. tryReadTChan :: TChan a -> STM (Maybe a) -- | Get the next value from the TChan without removing it, -- retrying if the channel is empty. peekTChan :: TChan a -> STM a -- | A version of peekTChan which does not retry. Instead it returns -- Nothing if no value is available. tryPeekTChan :: TChan a -> STM (Maybe a) -- | Duplicate a TChan: 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 True if the supplied TChan is empty. isEmptyTChan :: TChan a -> STM Bool -- | Clone a TChan: similar to dupTChan, but the cloned channel -- starts with the same content available as the original channel. cloneTChan :: TChan a -> STM (TChan a) -- | Create a TMVar which contains the supplied value. newTMVar :: a -> STM (TMVar a) -- | Create a TMVar which is initially empty. newEmptyTMVar :: STM (TMVar a) -- | Lifted version of newEmptyTMVarIO newEmptyTMVarIO :: MonadIO m => m (TMVar a) -- | Return the contents of the TMVar. If the TMVar is -- currently empty, the transaction will retry. After a -- takeTMVar, the TMVar is left empty. takeTMVar :: TMVar a -> STM a -- | A version of takeTMVar that does not retry. The -- tryTakeTMVar function returns Nothing if the -- TMVar was empty, or Just a if the TMVar -- was full with contents a. After tryTakeTMVar, the -- TMVar is left empty. tryTakeTMVar :: TMVar a -> STM (Maybe a) -- | Put a value into a TMVar. If the TMVar is currently -- full, putTMVar will retry. putTMVar :: TMVar a -> a -> STM () -- | A version of putTMVar that does not retry. The -- tryPutTMVar function attempts to put the value a into -- the TMVar, returning True if it was successful, or -- False otherwise. tryPutTMVar :: TMVar a -> a -> STM Bool -- | This is a combination of takeTMVar and putTMVar; ie. it -- takes the value from the TMVar, puts it back, and also returns -- it. readTMVar :: TMVar a -> STM a -- | A version of readTMVar which does not retry. Instead it returns -- Nothing if no value is available. tryReadTMVar :: TMVar a -> STM (Maybe a) -- | Swap the contents of a TMVar for a new value. swapTMVar :: TMVar a -> a -> STM a -- | Non-blocking write of a new value to a TMVar Puts if empty. -- Replaces if populated. writeTMVar :: TMVar a -> a -> STM () -- | Check whether a given TMVar is empty. isEmptyTMVar :: TMVar a -> STM Bool -- | Lifted version of mkWeakTMVar mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a)) -- | Build and returns a new instance of TQueue newTQueue :: STM (TQueue a) -- | Write a value to a TQueue. writeTQueue :: TQueue a -> a -> STM () -- | Read the next value from the TQueue. readTQueue :: TQueue a -> STM a -- | A version of readTQueue which does not retry. Instead it -- returns Nothing if no value is available. tryReadTQueue :: TQueue a -> STM (Maybe a) -- | Get the next value from the TQueue without removing it, -- retrying if the channel is empty. peekTQueue :: TQueue a -> STM a -- | A version of peekTQueue which does not retry. Instead it -- returns Nothing 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 True if the supplied TQueue is empty. isEmptyTQueue :: TQueue a -> STM Bool -- | Mutate the contents of a TVar. N.B., this version is -- non-strict. modifyTVar :: TVar a -> (a -> a) -> STM () -- | Strict version of modifyTVar. modifyTVar' :: TVar a -> (a -> a) -> STM () -- | Like modifyTVar' but the function is a simple state transition -- that can return a side value which is passed on as the result of the -- STM. stateTVar :: TVar s -> (s -> (a, s)) -> STM a -- | Swap the contents of a TVar for a new value. swapTVar :: TVar a -> a -> STM a -- | Lifted version of mkWeakTVar mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a)) -- | A variant of catch that catches both synchronous and -- asynchronous exceptions. -- -- WARNING: This function (and other *SyncOrAsync functions) is -- for advanced users. Most of the time, you probably want to use the -- non-SyncOrAsync versions. -- -- Before attempting to use this function, be familiar with the "Rules -- for async safe handling" section in this blog post. catchSyncOrAsync :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a -- | A variant of handle that catches both synchronous and -- asynchronous exceptions. -- -- See catchSyncOrAsync. handleSyncOrAsync :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a -- | A variant of try that catches both synchronous and asynchronous -- exceptions. -- -- See catchSyncOrAsync. trySyncOrAsync :: (MonadUnliftIO m, Exception e) => m a -> m (Either e 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 pureTryDeep. pureTry :: a -> Either SomeException a -- | Evaluate the value to NF and catch any synchronous exceptions. pureTryDeep :: NFData a => a -> Either SomeException a -- | Convert from a possibly wrapped exception. -- -- The inverse of toAsyncException and toSyncException. -- When using those functions (or functions that use them, like -- throwTo or throwIO), fromException might not be -- sufficient because the exception might be wrapped within -- SyncExceptionWrapper or AsyncExceptionWrapper. fromExceptionUnwrap :: Exception e => SomeException -> Maybe e -- | Same as fromEither, but works on an IO-wrapped -- Either. fromEitherIO :: (Exception e, MonadIO m) => IO (Either e a) -> m a -- | Same as fromEither, but works on an m-wrapped -- Either. fromEitherM :: (Exception e, MonadIO m) => m (Either e a) -> m a -- | Same as mapException, except works in a monadic context. mapExceptionM :: (Exception e1, Exception e2, MonadUnliftIO m) => (e1 -> e2) -> m a -> m a -- | Construct a value of type Conc from an action. Compose these -- values using the typeclass instances (most commonly Applicative -- and Alternative) and then run with runConc. conc :: m a -> Conc m a -- | Run a Conc value on multiple threads. runConc :: MonadUnliftIO m => Conc m a -> m a -- | Like mapConcurrently 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. -- --
-- import Say -- -- action :: Int -> IO Int -- action n = do -- tid <- myThreadId -- sayString $ show tid -- threadDelay (2 * 10^6) -- 2 seconds -- return n -- -- main :: IO () -- main = do -- yx <- pooledMapConcurrentlyN 5 (\x -> action x) [1..5] -- print yx ---- -- On executing you can see that five threads have been spawned: -- --
-- $ ./pool -- ThreadId 36 -- ThreadId 38 -- ThreadId 40 -- ThreadId 42 -- ThreadId 44 -- [1,2,3,4,5] ---- -- Let's modify the above program such that there are less threads than -- the number of items in the list: -- --
-- import Say -- -- action :: Int -> IO Int -- action n = do -- tid <- myThreadId -- sayString $ show tid -- threadDelay (2 * 10^6) -- 2 seconds -- return n -- -- main :: IO () -- main = do -- yx <- pooledMapConcurrentlyN 3 (\x -> action x) [1..5] -- print yx ---- -- On executing you can see that only three threads are active totally: -- --
-- $ ./pool -- ThreadId 35 -- ThreadId 37 -- ThreadId 39 -- ThreadId 35 -- ThreadId 39 -- [1,2,3,4,5] --pooledMapConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> (a -> m b) -> t a -> m (t b) -- | Similar to pooledMapConcurrentlyN but with number of threads -- set from getNumCapabilities. Usually this is useful for CPU -- bound tasks. pooledMapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b) -- | Similar to pooledMapConcurrentlyN but with flipped arguments. pooledForConcurrentlyN :: (MonadUnliftIO m, Traversable t) => Int -> t a -> (a -> m b) -> m (t b) -- | Similar to pooledForConcurrentlyN but with number of threads -- set from getNumCapabilities. Usually this is useful for CPU -- bound tasks. pooledForConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b) -- | Like pooledMapConcurrentlyN but with the return value -- discarded. pooledMapConcurrentlyN_ :: (MonadUnliftIO m, Foldable f) => Int -> (a -> m b) -> f a -> m () -- | Like pooledMapConcurrently but with the return value discarded. pooledMapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m () -- | Like pooledMapConcurrently_ but with flipped arguments. pooledForConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m () -- | Like pooledMapConcurrentlyN_ but with flipped arguments. pooledForConcurrentlyN_ :: (MonadUnliftIO m, Foldable t) => Int -> t a -> (a -> m b) -> m () -- | Pooled version of replicateConcurrently. Performs the action in -- the pooled threads. pooledReplicateConcurrentlyN :: MonadUnliftIO m => Int -> Int -> m a -> m [a] -- | Similar to pooledReplicateConcurrentlyN but with number of -- threads set from getNumCapabilities. Usually this is useful for -- CPU bound tasks. pooledReplicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a] -- | Pooled version of replicateConcurrently_. Performs the action -- in the pooled threads. pooledReplicateConcurrentlyN_ :: MonadUnliftIO m => Int -> Int -> m a -> m () -- | Similar to pooledReplicateConcurrently_ but with number of -- threads set from getNumCapabilities. Usually this is useful for -- CPU bound tasks. pooledReplicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> m () -- | Extract a value from a Memoized, running an action if no cached -- value is available. runMemoized :: MonadIO m => Memoized a -> m a -- | Create a new Memoized value using an IORef 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 memoizeMVar. memoizeRef :: MonadUnliftIO m => m a -> m (Memoized a) -- | Same as memoizeRef, but uses an MVar to ensure that an -- action is only run once, even in a multithreaded application. memoizeMVar :: MonadUnliftIO m => m a -> m (Memoized a) -- | withQSem is an exception-safe wrapper for performing the -- provided operation while holding a unit of value from the semaphore. -- It ensures the semaphore cannot be leaked if there are exceptions. withQSem :: MonadUnliftIO m => QSem -> m a -> m a -- | withQSemN is an exception-safe wrapper for performing the -- provided operation while holding N unit of value from the semaphore. -- It ensures the semaphore cannot be leaked if there are exceptions. withQSemN :: MonadUnliftIO m => QSemN -> Int -> m a -> m a -- | Renamed retry for unqualified export retrySTM :: STM a -- | Renamed check for unqualified export checkSTM :: Bool -> STM () -- | Create and use a temporary directory in the system standard temporary -- directory. -- -- Behaves exactly the same as withTempDirectory, except that the -- parent temporary directory will be that returned by -- getCanonicalTemporaryDirectory. withSystemTempDirectory :: MonadUnliftIO m => String -> (FilePath -> m a) -> m a -- | Capture the current monadic context, providing the ability to run -- monadic actions in IO. -- -- See UnliftIO for an explanation of why we need a helper -- datatype here. -- -- Prior to version 0.2.0.0 of this library, this was a method in the -- MonadUnliftIO type class. It was moved out due to -- https://github.com/fpco/unliftio/issues/55. askUnliftIO :: MonadUnliftIO m => m (UnliftIO m) -- | Same as askUnliftIO, 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) -- | Convenience function for capturing the monadic context and running an -- IO action. The UnliftIO newtype wrapper is rarely -- needed, so prefer withRunInIO to this function. withUnliftIO :: MonadUnliftIO m => (UnliftIO m -> IO a) -> m a -- | Convert an action in m to an action in IO. toIO :: MonadUnliftIO m => m a -> m (IO a) -- | A helper function for implementing MonadUnliftIO instances. -- Useful for the common case where you want to simply delegate to the -- underlying transformer. -- -- Note: You can derive MonadUnliftIO for newtypes without this -- helper function in unliftio-core 0.2.0.0 and later. -- --
-- newtype AppT m a = AppT { unAppT :: ReaderT Int (ResourceT m) a }
-- deriving (Functor, Applicative, Monad, MonadIO)
--
-- -- Same as `deriving newtype (MonadUnliftIO)`
-- instance MonadUnliftIO m => MonadUnliftIO (AppT m) where
-- withRunInIO = wrappedWithRunInIO AppT unAppT
--
wrappedWithRunInIO :: MonadUnliftIO n => (n b -> m b) -> (forall a. () => m a -> n a) -> ((forall a. () => m a -> IO a) -> IO b) -> m b
-- | A helper function for lifting IO a -> IO b functions into
-- any MonadUnliftIO.
--
-- -- liftedTry :: (Exception e, MonadUnliftIO m) => m a -> m (Either e a) -- liftedTry m = liftIOOp Control.Exception.try m --liftIOOp :: MonadUnliftIO m => (IO a -> IO b) -> m a -> m b -- | Environment values with a styles update. class () => HasStylesUpdate env stylesUpdateL :: HasStylesUpdate env => Lens' env StylesUpdate class (HasLogFunc env, HasStylesUpdate env) => HasTerm env useColorL :: HasTerm env => Lens' env Bool termWidthL :: HasTerm env => Lens' env Int class () => Pretty a pretty :: Pretty a => a -> StyleDoc -- | Type representing pretty exceptions. data () => PrettyException PrettyException :: e -> PrettyException newtype PrettyRawSnapshotLocation PrettyRawSnapshotLocation :: RawSnapshotLocation -> PrettyRawSnapshotLocation -- | A document annotated by a style. data () => StyleDoc -- | Type representing styles of output. data () => Style -- | Intended to be used sparingly, not to style entire long messages. For -- example, to style the Error: or [error] label for an -- error message, not the entire message. Error :: Style -- | Intended to be used sparingly, not to style entire long messages. For -- example, to style the Warning: or [warn] label for a -- warning message, not the entire message. Warning :: Style -- | Intended to be used sparingly, not to style entire long messages. For -- example, to style the [info] label for an info message, not -- the entire message. Info :: Style -- | Intended to be used sparingly, not to style entire long messages. For -- example, to style the [debug] label for a debug message, not -- the entire message. Debug :: Style -- | Intended to be used sparingly, not to style entire long messages. For -- example, to style the [...] label for an other log level -- message, not the entire message. OtherLevel :: Style -- | Style in a way to emphasize that it is a particularly good thing. Good :: Style -- | Style as a shell command, i.e. when suggesting something to the user -- that should be typed in directly as written. Shell :: Style -- | Style as a filename. See Dir for directories. File :: Style -- | Style as a URL. Url :: Style -- | Style as a directory name. See File for files. Dir :: Style -- | Style used to highlight part of a recommended course of action. Recommendation :: Style -- | Style in a way that emphasizes that it is related to a current thing. -- For example, to report the current package that is being processed -- when outputting the name of it. Current :: Style -- | Style used the highlight the target of a course of action. Target :: Style -- | Style as a module name. Module :: Style -- | Style used to highlight the named component of a package. PkgComponent :: Style -- | Style for secondary content. For example, to style timestamps. Secondary :: Style -- | Intended to be used sparingly, not to style entire long messages. For -- example, to style the duration in a Finished process in ... -- ms message. Highlight :: Style -- | A style specification, pairing its 'key' with the corresponding list -- of SGR codes. type StyleSpec = (Text, [SGR]) -- | Updates to Styles newtype () => StylesUpdate StylesUpdate :: [(Style, StyleSpec)] -> StylesUpdate [stylesUpdate] :: StylesUpdate -> [(Style, StyleSpec)] -- | The document (x <+> y) concatenates document x -- and y with a (fromString " ") in between. (infixr 6) (<+>) :: StyleDoc -> StyleDoc -> StyleDoc -- | The document (align x) renders document x with the -- nesting level set to the current column. It is used for example to -- implement hang. -- -- As an example, we will put a document right above another one, -- regardless of the current nesting level: -- --
-- x $$ y = align (x <> line <> y) ---- --
-- test = fromString "hi" <+> (fromString "nice" $$ fromString "world") ---- -- which will be layed out as: -- --
-- hi nice -- world --align :: StyleDoc -> StyleDoc -- | Display a bulleted list of StyleDoc with * as the -- bullet point. bulletedList :: [StyleDoc] -> StyleDoc -- | debug message action brackets any output of the specified -- action with an initial and final message at log -- level LevelDebug. The initial message is prefixed with the -- label Start:. The final message is prefixed with information -- about the duration of the action in milliseconds (ms) and, if an -- exception is thrown by the action, the exception. For example: -- --
-- Start: <message> -- <output of action> -- Finished in ...ms: <message> ---- -- or: -- --
-- Start: <message> -- <output of action> -- Finished with exception in ...ms: <message> -- Exception thrown: <exception_message> --debugBracket :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m, MonadUnliftIO m) => StyleDoc -> m a -> m a -- | Default styles for rio-prettyprint output. defaultStyles :: Styles displayWithColor :: (HasTerm env, Pretty a, MonadReader env m, HasCallStack) => a -> m Utf8Builder -- | The document (encloseSep l r sep xs) concatenates the -- documents xs separated by sep and encloses the -- resulting document by l and r. 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 list can be defined with -- encloseSep: -- --
-- list xs = encloseSep lbracket rbracket comma xs -- test = fromString "list" <+> (list (map int [10, 200, 3000])) ---- -- Which is layed out with a page width of 20 as: -- --
-- list [10,200,3000] ---- -- But when the page width is 15, it is layed out as: -- --
-- list [10 -- ,200 -- ,3000] --encloseSep :: StyleDoc -> StyleDoc -> StyleDoc -> [StyleDoc] -> StyleDoc -- | The document (fill i x) renders document x. It than -- appends (fromString " ")s until the width is equal to -- i. If the width of x is already larger, nothing is -- appended. This combinator is quite useful in practice to output a list -- of bindings. The following example demonstrates this. -- --
-- types = [ ("empty", "Doc a")
-- , ("nest", "Int -> Doc a -> Doc a")
-- , ("linebreak", "Doc a")
-- ]
--
-- ptype (name, tp) =
-- fill 6 (fromString name) <+> fromString "::" <+> fromString tp
--
-- test = fromString "let" <+> align (vcat (map ptype types))
--
--
-- Which is layed out as:
--
-- -- let empty :: Doc a -- nest :: Int -> Doc a -> Doc a -- linebreak :: Doc a --fill :: Int -> StyleDoc -> StyleDoc -- | The document (fillSep xs) concatenates documents xs -- horizontally with (<+>) as long as its fits the -- page, than inserts a line and continues doing that for all -- documents in xs. -- --
-- fillSep xs = foldr (<> softline <>) mempty xs --fillSep :: [StyleDoc] -> StyleDoc -- | foldr' is a variant of foldr that performs strict -- reduction from right to left, i.e. starting with the right-most -- element. The input structure must be finite, otherwise -- foldr' runs out of space (diverges). -- -- If you want a strict right fold in constant space, you need a -- structure that supports faster than O(n) access to the -- right-most element, such as Seq from the containers -- package. -- -- This method does not run in constant space for structures such as -- lists that don't support efficient right-to-left iteration and so -- require O(n) space to perform right-to-left reduction. Use of -- this method with such a structure is a hint that the chosen structure -- may be a poor fit for the task at hand. If the order in which the -- elements are combined is not important, use foldl' instead. foldr' :: Foldable t => (a -> b -> b) -> b -> t a -> b -- | Convert a package identifier to a value of a string-like type. fromPackageId :: IsString a => PackageIdentifier -> a -- | Convert a package name to a value of a string-like type. fromPackageName :: IsString a => PackageName -> a -- | Wordwrap a String flow :: String -> StyleDoc -- | The hang combinator implements hanging indentation. The document -- (hang i x) renders document x with a nesting level -- set to the current column plus i. The following example uses -- hanging indentation for some text: -- --
-- test = hang 4 (fillSep (map fromString -- (words "the hang combinator indents these words !"))) ---- -- Which lays out on a page with a width of 20 characters as: -- --
-- the hang combinator -- indents these -- words ! ---- -- The hang combinator is implemented as: -- --
-- hang i x = align (nest i x) --hang :: Int -> StyleDoc -> StyleDoc -- | The document (hcat xs) concatenates all documents xs -- horizontally with (<>). hcat :: [StyleDoc] -> StyleDoc -- | The document (hsep xs) concatenates all documents xs -- horizontally with (<+>). hsep :: [StyleDoc] -> StyleDoc -- | The document (indent i x) indents document x with -- i spaces. -- --
-- test = indent 4 (fillSep (map fromString -- (words "the indent combinator indents these words !"))) ---- -- Which lays out with a page width of 20 as: -- --
-- the indent -- combinator -- indents these -- words ! --indent :: Int -> StyleDoc -> StyleDoc -- | The line document advances to the next line and indents to -- the current nesting level. Document line behaves like -- (fromString " ") if the line break is undone by group. line :: StyleDoc -- | The Style intended to be associated with a LogLevel. logLevelToStyle :: LogLevel -> Style -- | A helper function to yield a narrative list from a list of items, with -- a final fullstop. For example, helps produce the output "apple, -- ball and cat." (no serial comma) or "apple, ball, and -- cat." (serial comma) from ["apple", "ball", "cat"]. mkNarrativeList :: Pretty a => Maybe Style -> Bool -> [a] -> [StyleDoc] -- | Document (parens x) encloses document x in -- parenthesis, "(" and ")". parens :: StyleDoc -> StyleDoc -- | Parse a string that is a colon-delimited sequence of key=value, where -- key is a style name and value is a -- semicolon-delimited list of ANSI SGR (Select Graphic -- Rendition) control codes (in decimal). Keys that are not present in -- defaultStyles are ignored. Items in the semicolon-delimited -- list that are not recognised as valid control codes are ignored. parseStylesUpdateFromString :: String -> StylesUpdate prettyDebug :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () prettyDebugL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () prettyError :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () prettyErrorL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () prettyGeneric :: (HasTerm env, HasCallStack, Pretty b, MonadReader env m, MonadIO m) => LogLevel -> b -> m () prettyInfo :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () prettyInfoL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () prettyInfoS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () prettyNote :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () prettyNoteL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () prettyNoteS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () prettyWarn :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () prettyWarnL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () prettyWarnNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () prettyWarnS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () -- | (punctuate p xs) concatenates all documents in xs -- with document p except for the last document. -- --
-- someText = map fromString ["words", "in", "a", "tuple"] -- test = parens (align (cat (punctuate comma someText))) ---- -- This is layed out on a page width of 20 as: -- --
-- (words,in,a,tuple) ---- -- But when the page width is 15, it is layed out as: -- --
-- (words, -- in, -- a, -- tuple) ---- -- (If you want put the commas in front of their elements instead of at -- the end, you should use encloseSep.) punctuate :: StyleDoc -> [StyleDoc] -> [StyleDoc] -- | The document (sep xs) concatenates all documents xs -- either horizontally with (<+>), if it fits the page, or -- vertically with (<> line <>). -- --
-- sep xs = group (vsep xs) --sep :: [StyleDoc] -> StyleDoc -- | The document softbreak behaves like mempty if the -- resulting output fits the page, otherwise it behaves like line. -- --
-- softbreak = group linebreak --softbreak :: StyleDoc -- | The document softline behaves like (fromString " ") -- if the resulting output fits the page, otherwise it behaves like -- line. -- --
-- softline = group line --softline :: StyleDoc -- | Display a bulleted list of StyleDoc with a blank line between -- each and * as the bullet point. spacedBulletedList :: [StyleDoc] -> StyleDoc -- | The document string s concatenates all characters in -- s using line for newline characters and -- fromString for all other characters. It is used whenever the -- text contains newline characters. string :: String -> StyleDoc -- | Annotate a StyleDoc with a Style. style :: Style -> StyleDoc -> StyleDoc -- | The document (vsep xs) concatenates all documents xs -- vertically with (<> line <>). If a group -- undoes the line breaks inserted by vsep, all documents are -- separated with a space. -- --
-- someText = map fromString (words ("text to lay out"))
--
-- test = fromString "some" <+> vsep someText
--
--
-- This is layed out as:
--
-- -- some text -- to -- lay -- out ---- -- The align combinator can be used to align the documents under -- their first element -- --
-- test = fromString "some" <+> align (vsep someText) ---- -- Which is printed as: -- --
-- some text -- to -- lay -- out --vsep :: [StyleDoc] -> StyleDoc instance GHC.Show.Show Stack.Prelude.FirstTrue instance GHC.Classes.Ord Stack.Prelude.FirstTrue instance GHC.Classes.Eq Stack.Prelude.FirstTrue instance GHC.Show.Show Stack.Prelude.FirstFalse instance GHC.Classes.Ord Stack.Prelude.FirstFalse instance GHC.Classes.Eq Stack.Prelude.FirstFalse instance Text.PrettyPrint.Leijen.Extended.Pretty Stack.Prelude.PrettyRawSnapshotLocation instance GHC.Base.Semigroup Stack.Prelude.FirstFalse instance GHC.Base.Monoid Stack.Prelude.FirstFalse instance GHC.Base.Semigroup Stack.Prelude.FirstTrue instance GHC.Base.Monoid Stack.Prelude.FirstTrue module Stack.Options.Utils -- | Allows adjust global options depending on their context Note: This was -- being used to remove ambiguity 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 -- | If argument is True, hides the option from usage and help hideMods :: Bool -> Mod f a instance GHC.Show.Show Stack.Options.Utils.GlobalOptsContext instance GHC.Classes.Eq Stack.Options.Utils.GlobalOptsContext module Stack.Options.LogLevelParser -- | Parser for a logging level. logLevelOptsParser :: Bool -> Parser (Maybe LogLevel) module Stack.Ghci.Script data GhciScript -- | A valid Haskell module name. data () => ModuleName cmdAdd :: Set (Either ModuleName (Path Abs File)) -> 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 -- | Method of watching for changes. data () => WatchMode -- | Detect changes by polling the filesystem. Less efficient and may miss -- fast changes. Not recommended unless you're experiencing problems with -- WatchModeOS (or WatchModeOS is not supported on your -- platform). WatchModePoll :: Int -> WatchMode fileWatch :: HasTerm env => ((Set (Path Abs File) -> IO ()) -> RIO env ()) -> RIO env () fileWatchPoll :: HasTerm env => ((Set (Path Abs File) -> IO ()) -> RIO env ()) -> RIO env () module Stack.Constants.StackProgName -- | Name of the Stack program. stackProgName :: String -- | Extra functions for optparse-applicative. module Options.Applicative.Builder.Extra -- | Enable/disable flags for a Bool. boolFlags :: Bool -> String -> String -> Mod FlagFields Bool -> Parser Bool -- | Enable/disable flags for a Bool, without a default case (to -- allow chaining with <|>). boolFlagsNoDefault :: String -> String -> Mod FlagFields Bool -> Parser Bool -- | Flag with no default of True or False firstBoolFlagsNoDefault :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (First Bool) -- | Flag with a Semigroup instance and a default of True firstBoolFlagsTrue :: String -> String -> Mod FlagFields FirstTrue -> Parser FirstTrue -- | Flag with a Semigroup instance and a default of False firstBoolFlagsFalse :: String -> String -> Mod FlagFields FirstFalse -> Parser FirstFalse -- | 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 <|>) enableDisableFlagsNoDefault :: a -> a -> String -> String -> Mod FlagFields a -> Parser a -- | Show an extra help option (e.g. --docker-help shows help for -- all --docker* args). -- -- To actually have that help appear, use execExtraHelp 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 -- abortOption, this was the best way I found that doesn't require -- manually formatting the help. execExtraHelp :: [String] -> String -> Parser a -> String -> IO () -- | option, specialized to Text. textOption :: Mod OptionFields Text -> Parser Text -- | argument, specialized to Text. textArgument :: Mod ArgumentFields Text -> Parser Text -- | Like optional, but returning a First. optionalFirst :: Alternative f => f a -> f (First a) -- | Like optional, but returning a FirstTrue. optionalFirstTrue :: Alternative f => f Bool -> f FirstTrue -- | Like optional, but returning a FirstFalse. optionalFirstFalse :: Alternative f => f Bool -> f FirstFalse 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 eitherReader, but accepting any Show e on -- the Left. 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 [$sel:absolute:PathCompleterOpts] :: PathCompleterOpts -> Bool [$sel:relative:PathCompleterOpts] :: PathCompleterOpts -> Bool [$sel:rootDir:PathCompleterOpts] :: PathCompleterOpts -> Maybe FilePath [$sel:fileFilter:PathCompleterOpts] :: PathCompleterOpts -> FilePath -> Bool [$sel:dirFilter:PathCompleterOpts] :: PathCompleterOpts -> FilePath -> Bool defaultPathCompleterOpts :: PathCompleterOpts pathCompleterWith :: PathCompleterOpts -> Completer unescapeBashArg :: String -> String showHelpText :: ParseError instance GHC.Show.Show Options.Applicative.Builder.Extra.OptionsApplicativeExtraException instance GHC.Exception.Type.Exception Options.Applicative.Builder.Extra.OptionsApplicativeExtraException module Data.Monoid.Map -- | Utility newtype wrapper to make Map's Monoid also use the element's -- Monoid. newtype MonoidMap k a MonoidMap :: Map k a -> 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.Generics.Generic (Data.Monoid.Map.MonoidMap k a) instance GHC.Base.Functor (Data.Monoid.Map.MonoidMap k) 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) -- | More readable combinators for writing parsers. module Data.Attoparsec.Combinators -- | Alternative parsers. alternating :: Alternative f => f a -> f a -> f a -- | Concatenate two parsers. appending :: (Applicative f, Semigroup a) => f a -> f a -> f a -- | Concating the result of an action. concating :: (Monoid m, Applicative f) => f [m] -> f m -- | Pure something. pured :: (Applicative g, Applicative f) => g a -> g (f a) -- | 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 -> x. argsParser :: EscapingMode -> Parser [String] -- | Parse arguments using argsParser. parseArgs :: EscapingMode -> Text -> Either String [String] -- | Parse using argsParser from a string. parseArgsFromString :: EscapingMode -> String -> Either String [String] instance GHC.Show.Show Data.Attoparsec.Args.EscapingMode instance GHC.Classes.Eq Data.Attoparsec.Args.EscapingMode instance GHC.Enum.Enum 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. -- --ghc-options="-X P.hs "this"". argsArgument :: Mod ArgumentFields [String] -> Parser [String] -- | An option which accepts a list of arguments e.g. --ghc-options="-X -- P.hs "this"". argsOption :: Mod OptionFields [String] -> Parser [String] -- | An option which accepts a command and a list of arguments e.g. -- --exec "echo hello world" cmdOption :: Mod OptionFields (String, [String]) -> Parser (String, [String]) module Control.Concurrent.Execute -- | Type representing types of Stack build actions. data ActionType -- | Action for building a package's library and executables. If -- taskAllInOne is True, then this will also build -- benchmarks and tests. It is False when the 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 -- | Types representing the unique ids of Stack build actions. data ActionId ActionId :: !PackageIdentifier -> !ActionType -> ActionId data ActionContext ActionContext :: !Set ActionId -> [Action] -> !Concurrency -> ActionContext -- | Does not include the current action. [$sel:remaining:ActionContext] :: ActionContext -> !Set ActionId -- | Actions which depend on the current action. [$sel:downstream:ActionContext] :: ActionContext -> [Action] -- | Whether this action may be run concurrently with others. [$sel:concurrency:ActionContext] :: ActionContext -> !Concurrency -- | Type representing Stack build actions. data Action Action :: !ActionId -> !Set ActionId -> !ActionContext -> IO () -> !Concurrency -> Action -- | The action's unique id. [$sel:actionId:Action] :: Action -> !ActionId -- | Actions on which this action depends. [$sel:actionDeps:Action] :: Action -> !Set ActionId -- | The action's IO action, given a context. [$sel:action:Action] :: Action -> !ActionContext -> IO () -- | Whether this action may be run concurrently with others. [$sel:concurrency:Action] :: Action -> !Concurrency -- | Type representing permissions for actions to be run concurrently with -- others. data Concurrency ConcurrencyAllowed :: Concurrency ConcurrencyDisallowed :: Concurrency runActions :: Int -> Bool -> [Action] -> (TVar Int -> TVar (Set ActionId) -> IO ()) -> IO [SomeException] instance GHC.Show.Show Control.Concurrent.Execute.ExecuteException 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.Show.Show Control.Concurrent.Execute.ActionId instance GHC.Classes.Ord Control.Concurrent.Execute.ActionId instance GHC.Classes.Eq Control.Concurrent.Execute.ActionId instance GHC.Classes.Eq Control.Concurrent.Execute.Concurrency instance GHC.Exception.Type.Exception Control.Concurrent.Execute.ExecuteException module Stack.Types.AllowNewerDeps newtype AllowNewerDeps AllowNewerDeps :: [PackageName] -> AllowNewerDeps instance GHC.Show.Show Stack.Types.AllowNewerDeps.AllowNewerDeps instance GHC.Read.Read Stack.Types.AllowNewerDeps.AllowNewerDeps instance GHC.Classes.Ord Stack.Types.AllowNewerDeps.AllowNewerDeps instance GHC.Generics.Generic Stack.Types.AllowNewerDeps.AllowNewerDeps instance GHC.Classes.Eq Stack.Types.AllowNewerDeps.AllowNewerDeps instance GHC.Base.Semigroup Stack.Types.AllowNewerDeps.AllowNewerDeps instance GHC.Base.Monoid Stack.Types.AllowNewerDeps.AllowNewerDeps instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.AllowNewerDeps.AllowNewerDeps module Stack.Types.ApplyGhcOptions -- | 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 instance GHC.Show.Show Stack.Types.ApplyGhcOptions.ApplyGhcOptions instance GHC.Read.Read Stack.Types.ApplyGhcOptions.ApplyGhcOptions instance GHC.Classes.Ord Stack.Types.ApplyGhcOptions.ApplyGhcOptions instance GHC.Classes.Eq Stack.Types.ApplyGhcOptions.ApplyGhcOptions instance GHC.Enum.Enum Stack.Types.ApplyGhcOptions.ApplyGhcOptions instance GHC.Enum.Bounded Stack.Types.ApplyGhcOptions.ApplyGhcOptions instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.ApplyGhcOptions.ApplyGhcOptions module Stack.Types.ApplyProgOptions -- | Which packages do all and any --PROG-option options on the command -- line apply to? data ApplyProgOptions -- | All local packages that are targets. APOTargets :: ApplyProgOptions -- | All local packages (targets or otherwise). APOLocals :: ApplyProgOptions -- | All packages (local or otherwise). APOEverything :: ApplyProgOptions instance GHC.Show.Show Stack.Types.ApplyProgOptions.ApplyProgOptions instance GHC.Read.Read Stack.Types.ApplyProgOptions.ApplyProgOptions instance GHC.Classes.Ord Stack.Types.ApplyProgOptions.ApplyProgOptions instance GHC.Classes.Eq Stack.Types.ApplyProgOptions.ApplyProgOptions instance GHC.Enum.Enum Stack.Types.ApplyProgOptions.ApplyProgOptions instance GHC.Enum.Bounded Stack.Types.ApplyProgOptions.ApplyProgOptions instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.ApplyProgOptions.ApplyProgOptions -- | Configuration options for building from the command line only. module Stack.Types.BuildOptsCLI -- | Build options that may only be specified from the CLI data BuildOptsCLI BuildOptsCLI :: ![Text] -> !Bool -> ![Text] -> ![(Text, [Text])] -> !Map ApplyCLIFlag (Map FlagName Bool) -> !BuildSubset -> !FileWatchOpts -> !Bool -> ![(String, [String])] -> !Bool -> !BuildCommand -> !Bool -> BuildOptsCLI [$sel:targetsCLI:BuildOptsCLI] :: BuildOptsCLI -> ![Text] [$sel:dryrun:BuildOptsCLI] :: BuildOptsCLI -> !Bool [$sel:ghcOptions:BuildOptsCLI] :: BuildOptsCLI -> ![Text] [$sel:progsOptions:BuildOptsCLI] :: BuildOptsCLI -> ![(Text, [Text])] [$sel:flags:BuildOptsCLI] :: BuildOptsCLI -> !Map ApplyCLIFlag (Map FlagName Bool) [$sel:buildSubset:BuildOptsCLI] :: BuildOptsCLI -> !BuildSubset [$sel:fileWatch:BuildOptsCLI] :: BuildOptsCLI -> !FileWatchOpts [$sel:watchAll:BuildOptsCLI] :: BuildOptsCLI -> !Bool [$sel:exec:BuildOptsCLI] :: BuildOptsCLI -> ![(String, [String])] [$sel:onlyConfigure:BuildOptsCLI] :: BuildOptsCLI -> !Bool [$sel:command:BuildOptsCLI] :: BuildOptsCLI -> !BuildCommand [$sel:initialBuildSteps:BuildOptsCLI] :: BuildOptsCLI -> !Bool defaultBuildOptsCLI :: BuildOptsCLI -- | How to apply a CLI flag data ApplyCLIFlag -- | Apply to all project packages which have such a flag name available. ACFAllProjectPackages :: ApplyCLIFlag -- | Apply to the specified package only. ACFByName :: !PackageName -> ApplyCLIFlag -- | 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 -- | Refuse to build anything in the snapshot database, see -- https://github.com/commercialhaskell/stack/issues/5272 BSOnlyLocals :: BuildSubset data FileWatchOpts NoFileWatch :: FileWatchOpts FileWatch :: FileWatchOpts FileWatchPoll :: FileWatchOpts -- | Command sum type for conditional arguments. data BuildCommand Build :: BuildCommand Test :: BuildCommand Haddock :: BuildCommand Bench :: BuildCommand Install :: BuildCommand -- | Generate a list of --PROG-option="argument" arguments for all -- PROGs. boptsCLIAllProgOptions :: BuildOptsCLI -> [Text] -- | Only flags set via ACFByName boptsCLIFlagsByName :: BuildOptsCLI -> Map PackageName (Map FlagName Bool) instance GHC.Show.Show Stack.Types.BuildOptsCLI.ApplyCLIFlag instance GHC.Classes.Ord Stack.Types.BuildOptsCLI.ApplyCLIFlag instance GHC.Classes.Eq Stack.Types.BuildOptsCLI.ApplyCLIFlag instance GHC.Classes.Eq Stack.Types.BuildOptsCLI.BuildSubset instance GHC.Show.Show Stack.Types.BuildOptsCLI.BuildSubset instance GHC.Classes.Eq Stack.Types.BuildOptsCLI.FileWatchOpts instance GHC.Show.Show Stack.Types.BuildOptsCLI.FileWatchOpts instance GHC.Show.Show Stack.Types.BuildOptsCLI.BuildCommand instance GHC.Classes.Eq Stack.Types.BuildOptsCLI.BuildCommand instance GHC.Show.Show Stack.Types.BuildOptsCLI.BuildOptsCLI module Stack.Options.PackageParser -- | Parser for package:[-]flag readFlag :: ReadM (Map ApplyCLIFlag (Map FlagName Bool)) -- | Configuration options for building from the command line and/or a -- configuration file. module Stack.Types.BuildOptsMonoid -- | Build options that may be specified in the stack.yaml or from the CLI data BuildOptsMonoid BuildOptsMonoid :: !Any -> !Any -> !Any -> !FirstFalse -> !FirstFalse -> !FirstTrue -> !FirstTrue -> !FirstFalse -> !HaddockOptsMonoid -> !FirstFalse -> !First Bool -> !FirstFalse -> !FirstTrue -> !FirstFalse -> !FirstFalse -> !FirstFalse -> !FirstFalse -> !First Bool -> !FirstFalse -> !FirstFalse -> !FirstFalse -> !TestOptsMonoid -> !FirstFalse -> !BenchmarkOptsMonoid -> !FirstFalse -> !First CabalVerbosity -> !FirstFalse -> ![Text] -> !FirstTrue -> !First ProgressBarFormat -> !First Text -> BuildOptsMonoid [$sel:trace:BuildOptsMonoid] :: BuildOptsMonoid -> !Any [$sel:profile:BuildOptsMonoid] :: BuildOptsMonoid -> !Any [$sel:noStrip:BuildOptsMonoid] :: BuildOptsMonoid -> !Any [$sel:libProfile:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:exeProfile:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:libStrip:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstTrue [$sel:exeStrip:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstTrue [$sel:buildHaddocks:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:haddockOpts:BuildOptsMonoid] :: BuildOptsMonoid -> !HaddockOptsMonoid [$sel:openHaddocks:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:haddockDeps:BuildOptsMonoid] :: BuildOptsMonoid -> !First Bool [$sel:haddockInternal:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:haddockHyperlinkSource:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstTrue [$sel:haddockForHackage:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:installExes:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:installCompilerTool:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:preFetch:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:keepGoing:BuildOptsMonoid] :: BuildOptsMonoid -> !First Bool [$sel:keepTmpFiles:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:forceDirty:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:tests:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:testOpts:BuildOptsMonoid] :: BuildOptsMonoid -> !TestOptsMonoid [$sel:benchmarks:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:benchmarkOpts:BuildOptsMonoid] :: BuildOptsMonoid -> !BenchmarkOptsMonoid [$sel:reconfigure:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:cabalVerbose:BuildOptsMonoid] :: BuildOptsMonoid -> !First CabalVerbosity [$sel:splitObjs:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstFalse [$sel:skipComponents:BuildOptsMonoid] :: BuildOptsMonoid -> ![Text] [$sel:interleavedOutput:BuildOptsMonoid] :: BuildOptsMonoid -> !FirstTrue [$sel:progressBar:BuildOptsMonoid] :: BuildOptsMonoid -> !First ProgressBarFormat [$sel:ddumpDir:BuildOptsMonoid] :: BuildOptsMonoid -> !First Text newtype HaddockOptsMonoid HaddockOptsMonoid :: [String] -> HaddockOptsMonoid [$sel:additionalArgs:HaddockOptsMonoid] :: HaddockOptsMonoid -> [String] data TestOptsMonoid TestOptsMonoid :: !FirstTrue -> ![String] -> !FirstFalse -> !FirstFalse -> !First (Maybe Int) -> !FirstTrue -> TestOptsMonoid [$sel:rerunTests:TestOptsMonoid] :: TestOptsMonoid -> !FirstTrue [$sel:additionalArgs:TestOptsMonoid] :: TestOptsMonoid -> ![String] [$sel:coverage:TestOptsMonoid] :: TestOptsMonoid -> !FirstFalse [$sel:disableRun:TestOptsMonoid] :: TestOptsMonoid -> !FirstFalse [$sel:maximumTimeSeconds:TestOptsMonoid] :: TestOptsMonoid -> !First (Maybe Int) [$sel:allowStdin:TestOptsMonoid] :: TestOptsMonoid -> !FirstTrue data BenchmarkOptsMonoid BenchmarkOptsMonoid :: !First String -> !First Bool -> BenchmarkOptsMonoid [$sel:additionalArgs:BenchmarkOptsMonoid] :: BenchmarkOptsMonoid -> !First String [$sel:disableRun:BenchmarkOptsMonoid] :: BenchmarkOptsMonoid -> !First Bool newtype CabalVerbosity CabalVerbosity :: Verbosity -> CabalVerbosity data ProgressBarFormat NoBar :: ProgressBarFormat CountOnlyBar :: ProgressBarFormat CappedBar :: ProgressBarFormat FullBar :: ProgressBarFormat buildOptsMonoidHaddockL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsMonoidTestsL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsMonoidBenchmarksL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsMonoidInstallExesL :: Lens' BuildOptsMonoid (Maybe Bool) toFirstCabalVerbosity :: FirstFalse -> First CabalVerbosity -- | Parse ProgressBarFormat from a String. readProgressBarFormat :: String -> Either String ProgressBarFormat instance GHC.Generics.Generic Stack.Types.BuildOptsMonoid.TestOptsMonoid instance GHC.Show.Show Stack.Types.BuildOptsMonoid.TestOptsMonoid instance GHC.Show.Show Stack.Types.BuildOptsMonoid.HaddockOptsMonoid instance GHC.Generics.Generic Stack.Types.BuildOptsMonoid.HaddockOptsMonoid instance GHC.Show.Show Stack.Types.BuildOptsMonoid.BenchmarkOptsMonoid instance GHC.Generics.Generic Stack.Types.BuildOptsMonoid.BenchmarkOptsMonoid instance GHC.Show.Show Stack.Types.BuildOptsMonoid.CabalVerbosity instance GHC.Classes.Eq Stack.Types.BuildOptsMonoid.CabalVerbosity instance GHC.Show.Show Stack.Types.BuildOptsMonoid.ProgressBarFormat instance GHC.Classes.Eq Stack.Types.BuildOptsMonoid.ProgressBarFormat instance GHC.Show.Show Stack.Types.BuildOptsMonoid.BuildOptsMonoid instance GHC.Generics.Generic Stack.Types.BuildOptsMonoid.BuildOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.BuildOptsMonoid.BuildOptsMonoid) instance GHC.Base.Semigroup Stack.Types.BuildOptsMonoid.BuildOptsMonoid instance GHC.Base.Monoid Stack.Types.BuildOptsMonoid.BuildOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.BuildOptsMonoid.ProgressBarFormat instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.BuildOptsMonoid.CabalVerbosity instance Distribution.Parsec.Parsec Stack.Types.BuildOptsMonoid.CabalVerbosity instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.BuildOptsMonoid.BenchmarkOptsMonoid) instance GHC.Base.Semigroup Stack.Types.BuildOptsMonoid.BenchmarkOptsMonoid instance GHC.Base.Monoid Stack.Types.BuildOptsMonoid.BenchmarkOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.BuildOptsMonoid.HaddockOptsMonoid) instance GHC.Base.Semigroup Stack.Types.BuildOptsMonoid.HaddockOptsMonoid instance GHC.Base.Monoid Stack.Types.BuildOptsMonoid.HaddockOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.BuildOptsMonoid.TestOptsMonoid) instance GHC.Base.Semigroup Stack.Types.BuildOptsMonoid.TestOptsMonoid instance GHC.Base.Monoid Stack.Types.BuildOptsMonoid.TestOptsMonoid -- | Configuration options for building. module Stack.Types.BuildOpts -- | 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 -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> !Bool -> !TestOpts -> !Bool -> !BenchmarkOpts -> !Bool -> !CabalVerbosity -> !Bool -> ![Text] -> !Bool -> !ProgressBarFormat -> !Maybe Text -> BuildOpts [$sel:libProfile:BuildOpts] :: BuildOpts -> !Bool [$sel:exeProfile:BuildOpts] :: BuildOpts -> !Bool [$sel:libStrip:BuildOpts] :: BuildOpts -> !Bool [$sel:exeStrip:BuildOpts] :: BuildOpts -> !Bool -- | Build Haddock documentation? [$sel:buildHaddocks:BuildOpts] :: BuildOpts -> !Bool -- | Options to pass to haddock [$sel:haddockOpts:BuildOpts] :: BuildOpts -> !HaddockOpts -- | Open haddocks in the browser? [$sel:openHaddocks:BuildOpts] :: BuildOpts -> !Bool -- | Build haddocks for dependencies? [$sel:haddockDeps:BuildOpts] :: BuildOpts -> !Maybe Bool -- | Build haddocks for all symbols and packages, like cabal haddock -- --internal [$sel:haddockInternal:BuildOpts] :: BuildOpts -> !Bool -- | Build hyperlinked source. Disable for no sources. [$sel:haddockHyperlinkSource:BuildOpts] :: BuildOpts -> !Bool -- | Build with flags to generate Haddock documentation suitable to upload -- to Hackage. [$sel:haddockForHackage:BuildOpts] :: BuildOpts -> !Bool -- | Install executables to user path after building? [$sel:installExes:BuildOpts] :: BuildOpts -> !Bool -- | Install executables to compiler tools path after building? [$sel:installCompilerTool:BuildOpts] :: BuildOpts -> !Bool -- | Fetch all packages immediately ^ Watch files for changes and -- automatically rebuild [$sel:preFetch:BuildOpts] :: BuildOpts -> !Bool -- | Keep building/running after failure [$sel:keepGoing:BuildOpts] :: BuildOpts -> !Maybe Bool -- | Keep intermediate files and build directories [$sel:keepTmpFiles:BuildOpts] :: BuildOpts -> !Bool -- | Force treating all local packages as having dirty files [$sel:forceDirty:BuildOpts] :: BuildOpts -> !Bool -- | Turn on tests for local targets [$sel:tests:BuildOpts] :: BuildOpts -> !Bool -- | Additional test arguments [$sel:testOpts:BuildOpts] :: BuildOpts -> !TestOpts -- | Turn on benchmarks for local targets [$sel:benchmarks:BuildOpts] :: BuildOpts -> !Bool -- | Additional test arguments ^ Commands (with arguments) to run after a -- successful build ^ Only perform the configure step when building [$sel:benchmarkOpts:BuildOpts] :: BuildOpts -> !BenchmarkOpts -- | Perform the configure step even if already configured [$sel:reconfigure:BuildOpts] :: BuildOpts -> !Bool -- | Ask Cabal to be verbose in its builds [$sel:cabalVerbose:BuildOpts] :: BuildOpts -> !CabalVerbosity -- | Whether to enable split-objs. [$sel:splitObjs:BuildOpts] :: BuildOpts -> !Bool -- | Which components to skip when building [$sel:skipComponents:BuildOpts] :: BuildOpts -> ![Text] -- | Should we use the interleaved GHC output when building multiple -- packages? [$sel:interleavedOutput:BuildOpts] :: BuildOpts -> !Bool -- | Format of the progress bar [$sel:progressBar:BuildOpts] :: BuildOpts -> !ProgressBarFormat [$sel:ddumpDir:BuildOpts] :: BuildOpts -> !Maybe Text -- | Haddock Options newtype HaddockOpts HaddockOpts :: [String] -> HaddockOpts -- | Arguments passed to haddock program [$sel:additionalArgs:HaddockOpts] :: HaddockOpts -> [String] -- | Options for the FinalAction DoTests data TestOpts TestOpts :: !Bool -> ![String] -> !Bool -> !Bool -> !Maybe Int -> !Bool -> TestOpts -- | Whether successful tests will be run gain [$sel:rerunTests:TestOpts] :: TestOpts -> !Bool -- | Arguments passed to the test program [$sel:additionalArgs:TestOpts] :: TestOpts -> ![String] -- | Generate a code coverage report [$sel:coverage:TestOpts] :: TestOpts -> !Bool -- | Disable running of tests [$sel:disableRun:TestOpts] :: TestOpts -> !Bool -- | test suite timeout in seconds [$sel:maximumTimeSeconds:TestOpts] :: TestOpts -> !Maybe Int -- | Whether to allow standard input [$sel:allowStdin:TestOpts] :: TestOpts -> !Bool -- | Options for the FinalAction DoBenchmarks data BenchmarkOpts BenchmarkOpts :: !Maybe String -> !Bool -> BenchmarkOpts -- | Arguments passed to the benchmark program [$sel:additionalArgs:BenchmarkOpts] :: BenchmarkOpts -> !Maybe String -- | Disable running of benchmarks [$sel:disableRun:BenchmarkOpts] :: BenchmarkOpts -> !Bool buildOptsHaddockL :: Lens' BuildOpts Bool buildOptsInstallExesL :: Lens' BuildOpts Bool instance GHC.Show.Show Stack.Types.BuildOpts.HaddockOpts instance GHC.Classes.Eq Stack.Types.BuildOpts.HaddockOpts instance GHC.Show.Show Stack.Types.BuildOpts.TestOpts instance GHC.Classes.Eq Stack.Types.BuildOpts.TestOpts instance GHC.Show.Show Stack.Types.BuildOpts.BenchmarkOpts instance GHC.Classes.Eq Stack.Types.BuildOpts.BenchmarkOpts instance GHC.Show.Show Stack.Types.BuildOpts.BuildOpts 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.BenchParser -- | Parser for bench arguments. FIXME hiding options benchOptsParser :: Bool -> Parser BenchmarkOptsMonoid -- | Default configuration options for building. module Stack.BuildOpts defaultBuildOpts :: BuildOpts defaultTestOpts :: TestOpts defaultHaddockOpts :: HaddockOpts defaultBenchmarkOpts :: BenchmarkOpts -- | Build configuration module Stack.Config.Build -- | Interprets BuildOptsMonoid options. buildOptsFromMonoid :: BuildOptsMonoid -> BuildOpts -- | Interprets HaddockOptsMonoid options. haddockOptsFromMonoid :: HaddockOptsMonoid -> HaddockOpts -- | Interprets TestOptsMonoid options. testOptsFromMonoid :: TestOptsMonoid -> Maybe [String] -> TestOpts -- | Interprets BenchmarkOptsMonoid options. benchmarkOptsFromMonoid :: BenchmarkOptsMonoid -> Maybe [String] -> BenchmarkOpts module Stack.Types.CabalConfigKey -- | Which packages do configure opts apply to? data CabalConfigKey -- | See AGOTargets CCKTargets :: CabalConfigKey -- | See AGOLocals CCKLocals :: CabalConfigKey -- | See AGOEverything CCKEverything :: CabalConfigKey -- | A specific package CCKPackage :: !PackageName -> CabalConfigKey parseCabalConfigKey :: (Monad m, MonadFail m) => Text -> m CabalConfigKey instance GHC.Classes.Ord Stack.Types.CabalConfigKey.CabalConfigKey instance GHC.Classes.Eq Stack.Types.CabalConfigKey.CabalConfigKey instance GHC.Read.Read Stack.Types.CabalConfigKey.CabalConfigKey instance GHC.Show.Show Stack.Types.CabalConfigKey.CabalConfigKey instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.CabalConfigKey.CabalConfigKey instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.CabalConfigKey.CabalConfigKey -- | Casa configuration types. module Stack.Types.Casa -- | An uninterpreted representation of Casa configuration options. -- Configurations may be "cascaded" using mappend (left-biased). data CasaOptsMonoid CasaOptsMonoid :: !FirstTrue -> !First CasaRepoPrefix -> !First Int -> CasaOptsMonoid [$sel:enable:CasaOptsMonoid] :: CasaOptsMonoid -> !FirstTrue [$sel:repoPrefix:CasaOptsMonoid] :: CasaOptsMonoid -> !First CasaRepoPrefix [$sel:maxKeysPerRequest:CasaOptsMonoid] :: CasaOptsMonoid -> !First Int instance GHC.Show.Show Stack.Types.Casa.CasaOptsMonoid instance GHC.Generics.Generic Stack.Types.Casa.CasaOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.Casa.CasaOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Casa.CasaOptsMonoid instance GHC.Base.Monoid Stack.Types.Casa.CasaOptsMonoid module Stack.Types.ColorWhen data ColorWhen ColorNever :: ColorWhen ColorAlways :: ColorWhen ColorAuto :: ColorWhen readColorWhen :: ReadM ColorWhen instance GHC.Show.Show Stack.Types.ColorWhen.ColorWhen instance GHC.Generics.Generic Stack.Types.ColorWhen.ColorWhen instance GHC.Classes.Eq Stack.Types.ColorWhen.ColorWhen instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.ColorWhen.ColorWhen module Stack.DefaultColorWhen -- | The default adopts the standard proposed at -- http://no-color.org/, that color should not be added by default -- if the NO_COLOR environment variable is present. defaultColorWhen :: IO ColorWhen 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 -- | A module providing a type representing the name of an 'unqualified' -- component and related helper functions. module Stack.Types.ComponentUtils -- | Type representing the name of an 'unqualified' component (that is, the -- component can be any sort - a (unnamed) main library or sub-library, -- an executable, etc. ). -- -- The corresponding The Cabal-syntax type is UnqualComponentName. newtype StackUnqualCompName StackUnqualCompName :: Text -> StackUnqualCompName [$sel:unqualCompToText:StackUnqualCompName] :: StackUnqualCompName -> Text fromCabalName :: UnqualComponentName -> StackUnqualCompName toCabalName :: StackUnqualCompName -> UnqualComponentName instance GHC.Show.Show Stack.Types.ComponentUtils.StackUnqualCompName instance GHC.Read.Read Stack.Types.ComponentUtils.StackUnqualCompName instance GHC.Classes.Ord Stack.Types.ComponentUtils.StackUnqualCompName instance Control.DeepSeq.NFData Stack.Types.ComponentUtils.StackUnqualCompName instance Data.String.IsString Stack.Types.ComponentUtils.StackUnqualCompName instance Data.Hashable.Class.Hashable Stack.Types.ComponentUtils.StackUnqualCompName instance GHC.Generics.Generic Stack.Types.ComponentUtils.StackUnqualCompName instance GHC.Classes.Eq Stack.Types.ComponentUtils.StackUnqualCompName instance Data.Data.Data Stack.Types.ComponentUtils.StackUnqualCompName -- | Module exporting the Curator type, used to represent Stack's -- project-specific curator option, which supports the needs of -- the curator tool. module Stack.Types.Curator -- | Type representing configuration options which support the needs of the -- curator tool. data Curator Curator :: !Set PackageName -> !Set PackageName -> !Set PackageName -> !Set PackageName -> !Set PackageName -> !Set PackageName -> Curator -- | Packages for which Stack should ignore test suites. [$sel:skipTest:Curator] :: Curator -> !Set PackageName -- | Packages for which Stack should expect building test suites to fail. [$sel:expectTestFailure:Curator] :: Curator -> !Set PackageName -- | Packages for which Stack should ignore benchmarks. [$sel:skipBenchmark:Curator] :: Curator -> !Set PackageName -- | Packages for which Stack should expect building benchmarks to fail. [$sel:expectBenchmarkFailure:Curator] :: Curator -> !Set PackageName -- | Packages for which Stack should ignore creating Haddock documentation. [$sel:skipHaddock:Curator] :: Curator -> !Set PackageName -- | Packages for which Stack should expect creating Haddock documentation -- to fail. [$sel:expectHaddockFailure:Curator] :: Curator -> !Set PackageName instance GHC.Show.Show Stack.Types.Curator.Curator instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Curator.Curator instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.Curator.Curator) module Stack.Types.Dependency -- | The value for a map from dependency name. This contains both the -- version range and the type of dependency. data DepValue DepValue :: !VersionRange -> !DepType -> DepValue [$sel:versionRange:DepValue] :: DepValue -> !VersionRange [$sel:depType:DepValue] :: 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 -- https://github.com/commercialhaskell/stack/issues/2195 data DepType AsLibrary :: !DepLibrary -> DepType AsBuildTool :: DepType data DepLibrary DepLibrary :: !Bool -> Set StackUnqualCompName -> DepLibrary [$sel:main:DepLibrary] :: DepLibrary -> !Bool [$sel:subLib:DepLibrary] :: DepLibrary -> Set StackUnqualCompName cabalToStackDep :: Dependency -> DepValue cabalExeToStackDep :: ExeDependency -> DepValue cabalSetupDepsToStackDep :: SetupBuildInfo -> Map PackageName DepValue libraryDepFromVersionRange :: VersionRange -> DepValue isDepTypeLibrary :: DepType -> Bool getDepSublib :: DepValue -> Maybe (Set StackUnqualCompName) instance GHC.Show.Show Stack.Types.Dependency.DepLibrary instance GHC.Classes.Eq Stack.Types.Dependency.DepLibrary instance GHC.Show.Show Stack.Types.Dependency.DepType instance GHC.Classes.Eq Stack.Types.Dependency.DepType instance GHC.Show.Show Stack.Types.Dependency.DepValue module Stack.Types.DependencyTree data DependencyTree DependencyTree :: Set PackageName -> Map PackageName (Set PackageName, DotPayload) -> DependencyTree -- | Information about a package in the dependency graph, when available. data DotPayload DotPayload :: Maybe Version -> Maybe (Either License License) -> Maybe PackageLocation -> DotPayload -- | The package version. [$sel:version:DotPayload] :: DotPayload -> Maybe Version -- | The license the package was released under. [$sel:license:DotPayload] :: DotPayload -> Maybe (Either License License) -- | The location of the package. [$sel:location:DotPayload] :: DotPayload -> Maybe PackageLocation licenseText :: DotPayload -> Text versionText :: DotPayload -> Text instance GHC.Show.Show Stack.Types.DependencyTree.DotPayload instance GHC.Classes.Eq Stack.Types.DependencyTree.DotPayload instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.DependencyTree.DependencyTree module Stack.Types.DockerEntrypoint -- | Data passed into Docker container for the Docker entrypoint's use newtype DockerEntrypoint DockerEntrypoint :: Maybe DockerUser -> DockerEntrypoint -- | UIDGIDetc of host user, if we wish to perform UID/GID switch in -- container [$sel:user:DockerEntrypoint] :: DockerEntrypoint -> Maybe DockerUser -- | Docker host user info data DockerUser DockerUser :: UserID -> GroupID -> [GroupID] -> FileMode -> DockerUser -- | uid [$sel:uid:DockerUser] :: DockerUser -> UserID -- | gid [$sel:gid:DockerUser] :: DockerUser -> GroupID -- | Supplemental groups [$sel:groups:DockerUser] :: DockerUser -> [GroupID] -- | File creation mask } [$sel:umask:DockerUser] :: DockerUser -> FileMode instance GHC.Show.Show Stack.Types.DockerEntrypoint.DockerUser instance GHC.Read.Read Stack.Types.DockerEntrypoint.DockerUser instance GHC.Show.Show Stack.Types.DockerEntrypoint.DockerEntrypoint instance GHC.Read.Read Stack.Types.DockerEntrypoint.DockerEntrypoint -- | Module exporting the DotOpts type used by Stack's dot -- and ls dependencies commands. module Stack.Types.DotOpts -- | Options record for stack dot and stack ls -- dependencies data DotOpts DotOpts :: !Bool -> !Bool -> !Maybe Int -> !Set PackageName -> [Text] -> !Map ApplyCLIFlag (Map FlagName Bool) -> Bool -> Bool -> Bool -> DotOpts -- | Include external dependencies [$sel:includeExternal:DotOpts] :: DotOpts -> !Bool -- | Include dependencies on base [$sel:includeBase:DotOpts] :: DotOpts -> !Bool -- | Limit the depth of dependency resolution to (Just n) or continue until -- fixpoint [$sel:dependencyDepth:DotOpts] :: DotOpts -> !Maybe Int -- | Package names to prune from the graph [$sel:prune:DotOpts] :: DotOpts -> !Set PackageName -- | Stack TARGETs to trace dependencies for [$sel:dotTargets:DotOpts] :: DotOpts -> [Text] -- | Flags to apply when calculating dependencies [$sel:flags:DotOpts] :: DotOpts -> !Map ApplyCLIFlag (Map FlagName Bool) -- | Like the "--test" flag for build, affects the meaning of -- dotTargets. [$sel:testTargets:DotOpts] :: DotOpts -> Bool -- | Like the "--bench" flag for build, affects the meaning of -- dotTargets. [$sel:benchTargets:DotOpts] :: DotOpts -> Bool -- | Use global hints instead of relying on an actual GHC installation. [$sel:globalHints:DotOpts] :: DotOpts -> Bool module Stack.Types.DownloadInfo -- | 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 [$sel:url:DownloadInfo] :: DownloadInfo -> Text [$sel:contentLength:DownloadInfo] :: DownloadInfo -> Maybe Int [$sel:sha1:DownloadInfo] :: DownloadInfo -> Maybe ByteString [$sel:sha256:DownloadInfo] :: DownloadInfo -> Maybe ByteString -- | Parse JSON in existing object for DownloadInfo parseDownloadInfoFromObject :: Object -> WarningParser DownloadInfo instance GHC.Show.Show Stack.Types.DownloadInfo.DownloadInfo instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.DownloadInfo.DownloadInfo) module Stack.Types.DumpLogs -- | 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 instance GHC.Show.Show Stack.Types.DumpLogs.DumpLogs instance GHC.Read.Read Stack.Types.DumpLogs.DumpLogs instance GHC.Classes.Ord Stack.Types.DumpLogs.DumpLogs instance GHC.Classes.Eq Stack.Types.DumpLogs.DumpLogs instance GHC.Enum.Enum Stack.Types.DumpLogs.DumpLogs instance GHC.Enum.Bounded Stack.Types.DumpLogs.DumpLogs instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.DumpLogs.DumpLogs module Stack.Types.EnvSettings -- | 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 [$sel:includeLocals:EnvSettings] :: EnvSettings -> !Bool -- | include the GHC_PACKAGE_PATH variable [$sel:includeGhcPackagePath:EnvSettings] :: EnvSettings -> !Bool -- | set the STACK_EXE variable to the current executable name [$sel:stackExe:EnvSettings] :: EnvSettings -> !Bool -- | set the locale to C.UTF-8 [$sel:localeUtf8:EnvSettings] :: EnvSettings -> !Bool -- | if True, keep GHCRTS variable in environment [$sel:keepGhcRts:EnvSettings] :: EnvSettings -> !Bool minimalEnvSettings :: EnvSettings -- | Default EnvSettings which includes locals and -- GHC_PACKAGE_PATH. -- -- Note that this also passes through the GHCRTS environment variable. -- See https://github.com/commercialhaskell/stack/issues/3444 defaultEnvSettings :: EnvSettings -- | Environment settings which do not embellish the environment -- -- Note that this also passes through the GHCRTS environment variable. -- See https://github.com/commercialhaskell/stack/issues/3444 plainEnvSettings :: EnvSettings instance GHC.Show.Show Stack.Types.EnvSettings.EnvSettings instance GHC.Classes.Ord Stack.Types.EnvSettings.EnvSettings instance GHC.Classes.Eq Stack.Types.EnvSettings.EnvSettings module Stack.Types.ExtraDirs data ExtraDirs ExtraDirs :: ![Path Abs Dir] -> ![Path Abs Dir] -> ![Path Abs Dir] -> ExtraDirs [$sel:bins:ExtraDirs] :: ExtraDirs -> ![Path Abs Dir] [$sel:includes:ExtraDirs] :: ExtraDirs -> ![Path Abs Dir] [$sel:libs:ExtraDirs] :: ExtraDirs -> ![Path Abs Dir] instance GHC.Generics.Generic Stack.Types.ExtraDirs.ExtraDirs instance GHC.Show.Show Stack.Types.ExtraDirs.ExtraDirs instance GHC.Base.Semigroup Stack.Types.ExtraDirs.ExtraDirs instance GHC.Base.Monoid Stack.Types.ExtraDirs.ExtraDirs module Stack.Types.FileDigestCache -- | Type synonym representing caches of digests of files. type FileDigestCache = IORef (Map FilePath SHA256) newFileDigestCache :: MonadIO m => m FileDigestCache readFileDigest :: MonadIO m => FileDigestCache -> FilePath -> m SHA256 module Stack.Types.GHCDownloadInfo data GHCDownloadInfo GHCDownloadInfo :: [Text] -> Map Text Text -> DownloadInfo -> GHCDownloadInfo [$sel:configureOpts:GHCDownloadInfo] :: GHCDownloadInfo -> [Text] [$sel:configureEnv:GHCDownloadInfo] :: GHCDownloadInfo -> Map Text Text [$sel:downloadInfo:GHCDownloadInfo] :: GHCDownloadInfo -> DownloadInfo instance GHC.Show.Show Stack.Types.GHCDownloadInfo.GHCDownloadInfo instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.GHCDownloadInfo.GHCDownloadInfo) module Stack.Types.GHCVariant -- | Specialized variant of GHC (e.g. libgmp4 or integer-simple) data GHCVariant -- | Standard bindist GHCStandard :: GHCVariant -- | Bindist that uses integer-simple GHCIntegerSimple :: GHCVariant -- | Bindist that uses the Haskell-native big-integer backend GHCNativeBignum :: GHCVariant -- | Other bindists GHCCustom :: String -> GHCVariant -- | Class for environment values which have a GHCVariant class HasGHCVariant env ghcVariantL :: HasGHCVariant env => SimpleGetter env 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 instance GHC.Show.Show Stack.Types.GHCVariant.GHCVariant instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.GHCVariant.GHCVariant instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.GHCVariant.GHCVariant module Stack.Options.GhcVariantParser -- | GHC variant parser ghcVariantParser :: Bool -> Parser GHCVariant module Stack.Types.GhcOptionKey data GhcOptionKey GOKOldEverything :: GhcOptionKey GOKEverything :: GhcOptionKey GOKLocals :: GhcOptionKey GOKTargets :: GhcOptionKey GOKPackage :: !PackageName -> GhcOptionKey instance GHC.Classes.Ord Stack.Types.GhcOptionKey.GhcOptionKey instance GHC.Classes.Eq Stack.Types.GhcOptionKey.GhcOptionKey instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.GhcOptionKey.GhcOptionKey module Stack.Types.GhcOptions newtype GhcOptions GhcOptions :: [Text] -> GhcOptions [$sel:ghcOptions:GhcOptions] :: GhcOptions -> [Text] instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.GhcOptions.GhcOptions -- | A ghc-pkg id. module Stack.Types.GhcPkgId -- | A ghc-pkg package identifier. data GhcPkgId -- | Get a text value of GHC package id unGhcPkgId :: GhcPkgId -> Text -- | A parser for a package-version-hash pair. ghcPkgIdParser :: Parser GhcPkgId -- | Convenient way to parse a package name from a Text. parseGhcPkgId :: MonadThrow m => Text -> m GhcPkgId -- | Get a string representation of GHC package id. ghcPkgIdString :: GhcPkgId -> String instance GHC.Show.Show Stack.Types.GhcPkgId.GhcPkgIdParseFail instance Database.Persist.Sql.Class.PersistFieldSql Stack.Types.GhcPkgId.GhcPkgId instance Database.Persist.Class.PersistField.PersistField Stack.Types.GhcPkgId.GhcPkgId instance GHC.Classes.Ord Stack.Types.GhcPkgId.GhcPkgId instance GHC.Generics.Generic Stack.Types.GhcPkgId.GhcPkgId instance GHC.Classes.Eq Stack.Types.GhcPkgId.GhcPkgId instance Data.Data.Data Stack.Types.GhcPkgId.GhcPkgId instance Data.Hashable.Class.Hashable Stack.Types.GhcPkgId.GhcPkgId instance Control.DeepSeq.NFData Stack.Types.GhcPkgId.GhcPkgId instance GHC.Show.Show Stack.Types.GhcPkgId.GhcPkgId instance GHC.Read.Read 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.Exception.Type.Exception Stack.Types.GhcPkgId.GhcPkgIdParseFail module Stack.Types.Cache -- | Type of config cache data ConfigCacheType ConfigCacheTypeConfig :: ConfigCacheType ConfigCacheTypeFlagLibrary :: GhcPkgId -> ConfigCacheType ConfigCacheTypeFlagExecutable :: PackageIdentifier -> ConfigCacheType data Action UpgradeCheck :: Action instance GHC.Show.Show Stack.Types.Cache.ConfigCacheType instance GHC.Classes.Eq Stack.Types.Cache.ConfigCacheType instance GHC.Show.Show Stack.Types.Cache.Action instance GHC.Classes.Ord Stack.Types.Cache.Action instance GHC.Classes.Eq Stack.Types.Cache.Action instance Database.Persist.Class.PersistField.PersistField Stack.Types.Cache.Action instance Database.Persist.Sql.Class.PersistFieldSql Stack.Types.Cache.Action instance Database.Persist.Class.PersistField.PersistField Stack.Types.Cache.ConfigCacheType instance Database.Persist.Sql.Class.PersistFieldSql Stack.Types.Cache.ConfigCacheType -- | This module contains all the types related to the idea of installing a -- package in the pkg-db or an executable on the file system. module Stack.Types.Installed -- | Type representing user package databases that packages can be -- installed into. data InstallLocation -- | The write-only package database, formerly known as the snapshot -- database. Snap :: InstallLocation -- | The mutable package database, formerly known as the local database. Local :: InstallLocation -- | Type representing user (non-global) package databases that can provide -- installed packages. data InstalledPackageLocation -- | A package database that a package can be installed into. InstalledTo :: InstallLocation -> InstalledPackageLocation -- | An 'extra' package database, specified by extra-package-dbs. ExtraPkgDb :: InstalledPackageLocation -- | Type representing package databases that can provide installed -- packages. data PackageDatabase -- | GHC's global package database. GlobalPkgDb :: PackageDatabase -- | A user package database. UserPkgDb :: InstalledPackageLocation -> Path Abs Dir -> PackageDatabase -- | Type representing varieties of package databases that can provide -- installed packages. data PackageDbVariety -- | GHC's global package database. GlobalDb :: PackageDbVariety -- | An 'extra' package database, specified by extra-package-dbs. ExtraDb :: PackageDbVariety -- | The write-only package database, for immutable packages. WriteOnlyDb :: PackageDbVariety -- | The mutable package database. MutableDb :: PackageDbVariety -- | Type synonym representing dictionaries of package names for a -- project's packages and dependencies, and pairs of their relevant -- database (write-only or mutable) and package versions. type InstallMap = Map PackageName (InstallLocation, Version) -- | Type representing information about what is installed. data Installed -- | A library, including its installed package id and, optionally, its -- license. Library :: PackageIdentifier -> InstalledLibraryInfo -> Installed -- | An executable. Executable :: PackageIdentifier -> Installed -- | Type synonym representing dictionaries of package names, and a pair of -- in which package database the package is installed (write-only or -- mutable) and information about what is installed. type InstalledMap = Map PackageName (InstallLocation, Installed) data InstalledLibraryInfo InstalledLibraryInfo :: GhcPkgId -> Maybe (Either License License) -> Map StackUnqualCompName GhcPkgId -> InstalledLibraryInfo [ghcPkgId] :: InstalledLibraryInfo -> GhcPkgId [license] :: InstalledLibraryInfo -> Maybe (Either License License) [subLib] :: InstalledLibraryInfo -> Map StackUnqualCompName GhcPkgId -- | A function to yield the variety of package database for a given -- package database that can provide installed packages. toPackageDbVariety :: PackageDatabase -> PackageDbVariety installedLibraryInfoFromGhcPkgId :: GhcPkgId -> InstalledLibraryInfo simpleInstalledLib :: PackageIdentifier -> GhcPkgId -> Map StackUnqualCompName GhcPkgId -> Installed installedToPackageIdOpt :: InstalledLibraryInfo -> [String] installedPackageIdentifier :: Installed -> PackageIdentifier -- | Get the installed Version. installedVersion :: Installed -> Version -- | A strict fold over the GhcPkgId of the given installed package. -- This will iterate on both sub and main libraries, if any. foldOnGhcPkgId' :: (Maybe StackUnqualCompName -> GhcPkgId -> resT -> resT) -> Installed -> resT -> resT instance GHC.Show.Show Stack.Types.Installed.InstallLocation instance GHC.Classes.Eq Stack.Types.Installed.InstallLocation instance GHC.Show.Show Stack.Types.Installed.InstalledPackageLocation instance GHC.Classes.Eq Stack.Types.Installed.InstalledPackageLocation instance GHC.Show.Show Stack.Types.Installed.PackageDatabase instance GHC.Classes.Eq Stack.Types.Installed.PackageDatabase instance GHC.Show.Show Stack.Types.Installed.PackageDbVariety instance GHC.Classes.Eq Stack.Types.Installed.PackageDbVariety instance GHC.Show.Show Stack.Types.Installed.InstalledLibraryInfo instance GHC.Classes.Eq Stack.Types.Installed.InstalledLibraryInfo instance GHC.Show.Show Stack.Types.Installed.Installed instance GHC.Classes.Eq Stack.Types.Installed.Installed instance GHC.Base.Semigroup Stack.Types.Installed.InstallLocation instance GHC.Base.Monoid Stack.Types.Installed.InstallLocation module Stack.Types.IsMutable data IsMutable Mutable :: IsMutable Immutable :: IsMutable instance GHC.Show.Show Stack.Types.IsMutable.IsMutable instance GHC.Classes.Eq Stack.Types.IsMutable.IsMutable instance GHC.Base.Semigroup Stack.Types.IsMutable.IsMutable instance GHC.Base.Monoid Stack.Types.IsMutable.IsMutable module Stack.Types.LockFileBehavior -- | How to interact with lock files data LockFileBehavior -- | Read and write lock files LFBReadWrite :: LockFileBehavior -- | Read lock files, but do not write them LFBReadOnly :: LockFileBehavior -- | Entirely ignore lock files LFBIgnore :: LockFileBehavior -- | Error out on trying to write a lock file. This can be used to ensure -- that lock files in a repository already ensure reproducible builds. LFBErrorOnWrite :: LockFileBehavior -- | Parser for LockFileBehavior readLockFileBehavior :: ReadM LockFileBehavior instance GHC.Show.Show Stack.Types.LockFileBehavior.LockFileBehavior instance GHC.Enum.Enum Stack.Types.LockFileBehavior.LockFileBehavior instance GHC.Enum.Bounded Stack.Types.LockFileBehavior.LockFileBehavior -- | Module exporting the NamedComponent type and related functions. module Stack.Types.NamedComponent -- | Type representing components of a fully-resolved Cabal package. data NamedComponent CLib :: NamedComponent CSubLib :: !Text -> NamedComponent CFlib :: !Text -> NamedComponent CExe :: !Text -> NamedComponent CTest :: !Text -> NamedComponent CBench :: !Text -> NamedComponent renderComponent :: NamedComponent -> Text -- | Render a component to anything with an IsString instance. For -- Text prefer renderComponent. renderComponentTo :: IsString a => NamedComponent -> a renderPkgComponents :: [(PackageName, NamedComponent)] -> Text renderPkgComponent :: (PackageName, NamedComponent) -> Text exeComponents :: Set NamedComponent -> Set Text testComponents :: Set NamedComponent -> Set Text benchComponents :: Set NamedComponent -> Set Text subLibComponents :: Set NamedComponent -> Set Text isCLib :: NamedComponent -> Bool isCSubLib :: NamedComponent -> Bool isCExe :: NamedComponent -> Bool isCTest :: NamedComponent -> Bool isCBench :: NamedComponent -> Bool isPotentialDependency :: NamedComponent -> Bool -- | A function to split the given list of components into sets of the -- names of the named components by the type of component (sub-libraries, -- executables, test-suites, benchmarks), ignoring any main -- unnamed library component or foreign library component. This function -- should be used very sparingly; more often than not, you can keep/parse -- the components split from the start. splitComponents :: [NamedComponent] -> (Set Text, Set Text, Set Text, Set Text) instance GHC.Show.Show Stack.Types.NamedComponent.NamedComponent instance GHC.Classes.Ord Stack.Types.NamedComponent.NamedComponent instance GHC.Classes.Eq Stack.Types.NamedComponent.NamedComponent -- | A module providing the types that represent different sorts of -- components of a package (library and sub-library, foreign library, -- executable, test suite and benchmark). module Stack.Types.Component -- | A type representing (unnamed) main library or sub-library components -- of a package. -- -- Cabal-syntax uses data constructors LMainLibName and -- LSubLibName to distinguish main libraries and sub-libraries. We -- do not do so, as the 'missing' name in the case of a main library can -- be represented by the empty string. -- -- The corresponding Cabal-syntax type is Library. data StackLibrary StackLibrary :: StackUnqualCompName -> !StackBuildInfo -> [ModuleName] -> StackLibrary [$sel:name:StackLibrary] :: StackLibrary -> StackUnqualCompName [$sel:buildInfo:StackLibrary] :: StackLibrary -> !StackBuildInfo [$sel:exposedModules:StackLibrary] :: StackLibrary -> [ModuleName] -- | A type representing foreign library components of a package. -- -- The corresponding Cabal-syntax type is ForeignLib. data StackForeignLibrary StackForeignLibrary :: StackUnqualCompName -> !StackBuildInfo -> StackForeignLibrary [$sel:name:StackForeignLibrary] :: StackForeignLibrary -> StackUnqualCompName [$sel:buildInfo:StackForeignLibrary] :: StackForeignLibrary -> !StackBuildInfo -- | A type representing executable components of a package. -- -- The corresponding Cabal-syntax type is Executable. data StackExecutable StackExecutable :: StackUnqualCompName -> !StackBuildInfo -> FilePath -> StackExecutable [$sel:name:StackExecutable] :: StackExecutable -> StackUnqualCompName [$sel:buildInfo:StackExecutable] :: StackExecutable -> !StackBuildInfo [$sel:modulePath:StackExecutable] :: StackExecutable -> FilePath -- | A type representing test suite components of a package. -- -- The corresponding Cabal-syntax type is TestSuite. data StackTestSuite StackTestSuite :: StackUnqualCompName -> !StackBuildInfo -> !TestSuiteInterface -> StackTestSuite [$sel:name:StackTestSuite] :: StackTestSuite -> StackUnqualCompName [$sel:buildInfo:StackTestSuite] :: StackTestSuite -> !StackBuildInfo [$sel:interface:StackTestSuite] :: StackTestSuite -> !TestSuiteInterface -- | A type representing benchmark components of a package. -- -- The corresponding Cabal-syntax type is Benchmark. data StackBenchmark StackBenchmark :: StackUnqualCompName -> StackBuildInfo -> BenchmarkInterface -> StackBenchmark [$sel:name:StackBenchmark] :: StackBenchmark -> StackUnqualCompName [$sel:buildInfo:StackBenchmark] :: StackBenchmark -> StackBuildInfo -- | This is only used for gathering the files related to this component. [$sel:interface:StackBenchmark] :: StackBenchmark -> BenchmarkInterface -- | Type representing the name of an 'unqualified' component (that is, the -- component can be any sort - a (unnamed) main library or sub-library, -- an executable, etc. ). -- -- The corresponding The Cabal-syntax type is UnqualComponentName. newtype StackUnqualCompName StackUnqualCompName :: Text -> StackUnqualCompName [$sel:unqualCompToText:StackUnqualCompName] :: StackUnqualCompName -> Text -- | Type representing information needed to build. The file -- gathering-related fields are lazy because they are not always needed. -- -- The corresponding Cabal-syntax type is BuildInfo. data StackBuildInfo StackBuildInfo :: !Bool -> !Map PackageName DepValue -> Set Text -> [ModuleName] -> [FilePath] -> [SymbolicPath PackageDir SourceDir] -> [FilePath] -> [String] -> [Dependency] -> PerCompilerFlavor [String] -> [Language] -> [Extension] -> [FilePath] -> [String] -> [String] -> [String] -> StackBuildInfo -- | Corresponding to Cabal-syntax's buildable. The component is -- buildable here. [$sel:buildable:StackBuildInfo] :: StackBuildInfo -> !Bool -- | Corresponding to Cabal-syntax's targetBuildDepends. -- Dependencies specific to a library or executable target. [$sel:dependency:StackBuildInfo] :: StackBuildInfo -> !Map PackageName DepValue -- | From Cabal-syntax's buildTools. We only keep the legacy build -- tool depends that we know (from a hardcoded list). We only use the -- deduplication aspect of the Set here, as this field is only used for -- error reporting in the end. This is lazy because it's an error -- reporting field only. [$sel:unknownTools:StackBuildInfo] :: StackBuildInfo -> Set Text -- | Only used in file gathering. See usage in Stack.ComponentFile -- module. [$sel:otherModules:StackBuildInfo] :: StackBuildInfo -> [ModuleName] -- | Only used in file gathering. See usage in Stack.ComponentFile -- module. [$sel:jsSources:StackBuildInfo] :: StackBuildInfo -> [FilePath] -- | Only used in file & opts gathering. See usage in -- Stack.ComponentFile module for fle gathering. [$sel:hsSourceDirs:StackBuildInfo] :: StackBuildInfo -> [SymbolicPath PackageDir SourceDir] -- | Only used in file gathering. See usage in Stack.ComponentFile -- module. [$sel:cSources:StackBuildInfo] :: StackBuildInfo -> [FilePath] -- | Only used in opts gathering. See usage in Stack.Package module. [$sel:cppOptions:StackBuildInfo] :: StackBuildInfo -> [String] -- | Only used in opts gathering. [$sel:targetBuildDepends:StackBuildInfo] :: StackBuildInfo -> [Dependency] -- | Only used in opts gathering. [$sel:options:StackBuildInfo] :: StackBuildInfo -> PerCompilerFlavor [String] -- | Only used in opts gathering. [$sel:allLanguages:StackBuildInfo] :: StackBuildInfo -> [Language] -- | Only used in opts gathering. [$sel:usedExtensions:StackBuildInfo] :: StackBuildInfo -> [Extension] -- | Only used in opts gathering. [$sel:includeDirs:StackBuildInfo] :: StackBuildInfo -> [FilePath] -- | Only used in opts gathering. [$sel:extraLibs:StackBuildInfo] :: StackBuildInfo -> [String] -- | Only used in opts gathering. [$sel:extraLibDirs:StackBuildInfo] :: StackBuildInfo -> [String] -- | Only used in opts gathering. [$sel:frameworks:StackBuildInfo] :: StackBuildInfo -> [String] -- | Type synonym for a HasField constraint. type HasName component = HasField "name" component StackUnqualCompName -- | Type synonym for a HasField constraint. type HasBuildInfo component = HasField "buildInfo" component StackBuildInfo -- | Type synonym for a HasField constraint for all the common -- component fields i.e. name, buildInfo and -- qualifiedName. type HasComponentInfo component = (HasName component, HasBuildInfo component, HasQualiName component) instance GHC.Show.Show Stack.Types.Component.ExeName instance GHC.Classes.Ord Stack.Types.Component.ExeName instance Control.DeepSeq.NFData Stack.Types.Component.ExeName instance GHC.Generics.Generic Stack.Types.Component.ExeName instance Data.String.IsString Stack.Types.Component.ExeName instance Data.Hashable.Class.Hashable Stack.Types.Component.ExeName instance GHC.Classes.Eq Stack.Types.Component.ExeName instance Data.Data.Data Stack.Types.Component.ExeName instance GHC.Show.Show Stack.Types.Component.StackBuildInfo instance GHC.Show.Show Stack.Types.Component.StackBenchmark instance GHC.Show.Show Stack.Types.Component.StackTestSuite instance GHC.Show.Show Stack.Types.Component.StackExecutable instance GHC.Show.Show Stack.Types.Component.StackForeignLibrary instance GHC.Show.Show Stack.Types.Component.StackLibrary instance GHC.Records.HasField "qualifiedName" Stack.Types.Component.StackLibrary Stack.Types.NamedComponent.NamedComponent instance GHC.Records.HasField "qualifiedName" Stack.Types.Component.StackForeignLibrary Stack.Types.NamedComponent.NamedComponent instance GHC.Records.HasField "qualifiedName" Stack.Types.Component.StackExecutable Stack.Types.NamedComponent.NamedComponent instance GHC.Records.HasField "qualifiedName" Stack.Types.Component.StackTestSuite Stack.Types.NamedComponent.NamedComponent instance GHC.Records.HasField "qualifiedName" Stack.Types.Component.StackBenchmark Stack.Types.NamedComponent.NamedComponent module Stack.Types.DumpPackage -- | Type representing dump information for a single package, as output by -- the ghc-pkg describe command. data DumpPackage DumpPackage :: !GhcPkgId -> !PackageIdentifier -> !Maybe SublibDump -> !Maybe License -> ![FilePath] -> ![Text] -> !Bool -> !Set ModuleName -> ![GhcPkgId] -> ![FilePath] -> !Maybe FilePath -> !Bool -> DumpPackage -- | The id field. [$sel:ghcPkgId:DumpPackage] :: DumpPackage -> !GhcPkgId -- | The name and version fields. The name field -- is the munged package name. If the package is not for a sub library, -- its munged name is its name. [$sel:packageIdent:DumpPackage] :: DumpPackage -> !PackageIdentifier -- | The sub library information if it's a sub-library. [$sel:sublib:DumpPackage] :: DumpPackage -> !Maybe SublibDump [$sel:license:DumpPackage] :: DumpPackage -> !Maybe License -- | The library-dirs field. [$sel:libDirs:DumpPackage] :: DumpPackage -> ![FilePath] -- | The hs-libraries field. [$sel:libraries:DumpPackage] :: DumpPackage -> ![Text] [$sel:hasExposedModules:DumpPackage] :: DumpPackage -> !Bool [$sel:exposedModules:DumpPackage] :: DumpPackage -> !Set ModuleName -- | The depends field (packages on which this package depends). [$sel:depends:DumpPackage] :: DumpPackage -> ![GhcPkgId] [$sel:haddockInterfaces:DumpPackage] :: DumpPackage -> ![FilePath] [$sel:haddockHtml:DumpPackage] :: DumpPackage -> !Maybe FilePath [$sel:isExposed:DumpPackage] :: DumpPackage -> !Bool -- | ghc-pkg has a notion of sublibraries when using ghc-pkg dump. We can -- only know it's different through the fields it shows. data SublibDump SublibDump :: PackageName -> StackUnqualCompName -> SublibDump -- | "package-name" field from ghc-pkg [$sel:packageName:SublibDump] :: SublibDump -> PackageName -- | "lib-name" field from ghc-pkg [$sel:libraryName:SublibDump] :: SublibDump -> StackUnqualCompName dpParentLibIdent :: DumpPackage -> Maybe PackageIdentifier instance GHC.Show.Show Stack.Types.DumpPackage.SublibDump instance GHC.Read.Read Stack.Types.DumpPackage.SublibDump instance GHC.Classes.Eq Stack.Types.DumpPackage.SublibDump instance GHC.Show.Show Stack.Types.DumpPackage.DumpPackage instance GHC.Read.Read Stack.Types.DumpPackage.DumpPackage instance GHC.Classes.Eq Stack.Types.DumpPackage.DumpPackage -- | A module providing the type CompCollection and associated -- helper functions. -- -- The corresponding Cabal approach uses lists. See, for example, the -- sublibraries, foreignLibs, executables, -- testSuites, and benchmarks fields. -- -- Cabal removes all the unbuildable components very early (at the cost -- of slightly worse error messages). module Stack.Types.CompCollection -- | A type representing collections of components, distinguishing -- buildable components and non-buildable components. data CompCollection component -- | Get the names of the buildable components in the given collection, as -- a Set of StackUnqualCompName. getBuildableSet :: CompCollection component -> Set StackUnqualCompName -- | Get the names of the buildable components in the given collection, as -- a Set of Text. getBuildableSetText :: CompCollection component -> Set Text -- | Get the names of the buildable components in the given collection, as -- a list of 'Text. getBuildableListText :: CompCollection component -> [Text] -- | Apply the given function to the names of the buildable components in -- the given collection, yielding a list. getBuildableListAs :: (StackUnqualCompName -> something) -> CompCollection component -> [something] -- | For the given function and foldable data structure of components of -- type compA, iterates on the elements of that structure and -- maps each element to a component of type compB while building -- a CompCollection. foldAndMakeCollection :: (HasBuildInfo compB, HasName compB, Foldable sourceCollection) => (compA -> compB) -> sourceCollection compA -> CompCollection compB -- | Yields True if, and only if, the given collection includes at -- least one buildable component. hasBuildableComponent :: CompCollection component -> Bool -- | For the given name of a buildable component and the given collection -- of components, yields Just component if the collection -- includes a buildable component of that name, and Nothing -- otherwise. collectionLookup :: Text -> CompCollection component -> Maybe component -- | For a given collection of components, yields a list of pairs for -- buildable components of the name of the component and the component. collectionKeyValueList :: CompCollection component -> [(Text, component)] -- | Yields True if, and only if, the given collection of components -- includes a buildable component with the given name. collectionMember :: Text -> CompCollection component -> Bool -- | Reduce the buildable components of the given collection of components -- by applying the given binary operator to all buildable components, -- using the given starting value (typically the right-identity of the -- operator). foldComponentToAnotherCollection :: Monad m => CompCollection component -> (component -> m a -> m a) -> m a -> m a instance GHC.Show.Show component => GHC.Show.Show (Stack.Types.CompCollection.CompCollection component) instance GHC.Base.Semigroup (Stack.Types.CompCollection.CompCollection component) instance GHC.Base.Monoid (Stack.Types.CompCollection.CompCollection component) instance Data.Foldable.Foldable Stack.Types.CompCollection.CompCollection -- | All utility functions for Components in Stack (library, internal -- library, foreign library, executable, tests, benchmarks). In -- particular, this module gathers all the Cabal-to-Stack component -- translations, which previously occurred in the Stack.Package -- module. See Stack.Types.Component for more details about the -- design choices. module Stack.Component isComponentBuildable :: HasBuildInfo component => component -> Bool stackLibraryFromCabal :: Library -> StackLibrary stackExecutableFromCabal :: Executable -> StackExecutable stackForeignLibraryFromCabal :: ForeignLib -> StackForeignLibrary stackBenchmarkFromCabal :: Benchmark -> StackBenchmark stackTestFromCabal :: TestSuite -> StackTestSuite foldOnNameAndBuildInfo :: (HasField "buildInfo" a StackBuildInfo, HasField "name" a StackUnqualCompName, Foldable c) => c a -> (StackUnqualCompName -> StackBuildInfo -> t -> t) -> t -> t stackUnqualToQual :: (Text -> NamedComponent) -> StackUnqualCompName -> NamedComponent componentDependencyMap :: (HasField "buildInfo" r1 r2, HasField "dependency" r2 a) => r1 -> a fromCabalName :: UnqualComponentName -> StackUnqualCompName -- | 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 [$sel:enable:NixOpts] :: NixOpts -> !Bool [$sel:pureShell:NixOpts] :: NixOpts -> !Bool -- | The system packages to be installed in the environment before it runs [$sel:packages:NixOpts] :: NixOpts -> ![Text] -- | The path of a file containing preconfiguration of the environment (e.g -- shell.nix) [$sel:initFile:NixOpts] :: NixOpts -> !Maybe FilePath -- | Options to be given to the nix-shell command line [$sel:shellOptions:NixOpts] :: NixOpts -> ![Text] -- | Should we register gc roots so running nix-collect-garbage doesn't -- remove nix dependencies [$sel:addGCRoots:NixOpts] :: 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] -> !FirstFalse -> NixOptsMonoid -- | Is using nix-shell enabled? [$sel:enable:NixOptsMonoid] :: NixOptsMonoid -> !First Bool -- | Should the nix-shell be pure [$sel:pureShell:NixOptsMonoid] :: NixOptsMonoid -> !First Bool -- | System packages to use (given to nix-shell) [$sel:packages:NixOptsMonoid] :: NixOptsMonoid -> !First [Text] -- | The path of a file containing preconfiguration of the environment (e.g -- shell.nix) [$sel:initFile:NixOptsMonoid] :: NixOptsMonoid -> !First FilePath -- | Options to be given to the nix-shell command line [$sel:shellOptions:NixOptsMonoid] :: NixOptsMonoid -> !First [Text] -- | Override parts of NIX_PATH (notably nixpkgs) [$sel:path:NixOptsMonoid] :: NixOptsMonoid -> !First [Text] -- | Should we register gc roots so running nix-collect-garbage doesn't -- remove nix dependencies [$sel:addGCRoots:NixOptsMonoid] :: NixOptsMonoid -> !FirstFalse -- | Add GC roots arg name nixAddGCRootsArgName :: Text -- | Nix enable argument name. nixEnableArgName :: Text -- | shell.nix file path argument name. nixInitFileArgName :: Text -- | Nix packages (build inputs) argument name. nixPackagesArgName :: Text -- | NIX_PATH override argument name nixPathArgName :: Text -- | Nix run in pure shell argument name. nixPureShellArgName :: Text -- | Extra options for the nix-shell command argument name. nixShellOptsArgName :: Text instance GHC.Show.Show Stack.Types.Nix.NixOpts instance GHC.Show.Show Stack.Types.Nix.NixOptsMonoid instance GHC.Generics.Generic Stack.Types.Nix.NixOptsMonoid instance GHC.Classes.Eq Stack.Types.Nix.NixOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.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 -- | An argument which accepts a template name of the format -- foo.hsfiles. packageNameArgument :: Mod ArgumentFields PackageName -> Parser PackageName module Stack.Types.Platform -- | A variant of the platform, used to differentiate Docker builds from -- host data PlatformVariant PlatformVariantNone :: PlatformVariant PlatformVariant :: String -> PlatformVariant -- | Class for environment values which have a Platform class HasPlatform env platformL :: HasPlatform env => Lens' env Platform platformVariantL :: HasPlatform env => Lens' env PlatformVariant -- | Render a platform variant to a String suffix. platformVariantSuffix :: PlatformVariant -> String -- | Relative directory for the platform identifier platformOnlyRelDir :: (MonadReader env m, HasPlatform env, MonadThrow m) => m (Path Rel Dir) instance Stack.Types.Platform.HasPlatform (Distribution.System.Platform, Stack.Types.Platform.PlatformVariant) module Stack.Types.Project -- | 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 -> ![RelFilePath] -> ![RawPackageLocation] -> !Map PackageName (Map FlagName Bool) -> !RawSnapshotLocation -> !Maybe WantedCompiler -> ![FilePath] -> !Maybe Curator -> !Set PackageName -> Project -- | A warning message to display to the user when the auto generated -- config may have issues. [$sel:userMsg:Project] :: Project -> !Maybe String -- | Packages which are actually part of the project (as opposed to -- dependencies). [$sel:packages:Project] :: Project -> ![RelFilePath] -- | Dependencies defined within the stack.yaml file, to be applied on top -- of the snapshot. [$sel:extraDeps:Project] :: Project -> ![RawPackageLocation] -- | Flags to be applied on top of the snapshot flags. [$sel:flagsByPkg:Project] :: Project -> !Map PackageName (Map FlagName Bool) -- | How we resolve which Snapshot to use [$sel:resolver:Project] :: Project -> !RawSnapshotLocation -- | Override the compiler in projectResolver [$sel:compiler:Project] :: Project -> !Maybe WantedCompiler [$sel:extraPackageDBs:Project] :: Project -> ![FilePath] -- | Extra configuration intended exclusively for usage by the curator -- tool. In other words, this is not part of the documented and -- exposed Stack API. SUBJECT TO CHANGE. [$sel:curator:Project] :: Project -> !Maybe Curator -- | Packages to drop from the projectResolver. [$sel:dropPackages:Project] :: Project -> !Set PackageName instance GHC.Show.Show Stack.Types.Project.Project instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Project.Project module Stack.Types.ProjectConfig -- | Project configuration information. Not every run of Stack has a true -- local project; see constructors below. data ProjectConfig a -- | Normal run: we want a project, and have one. This comes from either -- SYLDefault or SYLOverride. PCProject :: a -> ProjectConfig a -- | No project was found when using SYLDefault. Instead, use the -- implicit global. PCGlobalProject :: ProjectConfig a -- | Use a no project run. This comes from SYLNoProject. PCNoProject :: ![PackageIdentifierRevision] -> ProjectConfig a -- | Yields True only if the project configuration information is -- for the implicit global project. isPCGlobalProject :: ProjectConfig a -> Bool module Stack.Types.PvpBounds 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 pvpBoundsText :: PvpBoundsType -> Text parsePvpBounds :: Text -> Either String PvpBounds instance GHC.Show.Show Stack.Types.PvpBounds.PvpBoundsType instance GHC.Read.Read Stack.Types.PvpBounds.PvpBoundsType instance GHC.Classes.Ord Stack.Types.PvpBounds.PvpBoundsType instance GHC.Classes.Eq Stack.Types.PvpBounds.PvpBoundsType instance GHC.Enum.Enum Stack.Types.PvpBounds.PvpBoundsType instance GHC.Enum.Bounded Stack.Types.PvpBounds.PvpBoundsType instance GHC.Show.Show Stack.Types.PvpBounds.PvpBounds instance GHC.Read.Read Stack.Types.PvpBounds.PvpBounds instance GHC.Classes.Ord Stack.Types.PvpBounds.PvpBounds instance GHC.Classes.Eq Stack.Types.PvpBounds.PvpBounds instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PvpBounds.PvpBounds instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PvpBounds.PvpBounds module Stack.Types.Resolver -- | 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 :: !RawSnapshotLocation -> AbstractResolver ARGlobal :: AbstractResolver readAbstractResolver :: ReadM (Unresolved AbstractResolver) -- | Most recent Nightly and newest LTS version per major release. data Snapshots Snapshots :: !Day -> !IntMap Int -> Snapshots [$sel:nightly:Snapshots] :: Snapshots -> !Day [$sel:lts:Snapshots] :: Snapshots -> !IntMap Int instance GHC.Show.Show Stack.Types.Resolver.TypesResolverException instance GHC.Show.Show Stack.Types.Resolver.Snapshots instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Resolver.Snapshots instance GHC.Show.Show Stack.Types.Resolver.AbstractResolver instance RIO.Prelude.Display.Display Stack.Types.Resolver.AbstractResolver instance GHC.Exception.Type.Exception Stack.Types.Resolver.TypesResolverException module Stack.Options.ResolverParser -- | Parser for the snapshot abstractResolverOptsParser :: Bool -> Parser (Unresolved AbstractResolver) compilerOptsParser :: Bool -> Parser WantedCompiler readCompilerVersion :: ReadM WantedCompiler module Stack.Types.SCM -- | A software control system. data SCM Git :: SCM instance GHC.Show.Show Stack.Types.SCM.SCM instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.SCM.SCM instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.SCM.SCM module Stack.Types.StackYamlLoc -- | Location for the project's stack.yaml file. data StackYamlLoc -- | Use the standard parent-directory-checking logic SYLDefault :: StackYamlLoc -- | Use a specific stack.yaml file provided SYLOverride :: !Path Abs File -> StackYamlLoc -- | Do not load up a project, just user configuration. Include the given -- extra dependencies with the resolver. SYLNoProject :: ![PackageIdentifierRevision] -> StackYamlLoc -- | Do not look for a project configuration, and use the implicit global. SYLGlobalProject :: StackYamlLoc instance GHC.Show.Show Stack.Types.StackYamlLoc.StackYamlLoc -- | Types used by Stack.Storage modules. module Stack.Types.Storage -- | Type representing 'pretty' exceptions thrown by functions exported by -- modules beginning Stack.Storage. data StoragePrettyException StorageMigrationFailure :: !Text -> !Path Abs File -> !SomeException -> StoragePrettyException -- | A bit of type safety to ensure we're talking to the right database. newtype ProjectStorage ProjectStorage :: Storage -> ProjectStorage [projectStorage] :: ProjectStorage -> Storage -- | A bit of type safety to ensure we're talking to the right database. newtype UserStorage UserStorage :: Storage -> UserStorage [userStorage] :: UserStorage -> Storage instance GHC.Show.Show Stack.Types.Storage.StoragePrettyException instance Text.PrettyPrint.Leijen.Extended.Pretty Stack.Types.Storage.StoragePrettyException instance GHC.Exception.Type.Exception Stack.Types.Storage.StoragePrettyException -- | Utils for the other Stack.Storage modules module Stack.Storage.Util handleMigrationException :: HasLogFunc env => RIO env a -> RIO env a -- | Efficiently update a list of values stored in a database table. updateList :: (PersistEntityBackend record ~ BaseBackend backend, PersistField parentid, Ord value, PersistEntity record, MonadIO m, PersistQueryWrite backend, SafeToInsert record) => (parentid -> Int -> value -> record) -> EntityField record parentid -> parentid -> EntityField record Int -> [value] -> [value] -> ReaderT backend m () -- | Efficiently update a set of values stored in a database table updateSet :: (PersistEntityBackend record ~ BaseBackend backend, PersistField parentid, PersistField value, Ord value, PersistEntity record, MonadIO m, PersistQueryWrite backend, SafeToInsert record) => (parentid -> value -> record) -> EntityField record parentid -> parentid -> EntityField record value -> Set value -> Set value -> ReaderT backend m () -- | 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 [service] :: RepoTemplatePath -> RepoService [user] :: RepoTemplatePath -> Text [template] :: 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. To avoid path separator conversion on Windows, the raw -- command-line parameter passed is also given as the first field -- (possibly with .hsfiles appended). RelPath :: String -> Path Rel File -> TemplatePath -- | a full URL UrlPath :: String -> TemplatePath RepoPath :: RepoTemplatePath -> TemplatePath -- | 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 user/template, given a -- service parseRepoPathWithService :: RepoService -> Text -> Maybe RepoTemplatePath -- | An argument which accepts a template name of the format -- foo.hsfiles or foo, ultimately normalized to -- foo. templateNameArgument :: Mod ArgumentFields TemplateName -> Parser TemplateName -- | An argument which accepts a key:value pair for specifying -- parameters. templateParamArgument :: Mod OptionFields (Text, Text) -> Parser (Text, Text) -- | The default template name you can use if you don't have one. defaultTemplateName :: TemplateName instance GHC.Show.Show Stack.Types.TemplateName.TypeTemplateNameException 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 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.TemplatePath instance GHC.Classes.Ord Stack.Types.TemplateName.TemplatePath instance GHC.Classes.Eq Stack.Types.TemplateName.TemplatePath instance GHC.Show.Show Stack.Types.TemplateName.TemplateName instance GHC.Classes.Ord Stack.Types.TemplateName.TemplateName instance GHC.Classes.Eq Stack.Types.TemplateName.TemplateName instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.TemplateName.TemplateName instance GHC.Exception.Type.Exception Stack.Types.TemplateName.TypeTemplateNameException module Stack.Types.UnusedFlags data UnusedFlags UFNoPackage :: FlagSource -> PackageName -> UnusedFlags UFFlagsNotDefined :: FlagSource -> PackageName -> Set FlagName -> Set FlagName -> UnusedFlags UFSnapshot :: PackageName -> UnusedFlags data FlagSource FSCommandLine :: FlagSource FSStackYaml :: FlagSource instance GHC.Show.Show Stack.Types.UnusedFlags.FlagSource instance GHC.Classes.Ord Stack.Types.UnusedFlags.FlagSource instance GHC.Classes.Eq Stack.Types.UnusedFlags.FlagSource instance GHC.Show.Show Stack.Types.UnusedFlags.UnusedFlags instance GHC.Classes.Ord Stack.Types.UnusedFlags.UnusedFlags instance GHC.Classes.Eq Stack.Types.UnusedFlags.UnusedFlags -- | Versions for packages. module Stack.Types.Version data () => VersionRange newtype IntersectingVersionRange IntersectingVersionRange :: VersionRange -> IntersectingVersionRange [$sel:intersectingVersionRange:IntersectingVersionRange] :: IntersectingVersionRange -> VersionRange data VersionCheck MatchMinor :: VersionCheck MatchExact :: VersionCheck NewerMinor :: VersionCheck -- | Display a version range versionRangeText :: VersionRange -> Text -- | Does this version fall within the given range? -- -- This is the evaluation function for the VersionRange type. 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 -- | Get minor version (excludes any patchlevel) minorVersion :: Version -> Version -- | Current Stack version stackVersion :: Version -- | Current Stack version in the same format as yielded by -- showVersion. showStackVersion :: String -- | Current Stack major version. Returns the first two components, -- defaulting to 0 if not present stackMajorVersion :: Version -- | Current Stack minor version (excludes patchlevel) stackMinorVersion :: Version instance GHC.Show.Show Stack.Types.Version.IntersectingVersionRange instance GHC.Show.Show Stack.Types.Version.VersionCheck instance GHC.Classes.Ord Stack.Types.Version.VersionCheck instance GHC.Classes.Eq Stack.Types.Version.VersionCheck 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 -- | Module exporting the ParentMap type synonym. module Stack.Types.ParentMap -- | Type synonym representing dictionaries of package names, and a list of -- pairs of the identifier of a package depending on the package and the -- version range specified for the dependency by that package. type ParentMap = MonoidMap PackageName [(PackageIdentifier, VersionRange)] module Stack.Types.Compiler -- | 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 ActualCompiler ACGhc :: !Version -> ActualCompiler ACGhcGit :: !Text -> !Text -> ActualCompiler -- | Variety of compiler to use. data WhichCompiler Ghc :: WhichCompiler -- | Repository containing the compiler sources newtype CompilerRepository CompilerRepository :: Text -> CompilerRepository -- | Type representing exceptions thrown by functions exported by the -- Stack.Types.Compiler module. data CompilerException GhcjsNotSupported :: CompilerException PantryException :: PantryException -> CompilerException defaultCompilerRepository :: CompilerRepository getGhcVersion :: ActualCompiler -> Version whichCompiler :: ActualCompiler -> WhichCompiler compilerVersionText :: ActualCompiler -> Text compilerVersionString :: ActualCompiler -> String isWantedCompiler :: VersionCheck -> WantedCompiler -> ActualCompiler -> Bool wantedToActual :: WantedCompiler -> Either CompilerException ActualCompiler actualToWanted :: ActualCompiler -> WantedCompiler parseActualCompiler :: Text -> Either CompilerException ActualCompiler whichCompilerL :: Getting r ActualCompiler WhichCompiler instance GHC.Show.Show Stack.Types.Compiler.CompilerException instance GHC.Show.Show Stack.Types.Compiler.WhichCompiler instance GHC.Classes.Ord Stack.Types.Compiler.WhichCompiler instance GHC.Classes.Eq Stack.Types.Compiler.WhichCompiler instance GHC.Show.Show Stack.Types.Compiler.ActualCompiler instance GHC.Classes.Ord Stack.Types.Compiler.ActualCompiler instance GHC.Generics.Generic Stack.Types.Compiler.ActualCompiler instance GHC.Classes.Eq Stack.Types.Compiler.ActualCompiler instance Data.Data.Data Stack.Types.Compiler.ActualCompiler instance GHC.Show.Show Stack.Types.Compiler.CompilerRepository instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Compiler.CompilerRepository instance Control.DeepSeq.NFData Stack.Types.Compiler.ActualCompiler instance RIO.Prelude.Display.Display Stack.Types.Compiler.ActualCompiler instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Compiler.ActualCompiler instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Compiler.ActualCompiler instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.Compiler.ActualCompiler instance Database.Persist.Class.PersistField.PersistField Stack.Types.Compiler.ActualCompiler instance Database.Persist.Sql.Class.PersistFieldSql Stack.Types.Compiler.ActualCompiler instance GHC.Exception.Type.Exception Stack.Types.Compiler.CompilerException -- | A sourcemap maps a package name to how it should be built, including -- source code, flags, options, etc. This module contains various stages -- of source map construction. See the build_overview.md doc for -- details on these stages. module Stack.Types.SourceMap -- | A source map with information on the wanted (but not actual) compiler. -- This is derived by parsing the stack.yaml file for -- packages, extra-deps, their configuration (e.g., -- flags and options), and parsing the snapshot it refers to. It does not -- include global packages or any information from the command line. -- -- Invariant: a PackageName appears in either -- smwProject or smwDeps, but not both. data SMWanted SMWanted :: !WantedCompiler -> !Map PackageName ProjectPackage -> !Map PackageName DepPackage -> !RawSnapshotLocation -> SMWanted [$sel:compiler:SMWanted] :: SMWanted -> !WantedCompiler [$sel:project:SMWanted] :: SMWanted -> !Map PackageName ProjectPackage [$sel:deps:SMWanted] :: SMWanted -> !Map PackageName DepPackage -- | Where this snapshot is loaded from. [$sel:snapshotLocation:SMWanted] :: SMWanted -> !RawSnapshotLocation -- | Adds in actual compiler information to SMWanted, in particular -- the contents of the global package database. -- -- Invariant: a PackageName appears in only one of the -- Maps. data SMActual global SMActual :: !ActualCompiler -> !Map PackageName ProjectPackage -> !Map PackageName DepPackage -> !Map PackageName global -> SMActual global [$sel:compiler:SMActual] :: SMActual global -> !ActualCompiler [$sel:project:SMActual] :: SMActual global -> !Map PackageName ProjectPackage [$sel:deps:SMActual] :: SMActual global -> !Map PackageName DepPackage [$sel:globals:SMActual] :: SMActual global -> !Map PackageName global -- | 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 data PackageType PTProject :: PackageType PTDependency :: PackageType -- | Builds on an SMActual by resolving the targets specified on the -- command line, potentially adding in new dependency packages in the -- process. data SMTargets SMTargets :: !Map PackageName Target -> !Map PackageName DepPackage -> SMTargets [$sel:targets:SMTargets] :: SMTargets -> !Map PackageName Target [$sel:deps:SMTargets] :: SMTargets -> !Map PackageName DepPackage -- | The final source map, taking an SMTargets and applying all -- command line flags and GHC options. data SourceMap SourceMap :: !SMTargets -> !ActualCompiler -> !Map PackageName ProjectPackage -> !Map PackageName DepPackage -> !Map PackageName GlobalPackage -> SourceMap -- | Doesn't need to be included in the hash, does not affect the source -- map. [$sel:targets:SourceMap] :: SourceMap -> !SMTargets -- | Need to hash the compiler version _and_ its installation path. Ideally -- there would be some kind of output from GHC telling us some unique ID -- for the compiler itself. [$sel:compiler:SourceMap] :: SourceMap -> !ActualCompiler -- | Doesn't need to be included in hash, doesn't affect any of the -- packages that get stored in the snapshot database. [$sel:project:SourceMap] :: SourceMap -> !Map PackageName ProjectPackage -- | Need to hash all of the immutable dependencies, can ignore the mutable -- dependencies. [$sel:deps:SourceMap] :: SourceMap -> !Map PackageName DepPackage -- | Doesn't actually need to be hashed, implicitly captured by smCompiler. -- Can be broken if someone installs new global packages. We can document -- that as not supported, _or_ we could actually include all of this in -- the hash and make Stack more resilient. [$sel:globalPkgs:SourceMap] :: SourceMap -> !Map PackageName GlobalPackage -- | Flag showing if package comes from a snapshot needed to ignore -- dependency bounds between such packages data FromSnapshot FromSnapshot :: FromSnapshot NotFromSnapshot :: FromSnapshot -- | A view of a dependency package, specified in stack.yaml data DepPackage DepPackage :: !CommonPackage -> !PackageLocation -> !Bool -> !FromSnapshot -> DepPackage [$sel:depCommon:DepPackage] :: DepPackage -> !CommonPackage [$sel:location:DepPackage] :: DepPackage -> !PackageLocation -- | Should the package be hidden after registering? Affects the script -- interpreter's module name import parser. [$sel:hidden:DepPackage] :: DepPackage -> !Bool -- | Needed to ignore bounds between snapshot packages See -- https://github.com/commercialhaskell/stackage/issues/3185 [$sel:fromSnapshot:DepPackage] :: DepPackage -> !FromSnapshot -- | A view of a project package needed for resolving components data ProjectPackage ProjectPackage :: !CommonPackage -> !Path Abs File -> !ResolvedPath Dir -> ProjectPackage [$sel:projectCommon:ProjectPackage] :: ProjectPackage -> !CommonPackage [$sel:cabalFP:ProjectPackage] :: ProjectPackage -> !Path Abs File [$sel:resolvedDir:ProjectPackage] :: ProjectPackage -> !ResolvedPath Dir -- | All components available in the given ProjectPackage ppComponents :: MonadIO m => ProjectPackage -> m (Set NamedComponent) ppComponentsMaybe :: MonadIO m => (NamedComponent -> Maybe NamedComponent) -> ProjectPackage -> m (Set NamedComponent) ppGPD :: MonadIO m => ProjectPackage -> m GenericPackageDescription -- | Root directory for the given ProjectPackage ppRoot :: ProjectPackage -> Path Abs Dir -- | Version for the given 'ProjectPackage ppVersion :: MonadIO m => ProjectPackage -> m Version -- | Settings common to dependency packages (DepPackage) and project -- packages (ProjectPackage). data CommonPackage CommonPackage :: !IO GenericPackageDescription -> !PackageName -> !Map FlagName Bool -> ![Text] -> ![Text] -> !Bool -> CommonPackage [$sel:gpd:CommonPackage] :: CommonPackage -> !IO GenericPackageDescription [$sel:name:CommonPackage] :: CommonPackage -> !PackageName -- | overrides default flags [$sel:flags:CommonPackage] :: CommonPackage -> !Map FlagName Bool [$sel:ghcOptions:CommonPackage] :: CommonPackage -> ![Text] [$sel:cabalConfigOpts:CommonPackage] :: CommonPackage -> ![Text] -- | Should Haddock documentation be built for this package? [$sel:buildHaddocks:CommonPackage] :: CommonPackage -> !Bool newtype GlobalPackageVersion GlobalPackageVersion :: Version -> GlobalPackageVersion -- | A view of a package installed in the global package database also -- could include marker for a replaced global package (could be replaced -- because of a replaced dependency) data GlobalPackage GlobalPackage :: !Version -> GlobalPackage ReplacedGlobalPackage :: ![PackageName] -> GlobalPackage isReplacedGlobal :: GlobalPackage -> Bool -- | A unique hash for the immutable portions of a SourceMap. newtype SourceMapHash SourceMapHash :: SHA256 -> SourceMapHash -- | Returns relative directory name with source map's hash smRelDir :: MonadThrow m => SourceMapHash -> m (Path Rel Dir) instance GHC.Show.Show Stack.Types.SourceMap.FromSnapshot instance GHC.Classes.Eq Stack.Types.SourceMap.GlobalPackage instance GHC.Show.Show Stack.Types.SourceMap.PackageType instance GHC.Classes.Eq Stack.Types.SourceMap.PackageType module Stack.Types.CompilerPaths -- | Paths on the filesystem for the compiler we're using data CompilerPaths CompilerPaths :: !ActualCompiler -> !Arch -> !CompilerBuild -> !Path Abs File -> !GhcPkgExe -> !Path Abs File -> !Path Abs File -> !Bool -> !Version -> !Path Abs Dir -> !ByteString -> !Map PackageName DumpPackage -> CompilerPaths [$sel:compilerVersion:CompilerPaths] :: CompilerPaths -> !ActualCompiler [$sel:arch:CompilerPaths] :: CompilerPaths -> !Arch [$sel:build:CompilerPaths] :: CompilerPaths -> !CompilerBuild [$sel:compiler:CompilerPaths] :: CompilerPaths -> !Path Abs File -- | ghc-pkg or equivalent [$sel:pkg:CompilerPaths] :: CompilerPaths -> !GhcPkgExe -- | runghc [$sel:interpreter:CompilerPaths] :: CompilerPaths -> !Path Abs File -- | haddock, in IO to allow deferring the lookup [$sel:haddock:CompilerPaths] :: CompilerPaths -> !Path Abs File -- | Is this a Stack-sandboxed installation? [$sel:sandboxed:CompilerPaths] :: CompilerPaths -> !Bool -- | 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 -- stack ls dependencies | grep Cabal in the Stack project. [$sel:cabalVersion:CompilerPaths] :: CompilerPaths -> !Version -- | Global package database [$sel:globalDB:CompilerPaths] :: CompilerPaths -> !Path Abs Dir -- | Output of ghc --info [$sel:ghcInfo:CompilerPaths] :: CompilerPaths -> !ByteString [$sel:globalDump:CompilerPaths] :: CompilerPaths -> !Map PackageName DumpPackage -- | Location of the ghc-pkg executable newtype GhcPkgExe GhcPkgExe :: Path Abs File -> GhcPkgExe -- | An environment which ensures that the given compiler is available on -- the PATH class HasCompiler env compilerPathsL :: HasCompiler env => SimpleGetter env CompilerPaths cabalVersionL :: HasCompiler env => SimpleGetter env Version compilerVersionL :: HasCompiler env => SimpleGetter env ActualCompiler cpWhich :: (MonadReader env m, HasCompiler env) => m WhichCompiler -- | Get the path for the given compiler ignoring any local binaries. -- -- https://github.com/commercialhaskell/stack/issues/1052 getCompilerPath :: HasCompiler env => RIO env (Path Abs File) -- | Get the GhcPkgExe from a HasCompiler environment getGhcPkgExe :: HasCompiler env => RIO env GhcPkgExe instance GHC.Show.Show Stack.Types.CompilerPaths.GhcPkgExe instance GHC.Show.Show Stack.Types.CompilerPaths.CompilerPaths instance Stack.Types.CompilerPaths.HasCompiler Stack.Types.CompilerPaths.CompilerPaths module Stack.Types.VersionedDownloadInfo data VersionedDownloadInfo VersionedDownloadInfo :: Version -> DownloadInfo -> VersionedDownloadInfo [$sel:version:VersionedDownloadInfo] :: VersionedDownloadInfo -> Version [$sel:downloadInfo:VersionedDownloadInfo] :: VersionedDownloadInfo -> DownloadInfo instance GHC.Show.Show Stack.Types.VersionedDownloadInfo.VersionedDownloadInfo instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.VersionedDownloadInfo.VersionedDownloadInfo) module Stack.Types.SetupInfo data SetupInfo SetupInfo :: Maybe DownloadInfo -> Maybe DownloadInfo -> Map Text VersionedDownloadInfo -> Map Text (Map Version GHCDownloadInfo) -> Map Text (Map Version DownloadInfo) -> SetupInfo [$sel:sevenzExe:SetupInfo] :: SetupInfo -> Maybe DownloadInfo [$sel:sevenzDll:SetupInfo] :: SetupInfo -> Maybe DownloadInfo [$sel:msys2:SetupInfo] :: SetupInfo -> Map Text VersionedDownloadInfo [$sel:ghcByVersion:SetupInfo] :: SetupInfo -> Map Text (Map Version GHCDownloadInfo) [$sel:stackByVersion:SetupInfo] :: SetupInfo -> Map Text (Map Version DownloadInfo) instance GHC.Show.Show Stack.Types.SetupInfo.SetupInfo instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.WithJSONWarnings Stack.Types.SetupInfo.SetupInfo) instance GHC.Base.Semigroup Stack.Types.SetupInfo.SetupInfo instance GHC.Base.Monoid Stack.Types.SetupInfo.SetupInfo -- | The module of this name differs as between Windows and non-Windows -- builds. This is the Windows version. module System.Info.ShortPathName getShortPathName :: FilePath -> IO FilePath -- | The module of this name differs as between Windows and non-Windows -- builds. This is the Windows version. module System.Permissions -- | False if using Windows. osIsMacOS :: Bool -- | True if using Windows. osIsWindows :: Bool setFileExecutable :: Monad m => FilePath -> m () setScriptPerms :: Monad m => FilePath -> m () -- | 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 used for Haskell modules. Excludes preprocessor ones. haskellFileExts :: [Text] -- | Extensions for modules that are preprocessed by common preprocessors. haskellDefaultPreprocessorExts :: [Text] -- | Name of the Stack program. stackProgName :: String -- | Name of the Stack program. stackProgName' :: Text -- | Name of the Nix package manager command nixProgName :: String -- | The filename used for the Stack project-level configuration 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 -- | Environment variable used to indicate XDG directories should be used. stackXdgEnvVar :: String -- | Option name for the global Stack root. stackRootOptionName :: String -- | Option name for the global Stack configuration file. stackGlobalConfigOptionName :: String -- | Environment variable used to override the location of the Pantry store pantryRootEnvVar :: 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 stack program, uppercased stackProgNameUpper :: String -- | The comment to 'see -- https://downloads.haskell.org/~ghc/7.10.1/docs/html/libraries/ghc/src/Module.html#integerPackageKey\' -- appears to be out of date. -- -- See 'Note [About units]' and 'Wired-in units' at -- https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Unit.hs. -- -- The 'wired-in packages' appear to have been replaced by those that -- have (e.g) -- --
-- ghc-options: -this-unit-id ghc-prim ---- -- in their Cabal file because they are 'magic'. wiredInPackages :: Set 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, getImplicitGlobalProjectDir 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, -- getDefaultUserConfigPath should be used instead. defaultUserConfigPath :: Path Abs Dir -> Path Abs File -- | Deprecated default global config path. Note that this will be -- Nothing on Windows, which is by design. defaultGlobalConfigPathDeprecated :: Maybe (Path Abs File) -- | Default global config path. Normally, -- getDefaultGlobalConfigPath should be used instead. Note that -- this will be Nothing 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 Ghc 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 -- | False if using Windows. osIsMacOS :: Bool -- | True if using Windows. osIsWindows :: Bool relFileSetupHs :: Path Rel File relFileSetupLhs :: Path Rel File relFileHpackPackageConfig :: Path Rel File relDirGlobalAutogen :: Path Rel Dir relDirAutogen :: Path Rel Dir relDirLogs :: Path Rel Dir relFileCabalMacrosH :: Path Rel File relDirBuild :: Path Rel Dir relDirBin :: Path Rel Dir relDirGhci :: Path Rel Dir relDirGhciScript :: Path Rel Dir relDirPantry :: Path Rel Dir relDirPrograms :: Path Rel Dir relDirRoot :: Path Rel Dir relDirUpperPrograms :: Path Rel Dir relDirStackProgName :: Path Rel Dir relDirStackWork :: Path Rel Dir relFileReadmeTxt :: Path Rel File relDirScript :: Path Rel Dir relDirScripts :: Path Rel Dir relFileConfigYaml :: Path Rel File relDirSnapshots :: Path Rel Dir relDirGlobalHints :: Path Rel Dir relFileGlobalHintsYaml :: Path Rel File relDirInstall :: Path Rel Dir relDirCompilerTools :: Path Rel Dir relDirHoogle :: Path Rel Dir relFileDatabaseHoo :: Path Rel File relDirPkgdb :: Path Rel Dir relFileStorage :: Path Rel File relDirLoadedSnapshotCache :: Path Rel Dir -- | Suffix applied to an installation root to get the bin dir bindirSuffix :: Path Rel Dir -- | Suffix applied to an installation root to get the doc dir docDirSuffix :: Path Rel Dir -- | Suffix applied to a path to get the html directory. htmlDirSuffix :: Path Rel Dir relDirHpc :: Path Rel Dir relDirLib :: Path Rel Dir relDirShare :: Path Rel Dir relDirLibexec :: Path Rel Dir relDirEtc :: Path Rel Dir setupGhciShimCode :: Builder relDirSetupExeCache :: Path Rel Dir relDirSetupExeSrc :: Path Rel Dir relFileConfigure :: Path Rel File relDirDist :: Path Rel Dir relFileSetupMacrosH :: Path Rel File relDirSetup :: Path Rel Dir relFileSetupLower :: Path Rel File relDirMingw :: Path Rel Dir relDirMingw32 :: Path Rel Dir relDirMingw64 :: Path Rel Dir relDirLocal :: Path Rel Dir relDirUsr :: Path Rel Dir relDirInclude :: Path Rel Dir relFileIndexHtml :: Path Rel File relDirAll :: Path Rel Dir relFilePackageCache :: Path Rel File relFileDockerfile :: Path Rel File relFileGhciScript :: Path Rel File relDirCombined :: Path Rel Dir relFileHpcIndexHtml :: Path Rel File relDirCustom :: Path Rel Dir relDirPackageConfInplace :: Path Rel Dir relDirExtraTixFiles :: Path Rel Dir relDirInstalledPackages :: Path Rel Dir backupUrlRelPath :: Path Rel File relDirDotLocal :: Path Rel Dir relDirDotSsh :: Path Rel Dir relDirDotStackProgName :: Path Rel Dir relDirUnderHome :: Path Rel Dir relDirSrc :: Path Rel Dir relFileLibcMuslx86_64So1 :: Path Rel File relFileLibtinfoSo5 :: Path Rel File relFileLibtinfoSo6 :: Path Rel File relFileLibncurseswSo6 :: Path Rel File relFileLibgmpSo10 :: Path Rel File relFileLibgmpSo3 :: Path Rel File relDirNewCabal :: Path Rel Dir relFileSetupExe :: Path Rel File relFileSetupUpper :: Path Rel File relFile7zexe :: Path Rel File relFile7zdll :: Path Rel File relFileMainHs :: Path Rel File relFileStack :: Path Rel File relFileStackDotExe :: Path Rel File relFileStackDotTmpDotExe :: Path Rel File relFileStackDotTmp :: Path Rel File ghcShowOptionsOutput :: [String] -- | Relative paths inside a GHC repo to the boot script. ghcBootScript :: Path Rel File -- | Relative paths inside a GHC repo to the configure script. ghcConfigureScript :: Path Rel File -- | Command applicable to GHC's configure script on Windows. See: -- https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/README.md ghcConfigureWindows :: [String] -- | Command applicable to GHC's configure script on macOS. See: -- https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/README.md ghcConfigureMacOS :: [String] -- | Command applicable to GHC's configure script on non-Windows, -- non-macOS. See: -- https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/README.md ghcConfigurePosix :: [String] relDirHadrian :: Path Rel Dir relFileHadrianStackDotYaml :: Path Rel File -- | Relative paths inside a GHC repo to the Hadrian build batch script. -- The second path is maintained for compatibility with older GHC -- versions. hadrianScriptsWindows :: [Path Rel File] -- | Relative paths inside a GHC repo to the Hadrian build shell script The -- second path is maintained for compatibility with older GHC versions. hadrianScriptsPosix :: [Path Rel File] -- | Used in Stack.Setup for detecting libc.musl-x86_64.so.1, see comments -- at use site libDirs :: [Path Abs Dir] -- | Used in Stack.Setup for detecting libtinfo, see comments at use site usrLibDirs :: [Path Abs Dir] -- | Relative file path for a temporary GHC environment file for tests testGhcEnvRelFile :: Path Rel File -- | File inside a dist directory to use for locking relFileBuildLock :: Path Rel File -- | What should the default be for stack-developer-mode stackDeveloperModeDefault :: Bool -- | What should the default be for stack-developer-mode isStackUploadDisabled :: Bool -- | The footer to the help for Stack's subcommands globalFooter :: String -- | The type for GitHub REST API HTTP 'Basic' authentication. gitHubBasicAuthType :: ByteString -- | Environment variable to hold credentials for GitHub REST API HTTP -- 'Basic' authentication. gitHubTokenEnvVar :: String -- | Alternate environment variable to hold credentials for GitHub REST API -- HTTP 'Basic' authentication. altGitHubTokenEnvVar :: String hackageBaseUrl :: Text instance GHC.Show.Show Stack.Constants.ConstantsException instance GHC.Exception.Type.Exception Stack.Constants.ConstantsException -- | Docker types. module Stack.Types.Docker -- | Type representing exceptions thrown by functions exported by the -- Stack.Docker module. data DockerException -- | Docker must be enabled to use the command. DockerMustBeEnabledException :: DockerException -- | Command must be run on host OS (not in a container). OnlyOnHostException :: DockerException -- | docker inspect failed. InspectFailedException :: String -> DockerException -- | Image does not exist. NotPulledException :: String -> DockerException -- | Invalid output from docker images. InvalidImagesOutputException :: String -> DockerException -- | Invalid output from docker ps. InvalidPSOutputException :: String -> DockerException -- | Invalid output from docker inspect. InvalidInspectOutputException :: String -> DockerException -- | Could not pull a Docker image. PullFailedException :: String -> DockerException -- | Installed version of docker below minimum version. DockerTooOldException :: Version -> Version -> DockerException -- | Installed version of docker is prohibited. DockerVersionProhibitedException :: [Version] -> Version -> DockerException -- | Installed version of docker is out of range specified in -- config file. BadDockerVersionException :: VersionRange -> Version -> DockerException -- | Invalid output from docker --version. InvalidVersionOutputException :: DockerException -- | Version of stack on host is too old for version in image. HostStackTooOldException :: Version -> Maybe Version -> DockerException -- | Version of stack in container/image is too old for version on -- host. ContainerStackTooOldException :: Version -> Version -> DockerException -- | Can't determine the project root (where to put docker sandbox). CannotDetermineProjectRootException :: DockerException -- | docker --version failed. DockerNotInstalledException :: DockerException -- | Using host stack-exe on unsupported platform. UnsupportedStackExeHostPlatformException :: DockerException -- | stack-exe option fails to parse. DockerStackExeParseException :: String -> DockerException -- | Options for Docker repository or image. data DockerMonoidRepoOrImage DockerMonoidRepo :: String -> DockerMonoidRepoOrImage DockerMonoidImage :: String -> DockerMonoidRepoOrImage -- | Docker configuration. data DockerOpts DockerOpts :: !Bool -> !Either SomeException String -> !Bool -> !Maybe String -> !Maybe String -> !Bool -> !Bool -> !Bool -> !Maybe String -> !Maybe String -> ![String] -> ![Mount] -> !Maybe String -> ![String] -> !Maybe DockerStackExe -> !Maybe Bool -> !VersionRange -> DockerOpts -- | Is using Docker enabled? [$sel:enable:DockerOpts] :: DockerOpts -> !Bool -- | Exact Docker image tag or ID. Overrides docker-repo-*/tag. [$sel:image:DockerOpts] :: DockerOpts -> !Either SomeException String -- | Does registry require login for pulls? [$sel:registryLogin:DockerOpts] :: DockerOpts -> !Bool -- | Optional username for Docker registry. [$sel:registryUsername:DockerOpts] :: DockerOpts -> !Maybe String -- | Optional password for Docker registry. [$sel:registryPassword:DockerOpts] :: DockerOpts -> !Maybe String -- | Automatically pull new images. [$sel:autoPull:DockerOpts] :: DockerOpts -> !Bool -- | Whether to run a detached container [$sel:detach:DockerOpts] :: DockerOpts -> !Bool -- | Create a persistent container (don't remove it when finished). Implied -- by dockerDetach. [$sel:persist:DockerOpts] :: DockerOpts -> !Bool -- | Container name to use, only makes sense from command-line with -- dockerPersist or dockerDetach. [$sel:containerName:DockerOpts] :: DockerOpts -> !Maybe String -- | The network docker uses. [$sel:network:DockerOpts] :: DockerOpts -> !Maybe String -- | Arguments to pass directly to docker run. [$sel:runArgs:DockerOpts] :: DockerOpts -> ![String] -- | Volumes to mount in the container. [$sel:mount:DockerOpts] :: DockerOpts -> ![Mount] -- | Volume mount mode [$sel:mountMode:DockerOpts] :: DockerOpts -> !Maybe String -- | Environment variables to set in the container. [$sel:env:DockerOpts] :: DockerOpts -> ![String] -- | Location of container-compatible Stack executable [$sel:stackExe:DockerOpts] :: DockerOpts -> !Maybe DockerStackExe -- | Set in-container user to match host's [$sel:setUser:DockerOpts] :: DockerOpts -> !Maybe Bool -- | Require a version of Docker within this range. [$sel:requireDockerVersion:DockerOpts] :: 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 -> !FirstTrue -> !FirstFalse -> !FirstFalse -> !First String -> !First String -> ![String] -> ![Mount] -> !First String -> ![String] -> !First DockerStackExe -> !First Bool -> !IntersectingVersionRange -> DockerOptsMonoid -- | Should Docker be defaulted to enabled (does docker: section -- exist in the config)? [$sel:defaultEnable:DockerOptsMonoid] :: DockerOptsMonoid -> !Any -- | Is using Docker enabled? [$sel:enable:DockerOptsMonoid] :: DockerOptsMonoid -> !First Bool -- | Docker repository name (e.g. fpco/stack-build or -- fpco/stack-full:lts-2.8) [$sel:repoOrImage:DockerOptsMonoid] :: DockerOptsMonoid -> !First DockerMonoidRepoOrImage -- | Does registry require login for pulls? [$sel:registryLogin:DockerOptsMonoid] :: DockerOptsMonoid -> !First Bool -- | Optional username for Docker registry. [$sel:registryUsername:DockerOptsMonoid] :: DockerOptsMonoid -> !First String -- | Optional password for Docker registry. [$sel:registryPassword:DockerOptsMonoid] :: DockerOptsMonoid -> !First String -- | Automatically pull new images. [$sel:autoPull:DockerOptsMonoid] :: DockerOptsMonoid -> !FirstTrue -- | Whether to run a detached container [$sel:detach:DockerOptsMonoid] :: DockerOptsMonoid -> !FirstFalse -- | Create a persistent container (don't remove it when finished). Implied -- by -- dockerDetach. [$sel:persist:DockerOptsMonoid] :: DockerOptsMonoid -> !FirstFalse -- | Container name to use, only makes sense from command-line with -- dockerPersist or dockerDetach. [$sel:containerName:DockerOptsMonoid] :: DockerOptsMonoid -> !First String -- | See: dockerNetwork [$sel:network:DockerOptsMonoid] :: DockerOptsMonoid -> !First String -- | Arguments to pass directly to docker run [$sel:runArgs:DockerOptsMonoid] :: DockerOptsMonoid -> ![String] -- | Volumes to mount in the container [$sel:mount:DockerOptsMonoid] :: DockerOptsMonoid -> ![Mount] -- | Volume mount mode [$sel:mountMode:DockerOptsMonoid] :: DockerOptsMonoid -> !First String -- | Environment variables to set in the container [$sel:env:DockerOptsMonoid] :: DockerOptsMonoid -> ![String] -- | Location of container-compatible Stack executable [$sel:stackExe:DockerOptsMonoid] :: DockerOptsMonoid -> !First DockerStackExe -- | Set in-container user to match host's [$sel:setUser:DockerOptsMonoid] :: DockerOptsMonoid -> !First Bool -- | See: dockerRequireDockerVersion [$sel:requireDockerVersion:DockerOptsMonoid] :: DockerOptsMonoid -> !IntersectingVersionRange -- | Where to get the stack executable to run in Docker containers data DockerStackExe -- | Download from official bindist DockerStackExeDownload :: DockerStackExe -- | Host's stack (linux-x86_64 only) DockerStackExeHost :: DockerStackExe -- | Docker image's stack (versions must match) DockerStackExeImage :: DockerStackExe -- | Executable at given path DockerStackExePath :: Path Abs File -> DockerStackExe -- | Docker volume mount. data Mount Mount :: String -> String -> Mount -- | Newtype for non-orphan FromJSON instance. newtype VersionRangeJSON VersionRangeJSON :: VersionRange -> VersionRangeJSON [$sel:versionRangeJSON:VersionRangeJSON] :: VersionRangeJSON -> VersionRange -- | Docker auto-pull argument name. dockerAutoPullArgName :: Text -- | Command-line argument for "docker" dockerCmdName :: String -- | Docker container name argument name. dockerContainerNameArgName :: Text -- | Platform that Docker containers run dockerContainerPlatform :: Platform -- | Docker detach argument name. dockerDetachArgName :: Text -- | Docker enable argument name. dockerEnableArgName :: Text -- | Argument name used to pass docker entrypoint data (only used -- internally) dockerEntrypointArgName :: String -- | Docker environment variable argument name. dockerEnvArgName :: Text dockerHelpOptName :: String -- | Docker image argument name. dockerImageArgName :: Text -- | Docker mount argument name. dockerMountArgName :: Text -- | Docker mount mode argument name. dockerMountModeArgName :: Text -- | Docker container name argument name. dockerNetworkArgName :: Text -- | Docker persist argument name. dockerPersistArgName :: Text -- | Command-line argument for docker pull. dockerPullCmdName :: String -- | Docker registry login argument name. dockerRegistryLoginArgName :: Text -- | Docker registry password argument name. dockerRegistryPasswordArgName :: Text -- | Docker registry username argument name. dockerRegistryUsernameArgName :: Text -- | Docker repo arg argument name. dockerRepoArgName :: Text -- | Docker require-version argument name dockerRequireDockerVersionArgName :: Text -- | Docker run args argument name. dockerRunArgsArgName :: Text -- | Docker set-user argument name dockerSetUserArgName :: Text -- | Docker Stack executable argument name. dockerStackExeArgName :: Text -- | Value for --docker-stack-exe=download dockerStackExeDownloadVal :: String -- | Value for --docker-stack-exe=host dockerStackExeHostVal :: String -- | Value for --docker-stack-exe=image dockerStackExeImageVal :: String -- | Parse DockerStackExe. parseDockerStackExe :: MonadThrow m => String -> m DockerStackExe -- | Command-line option for --internal-re-exec-version. reExecArgName :: String instance GHC.Show.Show Stack.Types.Docker.DockerException instance GHC.Show.Show Stack.Types.Docker.DockerStackExe instance GHC.Show.Show Stack.Types.Docker.DockerOpts instance GHC.Show.Show Stack.Types.Docker.DockerMonoidRepoOrImage instance GHC.Generics.Generic Stack.Types.Docker.DockerOptsMonoid instance GHC.Show.Show Stack.Types.Docker.DockerOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.WarningParser.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 instance GHC.Exception.Type.Exception Stack.Types.Docker.DockerException module Stack.Types.ConfigMonoid -- | An uninterpreted representation of configuration options. -- Configurations may be "cascaded" using mappend (left-biased). data ConfigMonoid ConfigMonoid :: !First (Path Abs Dir) -> !First (Path Rel Dir) -> !BuildOptsMonoid -> !DockerOptsMonoid -> !NixOptsMonoid -> !First Int -> !FirstTrue -> !First Bool -> !First Text -> !First PackageIndexConfig -> !First [PackageIndexConfig] -> !First Bool -> !FirstTrue -> !FirstFalse -> !FirstFalse -> !First VersionCheck -> !First CompilerRepository -> !IntersectingVersionRange -> !First String -> !First GHCVariant -> !First CompilerBuild -> !First Int -> ![FilePath] -> ![FilePath] -> ![Text] -> !First (Path Abs File) -> !First FilePath -> !First Bool -> !First FilePath -> !Map Text Text -> !First SCM -> !MonoidMap PackageName (Dual [Text]) -> !MonoidMap ApplyGhcOptions (Dual [Text]) -> !MonoidMap CabalConfigKey (Dual [Text]) -> ![Path Abs Dir] -> ![String] -> !SetupInfo -> !First (Path Abs Dir) -> !First PvpBounds -> !FirstTrue -> !FirstFalse -> !First ApplyGhcOptions -> !First ApplyProgOptions -> !First Bool -> !Maybe AllowNewerDeps -> !First TemplateName -> !First Bool -> !First DumpLogs -> !First Bool -> !First Text -> !First ColorWhen -> !StylesUpdate -> !FirstTrue -> !FirstTrue -> !FirstTrue -> !FirstTrue -> !FirstTrue -> !FirstTrue -> !CasaOptsMonoid -> !First CasaRepoPrefix -> !First Text -> !FirstFalse -> !First Bool -> ConfigMonoid -- | See: clStackRoot [$sel:stackRoot:ConfigMonoid] :: ConfigMonoid -> !First (Path Abs Dir) -- | See: configWorkDir. [$sel:workDir:ConfigMonoid] :: ConfigMonoid -> !First (Path Rel Dir) -- | build options. [$sel:buildOpts:ConfigMonoid] :: ConfigMonoid -> !BuildOptsMonoid -- | Docker options. [$sel:dockerOpts:ConfigMonoid] :: ConfigMonoid -> !DockerOptsMonoid -- | Options for the execution environment (nix-shell or container) [$sel:nixOpts:ConfigMonoid] :: ConfigMonoid -> !NixOptsMonoid -- | See: configConnectionCount [$sel:connectionCount:ConfigMonoid] :: ConfigMonoid -> !First Int -- | See: configHideTHLoading [$sel:hideTHLoading:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See: configPrefixTimestamps [$sel:prefixTimestamps:ConfigMonoid] :: ConfigMonoid -> !First Bool -- | See: configLatestSnapshot [$sel:latestSnapshot:ConfigMonoid] :: ConfigMonoid -> !First Text -- | See: withPantryConfig [$sel:packageIndex:ConfigMonoid] :: ConfigMonoid -> !First PackageIndexConfig -- | Deprecated in favour of package-index [$sel:packageIndices:ConfigMonoid] :: ConfigMonoid -> !First [PackageIndexConfig] -- | See: configSystemGHC [$sel:systemGHC:ConfigMonoid] :: ConfigMonoid -> !First Bool -- | See: configInstallGHC [$sel:installGHC:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See: configSkipGHCCheck [$sel:skipGHCCheck:ConfigMonoid] :: ConfigMonoid -> !FirstFalse -- | See: configSkipMsys [$sel:skipMsys:ConfigMonoid] :: ConfigMonoid -> !FirstFalse -- | See: configCompilerCheck [$sel:compilerCheck:ConfigMonoid] :: ConfigMonoid -> !First VersionCheck -- | See: configCompilerRepository [$sel:compilerRepository:ConfigMonoid] :: ConfigMonoid -> !First CompilerRepository -- | See: configRequireStackVersion [$sel:requireStackVersion:ConfigMonoid] :: ConfigMonoid -> !IntersectingVersionRange -- | Used for overriding the platform [$sel:arch:ConfigMonoid] :: ConfigMonoid -> !First String -- | Used for overriding the platform [$sel:ghcVariant:ConfigMonoid] :: ConfigMonoid -> !First GHCVariant -- | Used for overriding the GHC build [$sel:ghcBuild:ConfigMonoid] :: ConfigMonoid -> !First CompilerBuild -- | See: configJobs [$sel:jobs:ConfigMonoid] :: ConfigMonoid -> !First Int -- | See: configExtraIncludeDirs [$sel:extraIncludeDirs:ConfigMonoid] :: ConfigMonoid -> ![FilePath] -- | See: configExtraLibDirs [$sel:extraLibDirs:ConfigMonoid] :: ConfigMonoid -> ![FilePath] -- | See: configCustomPreprocessorExts [$sel:customPreprocessorExts:ConfigMonoid] :: ConfigMonoid -> ![Text] -- | Allow users to override the path to gcc [$sel:overrideGccPath:ConfigMonoid] :: ConfigMonoid -> !First (Path Abs File) -- | Use Hpack executable (overrides bundled Hpack) [$sel:overrideHpack:ConfigMonoid] :: ConfigMonoid -> !First FilePath -- | See: configConcurrentTests [$sel:concurrentTests:ConfigMonoid] :: ConfigMonoid -> !First Bool -- | Used to override the binary installation dir [$sel:localBinPath:ConfigMonoid] :: ConfigMonoid -> !First FilePath -- | Template parameters. [$sel:templateParameters:ConfigMonoid] :: ConfigMonoid -> !Map Text Text -- | Initialize SCM (e.g. git init) when making new projects? [$sel:scmInit:ConfigMonoid] :: ConfigMonoid -> !First SCM -- | See configGhcOptionsByName. Uses Dual so that options -- from the configs on the right come first, so that they can be -- overridden. [$sel:ghcOptionsByName:ConfigMonoid] :: ConfigMonoid -> !MonoidMap PackageName (Dual [Text]) -- | See configGhcOptionsAll. Uses Dual so that options -- from the configs on the right come first, so that they can be -- overridden. [$sel:ghcOptionsByCat:ConfigMonoid] :: ConfigMonoid -> !MonoidMap ApplyGhcOptions (Dual [Text]) -- | See configCabalConfigOpts. [$sel:cabalConfigOpts:ConfigMonoid] :: ConfigMonoid -> !MonoidMap CabalConfigKey (Dual [Text]) -- | Additional paths to search for executables in [$sel:extraPath:ConfigMonoid] :: ConfigMonoid -> ![Path Abs Dir] -- | See configSetupInfoLocations [$sel:setupInfoLocations:ConfigMonoid] :: ConfigMonoid -> ![String] -- | See configSetupInfoInline [$sel:setupInfoInline:ConfigMonoid] :: ConfigMonoid -> !SetupInfo -- | Override the default local programs dir, where e.g. GHC is installed. [$sel:localProgramsBase:ConfigMonoid] :: ConfigMonoid -> !First (Path Abs Dir) -- | See configPvpBounds [$sel:pvpBounds:ConfigMonoid] :: ConfigMonoid -> !First PvpBounds -- | See configModifyCodePage [$sel:modifyCodePage:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See configMonoidRebuildGhcOptions [$sel:rebuildGhcOptions:ConfigMonoid] :: ConfigMonoid -> !FirstFalse -- | See configApplyGhcOptions [$sel:applyGhcOptions:ConfigMonoid] :: ConfigMonoid -> !First ApplyGhcOptions -- | See configApplyProgOptions [$sel:applyProgOptions:ConfigMonoid] :: ConfigMonoid -> !First ApplyProgOptions -- | See configMonoidAllowNewer [$sel:allowNewer:ConfigMonoid] :: ConfigMonoid -> !First Bool -- | See configMonoidAllowNewerDeps [$sel:allowNewerDeps:ConfigMonoid] :: ConfigMonoid -> !Maybe AllowNewerDeps -- | The default template to use when none is specified. (If Nothing, the -- 'default' default template is used.) [$sel:defaultTemplate:ConfigMonoid] :: ConfigMonoid -> !First TemplateName -- | Allow users other than the Stack root owner to use the Stack -- installation. [$sel:allowDifferentUser:ConfigMonoid] :: ConfigMonoid -> !First Bool -- | See configDumpLogs [$sel:dumpLogs:ConfigMonoid] :: ConfigMonoid -> !First DumpLogs -- | See configSaveHackageCreds [$sel:saveHackageCreds:ConfigMonoid] :: ConfigMonoid -> !First Bool -- | See configHackageBaseUrl [$sel:hackageBaseUrl:ConfigMonoid] :: ConfigMonoid -> !First Text -- | When to use ANSI colors [$sel:colorWhen:ConfigMonoid] :: ConfigMonoid -> !First ColorWhen [$sel:styles:ConfigMonoid] :: ConfigMonoid -> !StylesUpdate -- | See configHideSourcePaths [$sel:hideSourcePaths:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See configRecommendUpgrade [$sel:recommendUpgrade:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See configNotifyIfNixOnPath [$sel:notifyIfNixOnPath:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See configNotifyIfGhcUntested [$sel:notifyIfGhcUntested:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See configNotifyIfCabalUntested [$sel:notifyIfCabalUntested:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | See configNotifyIfArchUnknown [$sel:notifyIfArchUnknown:ConfigMonoid] :: ConfigMonoid -> !FirstTrue -- | Casa configuration options. [$sel:casaOpts:ConfigMonoid] :: ConfigMonoid -> !CasaOptsMonoid -- | Casa repository prefix (deprecated). [$sel:casaRepoPrefix:ConfigMonoid] :: ConfigMonoid -> !First CasaRepoPrefix -- | Custom location of LTS/Nightly snapshots [$sel:snapshotLocation:ConfigMonoid] :: ConfigMonoid -> !First Text -- | See: configNoRunCompile [$sel:noRunCompile:ConfigMonoid] :: ConfigMonoid -> !FirstFalse -- | See configStackDeveloperMode [$sel:stackDeveloperMode:ConfigMonoid] :: ConfigMonoid -> !First Bool parseConfigMonoid :: Path Abs Dir -> Value -> Parser (WithJSONWarnings ConfigMonoid) -- | Parse a partial configuration. Used both to parse both a standalone -- config file and a project file, so that a sub-parser is not required, -- which would interfere with warnings for missing fields. parseConfigMonoidObject :: Path Abs Dir -> Object -> WarningParser ConfigMonoid configMonoidAllowDifferentUserName :: Text configMonoidGHCVariantName :: Text configMonoidInstallGHCName :: Text configMonoidSystemGHCName :: Text instance GHC.Show.Show Stack.Types.ConfigMonoid.ConfigMonoid instance GHC.Generics.Generic Stack.Types.ConfigMonoid.ConfigMonoid instance GHC.Base.Semigroup Stack.Types.ConfigMonoid.ConfigMonoid instance GHC.Base.Monoid Stack.Types.ConfigMonoid.ConfigMonoid module Stack.Types.ProjectAndConfigMonoid data ProjectAndConfigMonoid ProjectAndConfigMonoid :: !Project -> !ConfigMonoid -> ProjectAndConfigMonoid parseProjectAndConfigMonoid :: Path Abs Dir -> Value -> Parser (WithJSONWarnings (IO ProjectAndConfigMonoid)) module Stack.Types.GlobalOptsMonoid -- | Parsed global command-line options monoid. data GlobalOptsMonoid GlobalOptsMonoid :: !First String -> !First DockerEntrypoint -> !First LogLevel -> !FirstTrue -> !FirstFalse -> !FirstFalse -> !ConfigMonoid -> !First (Unresolved AbstractResolver) -> !First FilePath -> !First WantedCompiler -> !First Bool -> !StylesUpdate -> !First Int -> !First FilePath -> !First LockFileBehavior -> GlobalOptsMonoid -- | Expected re-exec in container version [$sel:reExecVersion:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First String -- | Data used when Stack is acting as a Docker entrypoint (internal use -- only) [$sel:dockerEntrypoint:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First DockerEntrypoint -- | Log level [$sel:logLevel:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First LogLevel -- | Whether to include timings in logs. [$sel:timeInLog:GlobalOptsMonoid] :: GlobalOptsMonoid -> !FirstTrue -- | Whether to include raw snapshot layer (RSL) in logs. [$sel:rslInLog:GlobalOptsMonoid] :: GlobalOptsMonoid -> !FirstFalse -- | Whether to include debug information about the construction of the -- build plan in logs. [$sel:planInLog:GlobalOptsMonoid] :: GlobalOptsMonoid -> !FirstFalse -- | Config monoid, for passing into loadConfig [$sel:configMonoid:GlobalOptsMonoid] :: GlobalOptsMonoid -> !ConfigMonoid -- | Resolver override [$sel:resolver:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First (Unresolved AbstractResolver) -- | root directory for resolver relative path [$sel:resolverRoot:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First FilePath -- | Compiler override [$sel:compiler:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First WantedCompiler -- | We're in a terminal? [$sel:terminal:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First Bool -- | Stack's output styles [$sel:styles:GlobalOptsMonoid] :: GlobalOptsMonoid -> !StylesUpdate -- | Terminal width override [$sel:termWidthOpt:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First Int -- | Override project stack.yaml [$sel:stackYaml:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First FilePath -- | See globalLockFileBehavior [$sel:lockFileBehavior:GlobalOptsMonoid] :: GlobalOptsMonoid -> !First LockFileBehavior instance GHC.Generics.Generic Stack.Types.GlobalOptsMonoid.GlobalOptsMonoid instance GHC.Base.Semigroup Stack.Types.GlobalOptsMonoid.GlobalOptsMonoid instance GHC.Base.Monoid Stack.Types.GlobalOptsMonoid.GlobalOptsMonoid module Stack.Types.GlobalOpts -- | Parsed global command-line options. data GlobalOpts GlobalOpts :: !Maybe String -> !Maybe DockerEntrypoint -> !LogLevel -> !Bool -> !Bool -> !Bool -> !ConfigMonoid -> !Maybe AbstractResolver -> !Maybe WantedCompiler -> !Bool -> !StylesUpdate -> !Maybe Int -> !StackYamlLoc -> !LockFileBehavior -> GlobalOpts -- | Expected re-exec in container version [$sel:reExecVersion:GlobalOpts] :: GlobalOpts -> !Maybe String -- | Data used when Stack is acting as a Docker entrypoint (internal use -- only) [$sel:dockerEntrypoint:GlobalOpts] :: GlobalOpts -> !Maybe DockerEntrypoint -- | Log level [$sel:logLevel:GlobalOpts] :: GlobalOpts -> !LogLevel -- | Whether to include timings in logs. [$sel:timeInLog:GlobalOpts] :: GlobalOpts -> !Bool -- | Whether to include raw snapshot layer (RSL) in logs. [$sel:rslInLog:GlobalOpts] :: GlobalOpts -> !Bool -- | Whether to include debug information about the construction of the -- build plan in logs. [$sel:planInLog:GlobalOpts] :: GlobalOpts -> !Bool -- | Config monoid, for passing into loadConfig [$sel:configMonoid:GlobalOpts] :: GlobalOpts -> !ConfigMonoid -- | Resolver override [$sel:resolver:GlobalOpts] :: GlobalOpts -> !Maybe AbstractResolver -- | Compiler override [$sel:compiler:GlobalOpts] :: GlobalOpts -> !Maybe WantedCompiler -- | We're in a terminal? [$sel:terminal:GlobalOpts] :: GlobalOpts -> !Bool -- | SGR (Ansi) codes for styles [$sel:stylesUpdate:GlobalOpts] :: GlobalOpts -> !StylesUpdate -- | Terminal width override [$sel:termWidthOpt:GlobalOpts] :: GlobalOpts -> !Maybe Int -- | Override project stack.yaml [$sel:stackYaml:GlobalOpts] :: GlobalOpts -> !StackYamlLoc [$sel:lockFileBehavior:GlobalOpts] :: GlobalOpts -> !LockFileBehavior globalOptsBuildOptsMonoidL :: Lens' GlobalOpts BuildOptsMonoid instance GHC.Show.Show Stack.Types.GlobalOpts.GlobalOpts module Stack.Types.Runner -- | The base environment that almost everything in Stack runs in, based -- off of parsing command line options in GlobalOpts. Provides -- logging, process execution, and the MVar used to ensure that the -- Docker entrypoint is performed exactly once. data Runner Runner :: !GlobalOpts -> !Bool -> !LogFunc -> !Int -> !ProcessContext -> !MVar Bool -> Runner [$sel:globalOpts:Runner] :: Runner -> !GlobalOpts [$sel:useColor:Runner] :: Runner -> !Bool [$sel:logFunc:Runner] :: Runner -> !LogFunc [$sel:termWidth:Runner] :: Runner -> !Int [$sel:processContext:Runner] :: Runner -> !ProcessContext [$sel:dockerEntrypointMVar:Runner] :: Runner -> !MVar Bool -- | Class for environment values which have a Runner. class (HasProcessContext env, HasLogFunc env) => HasRunner env runnerL :: HasRunner env => Lens' env Runner -- | Class for environment values which have a Docker entrypoint -- MVar. class HasRunner env => HasDockerEntrypointMVar env dockerEntrypointMVarL :: HasDockerEntrypointMVar env => Lens' env (MVar Bool) globalOptsL :: HasRunner env => Lens' env GlobalOpts stackYamlLocL :: HasRunner env => Lens' env StackYamlLoc lockFileBehaviorL :: HasRunner env => SimpleGetter env LockFileBehavior -- | See globalTerminal terminalL :: HasRunner env => Lens' env Bool -- | See globalReExecVersion reExecL :: HasRunner env => SimpleGetter env Bool rslInLogL :: HasRunner env => SimpleGetter env Bool instance Stack.Types.Runner.HasDockerEntrypointMVar Stack.Types.Runner.Runner instance Stack.Types.Runner.HasRunner Stack.Types.Runner.Runner instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Runner.Runner instance RIO.Process.HasProcessContext Stack.Types.Runner.Runner instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.Runner.Runner instance RIO.PrettyPrint.HasTerm Stack.Types.Runner.Runner module Stack.Types.AddCommand type AddCommand = ExceptT (RIO Runner ()) (Writer (Mod CommandFields (RIO Runner (), GlobalOptsMonoid))) () -- | Simple interface to complicated program arguments. -- -- This is a "fork" of the optparse-simple 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 -> (opts -> RIO Runner ()) -> (opts -> GlobalOptsMonoid -> GlobalOptsMonoid) -> Parser GlobalOptsMonoid -> Parser opts -> AddCommand -- | Add a command that takes sub-commands to the options dispatcher. addSubCommands :: String -> String -> String -> Parser GlobalOptsMonoid -> AddCommand -> AddCommand -- | Generate and execute a complicated options parser. complicatedOptions :: Version -> Maybe String -> String -> String -> String -> String -> Parser GlobalOptsMonoid -> Maybe (ParserFailure ParserHelp -> [String] -> IO (GlobalOptsMonoid, (RIO Runner (), GlobalOptsMonoid))) -> AddCommand -> IO (GlobalOptsMonoid, RIO Runner ()) -- | Generate a complicated options parser. complicatedParser :: String -> Parser GlobalOptsMonoid -> AddCommand -> Parser (GlobalOptsMonoid, (RIO Runner (), GlobalOptsMonoid)) module Stack.Types.Config.Exception -- | Type representing exceptions thrown by functions exported by the -- Stack.Config module. data 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 NoSuchDirectory :: FilePath -> ConfigException ParseGHCVariantException :: String -> ConfigException BadStackRoot :: Path Abs Dir -> ConfigException -- | $STACK_ROOT, parent dir Won'tCreateStackRootInDirectoryOwnedByDifferentUser :: Path Abs Dir -> Path Abs Dir -> ConfigException UserDoesn'tOwnDirectory :: Path Abs Dir -> ConfigException ManualGHCVariantSettingsAreIncompatibleWithSystemGHC :: ConfigException NixRequiresSystemGhc :: ConfigException NoResolverWhenUsingNoProject :: ConfigException NoLTSWithMajorVersion :: Int -> ConfigException NoLTSFound :: ConfigException -- | Type representing 'pretty' exceptions thrown by functions exported by -- the Stack.Config module. data ConfigPrettyException ParseConfigFileException :: !Path Abs File -> !ParseException -> ConfigPrettyException StackWorkEnvNotRelativeDir :: !String -> ConfigPrettyException MultiplePackageIndices :: [PackageIndexConfig] -> ConfigPrettyException DuplicateLocalPackageNames :: ![(PackageName, [PackageLocation])] -> ConfigPrettyException data ParseAbsolutePathException ParseAbsolutePathException :: String -> String -> ParseAbsolutePathException packageIndicesWarning :: StyleDoc instance GHC.Show.Show Stack.Types.Config.Exception.ConfigException instance GHC.Show.Show Stack.Types.Config.Exception.ConfigPrettyException instance GHC.Show.Show Stack.Types.Config.Exception.ParseAbsolutePathException instance GHC.Exception.Type.Exception Stack.Types.Config.Exception.ParseAbsolutePathException instance Text.PrettyPrint.Leijen.Extended.Pretty Stack.Types.Config.Exception.ConfigPrettyException instance GHC.Exception.Type.Exception Stack.Types.Config.Exception.ConfigPrettyException instance GHC.Exception.Type.Exception Stack.Types.Config.Exception.ConfigException module Stack.Types.Config -- | 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 -> !Bool -> !Platform -> !PlatformVariant -> !Maybe GHCVariant -> !Maybe CompilerBuild -> !Text -> !Bool -> !Bool -> !Bool -> !Bool -> !VersionCheck -> !CompilerRepository -> !Path Abs Dir -> !VersionRange -> !Int -> !Maybe (Path Abs File) -> ![FilePath] -> ![FilePath] -> ![Text] -> !Bool -> !Map Text Text -> !Maybe SCM -> !Map PackageName [Text] -> !Map ApplyGhcOptions [Text] -> !Map CabalConfigKey [Text] -> ![String] -> !SetupInfo -> !PvpBounds -> !Bool -> !Bool -> !ApplyGhcOptions -> !ApplyProgOptions -> !Bool -> !Maybe [PackageName] -> !Maybe TemplateName -> !Bool -> !DumpLogs -> !ProjectConfig (Project, Path Abs File) -> !Bool -> !Bool -> !Text -> !Runner -> !PantryConfig -> !Path Abs Dir -> !Maybe AbstractResolver -> !UserStorage -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe (CasaRepoPrefix, Int) -> Config -- | this allows to override .stack-work directory [$sel:workDir:Config] :: Config -> !Path Rel Dir -- | Path to user configuration file (usually ~.stackconfig.yaml) [$sel:userConfigPath:Config] :: Config -> !Path Abs File -- | Build configuration [$sel:build:Config] :: Config -> !BuildOpts -- | Docker configuration [$sel:docker:Config] :: Config -> !DockerOpts -- | Execution environment (e.g nix-shell) configuration [$sel:nix:Config] :: Config -> !NixOpts -- | Environment variables to be passed to external tools [$sel:processContextSettings:Config] :: Config -> !EnvSettings -> IO ProcessContext -- | Non-platform-specific path containing local installations [$sel:localProgramsBase:Config] :: Config -> !Path Abs Dir -- | Path containing local installations (mainly GHC) [$sel:localPrograms:Config] :: Config -> !Path Abs Dir -- | Hide the Template Haskell "Loading package ..." messages from the -- console [$sel:hideTHLoading:Config] :: Config -> !Bool -- | Prefix build output with timestamps for each line. [$sel:prefixTimestamps:Config] :: Config -> !Bool -- | The platform we're building for, used in many directory names [$sel:platform:Config] :: Config -> !Platform -- | Variant of the platform, also used in directory names [$sel:platformVariant:Config] :: Config -> !PlatformVariant -- | The variant of GHC requested by the user. [$sel:ghcVariant:Config] :: Config -> !Maybe GHCVariant -- | Override build of the compiler distribution (e.g. standard, gmp4, -- tinfo6) [$sel:ghcBuild:Config] :: Config -> !Maybe CompilerBuild -- | URL of a JSON file providing the latest LTS and Nightly snapshots. [$sel:latestSnapshot:Config] :: Config -> !Text -- | Should we use the system-installed GHC (on the PATH) if available? Can -- be overridden by command line options. [$sel:systemGHC:Config] :: Config -> !Bool -- | Should we automatically install GHC if missing or the wrong version is -- available? Can be overridden by command line options. [$sel:installGHC:Config] :: Config -> !Bool -- | Don't bother checking the GHC version or architecture. [$sel:skipGHCCheck:Config] :: Config -> !Bool -- | On Windows: don't use a sandboxed MSYS [$sel:skipMsys:Config] :: Config -> !Bool -- | Specifies which versions of the compiler are acceptable. [$sel:compilerCheck:Config] :: Config -> !VersionCheck -- | Specifies the repository containing the compiler sources [$sel:compilerRepository:Config] :: Config -> !CompilerRepository -- | Directory we should install executables into [$sel:localBin:Config] :: Config -> !Path Abs Dir -- | Require a version of Stack within this range. [$sel:requireStackVersion:Config] :: Config -> !VersionRange -- | How many concurrent jobs to run, defaults to number of capabilities [$sel:jobs:Config] :: Config -> !Int -- | Optional gcc override path [$sel:overrideGccPath:Config] :: Config -> !Maybe (Path Abs File) -- |
-- STACK_ROOT/hooks/ghc-install.sh --ghcInstallHook :: HasConfig env => RIO env (Path Abs File) buildOptsL :: HasConfig s => Lens' s BuildOpts envOverrideSettingsL :: HasConfig env => Lens' env (EnvSettings -> IO ProcessContext) globalOptsL :: HasRunner env => Lens' env GlobalOpts stackGlobalConfigL :: HasConfig s => Lens' s (Path Abs File) stackRootL :: HasConfig s => Lens' s (Path Abs Dir) -- |
-- ".stack-work" --workDirL :: HasConfig env => Lens' env (Path Rel Dir) -- | In dev mode, print as a warning, otherwise as debug prettyStackDevL :: HasConfig env => [StyleDoc] -> RIO env () instance Stack.Types.Config.HasConfig Stack.Types.Config.Config instance Stack.Types.Platform.HasPlatform Stack.Types.Config.Config instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.Config.Config instance RIO.Process.HasProcessContext Stack.Types.Config.Config instance Pantry.Types.HasPantryConfig Stack.Types.Config.Config instance Stack.Types.Runner.HasRunner Stack.Types.Config.Config instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.Config instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.Config.Config instance RIO.PrettyPrint.HasTerm Stack.Types.Config.Config module Stack.Types.BuildConfig -- | A superset of Config adding information on how to build code. -- The reason for this breakdown is because we will need some of the -- information from Config in order to determine the values here. -- -- These are the components which know nothing about local configuration. data BuildConfig BuildConfig :: !Config -> !SMWanted -> ![Path Abs Dir] -> !Path Abs File -> !ProjectStorage -> !Maybe Curator -> BuildConfig [$sel:config:BuildConfig] :: BuildConfig -> !Config [$sel:smWanted:BuildConfig] :: BuildConfig -> !SMWanted -- | Extra package databases [$sel:extraPackageDBs:BuildConfig] :: 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 / "stack.yaml" if a different file -- name is used. [$sel:stackYaml:BuildConfig] :: BuildConfig -> !Path Abs File -- | Database connection pool for project Stack database [$sel:projectStorage:BuildConfig] :: BuildConfig -> !ProjectStorage [$sel:curator:BuildConfig] :: BuildConfig -> !Maybe Curator class HasConfig env => HasBuildConfig env buildConfigL :: HasBuildConfig env => Lens' env BuildConfig 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) -- | Per-project work dir getProjectWorkDir :: (HasBuildConfig env, MonadReader env m) => m (Path Abs Dir) -- | The compiler specified by the SnapshotDef. This may be -- different from the actual compiler used! wantedCompilerVersionL :: HasBuildConfig s => Getting r s WantedCompiler instance Stack.Types.BuildConfig.HasBuildConfig Stack.Types.BuildConfig.BuildConfig instance Stack.Types.Platform.HasPlatform Stack.Types.BuildConfig.BuildConfig instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.BuildConfig.BuildConfig instance RIO.Process.HasProcessContext Stack.Types.BuildConfig.BuildConfig instance Pantry.Types.HasPantryConfig Stack.Types.BuildConfig.BuildConfig instance Stack.Types.Config.HasConfig Stack.Types.BuildConfig.BuildConfig instance Stack.Types.Runner.HasRunner Stack.Types.BuildConfig.BuildConfig instance RIO.Prelude.Logger.HasLogFunc Stack.Types.BuildConfig.BuildConfig instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.BuildConfig.BuildConfig instance RIO.PrettyPrint.HasTerm Stack.Types.BuildConfig.BuildConfig -- | The facility for retrieving all files from the main Stack -- Package type. This was moved into its own module to allow -- component-level file-gathering without circular dependency at the -- Package level. module Stack.Types.PackageFile data GetPackageFileContext GetPackageFileContext :: !Path Abs File -> !Path Abs Dir -> !BuildConfig -> !Version -> GetPackageFileContext [$sel:file:GetPackageFileContext] :: GetPackageFileContext -> !Path Abs File [$sel:distDir:GetPackageFileContext] :: GetPackageFileContext -> !Path Abs Dir [$sel:buildConfig:GetPackageFileContext] :: GetPackageFileContext -> !BuildConfig [$sel:cabalVer:GetPackageFileContext] :: GetPackageFileContext -> !Version -- | A path resolved from the Cabal file, which is either main-is or an -- exposedinternalreferenced module. data DotCabalPath DotCabalModulePath :: !Path Abs File -> DotCabalPath DotCabalMainPath :: !Path Abs File -> DotCabalPath DotCabalFilePath :: !Path Abs File -> DotCabalPath DotCabalCFilePath :: !Path Abs File -> DotCabalPath -- | 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 -- | Warning generated when reading a package data PackageWarning -- | Modules found that are not listed in Cabal file TODO: bring this back -- - see https://github.com/commercialhaskell/stack/issues/2649 UnlistedModulesWarning :: NamedComponent -> [ModuleName] -> PackageWarning -- | This is the information from Cabal we need at the package level to -- track files. data StackPackageFile StackPackageFile :: [FilePath] -> FilePath -> [FilePath] -> StackPackageFile [$sel:extraSrcFiles:StackPackageFile] :: StackPackageFile -> [FilePath] [$sel:dataDir:StackPackageFile] :: StackPackageFile -> FilePath [$sel:dataFiles:StackPackageFile] :: StackPackageFile -> [FilePath] -- | Files that the package depends on, relative to package directory. data PackageComponentFile PackageComponentFile :: Map NamedComponent (Map ModuleName (Path Abs File)) -> !Map NamedComponent [DotCabalPath] -> Set (Path Abs File) -> [PackageWarning] -> PackageComponentFile [$sel:modulePathMap:PackageComponentFile] :: PackageComponentFile -> Map NamedComponent (Map ModuleName (Path Abs File)) [$sel:cabalFileMap:PackageComponentFile] :: PackageComponentFile -> !Map NamedComponent [DotCabalPath] [$sel:packageExtraFile:PackageComponentFile] :: PackageComponentFile -> Set (Path Abs File) [$sel:warnings:PackageComponentFile] :: PackageComponentFile -> [PackageWarning] instance GHC.Show.Show Stack.Types.PackageFile.DotCabalPath instance GHC.Classes.Ord Stack.Types.PackageFile.DotCabalPath instance GHC.Classes.Eq Stack.Types.PackageFile.DotCabalPath instance GHC.Show.Show Stack.Types.PackageFile.DotCabalDescriptor instance GHC.Classes.Ord Stack.Types.PackageFile.DotCabalDescriptor instance GHC.Classes.Eq Stack.Types.PackageFile.DotCabalDescriptor instance GHC.Show.Show Stack.Types.PackageFile.StackPackageFile instance GHC.Base.Semigroup Stack.Types.PackageFile.PackageComponentFile instance GHC.Base.Monoid Stack.Types.PackageFile.PackageComponentFile instance Stack.Types.Platform.HasPlatform Stack.Types.PackageFile.GetPackageFileContext instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.PackageFile.GetPackageFileContext instance RIO.Prelude.Logger.HasLogFunc Stack.Types.PackageFile.GetPackageFileContext instance Stack.Types.Runner.HasRunner Stack.Types.PackageFile.GetPackageFileContext instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.PackageFile.GetPackageFileContext instance RIO.PrettyPrint.HasTerm Stack.Types.PackageFile.GetPackageFileContext instance Stack.Types.Config.HasConfig Stack.Types.PackageFile.GetPackageFileContext instance Stack.Types.BuildConfig.HasBuildConfig Stack.Types.PackageFile.GetPackageFileContext instance Pantry.Types.HasPantryConfig Stack.Types.PackageFile.GetPackageFileContext instance RIO.Process.HasProcessContext Stack.Types.PackageFile.GetPackageFileContext module Stack.Types.EnvConfig -- | Configuration after the environment has been setup. data EnvConfig EnvConfig :: !BuildConfig -> !BuildOptsCLI -> !FileDigestCache -> !SourceMap -> !SourceMapHash -> !CompilerPaths -> EnvConfig [$sel:buildConfig:EnvConfig] :: EnvConfig -> !BuildConfig [$sel:buildOptsCLI:EnvConfig] :: EnvConfig -> !BuildOptsCLI [$sel:fileDigestCache:EnvConfig] :: EnvConfig -> !FileDigestCache [$sel:sourceMap:EnvConfig] :: EnvConfig -> !SourceMap [$sel:sourceMapHash:EnvConfig] :: EnvConfig -> !SourceMapHash [$sel:compilerPaths:EnvConfig] :: EnvConfig -> !CompilerPaths class (HasBuildConfig env, HasSourceMap env, HasCompiler env) => HasEnvConfig env envConfigL :: HasEnvConfig env => Lens' env EnvConfig class HasSourceMap env sourceMapL :: HasSourceMap env => Lens' env SourceMap -- | The version of the compiler which will actually be used. May be -- different than that specified in the SnapshotDef and returned -- by wantedCompilerVersionL. actualCompilerVersionL :: HasSourceMap env => SimpleGetter env ActualCompiler appropriateGhcColorFlag :: (HasEnvConfig env, HasRunner env) => RIO env (Maybe String) -- | Installation root for compiler tools bindirCompilerTools :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => m (Path Abs Dir) compilerVersionDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => m (Path Rel Dir) -- | Get the extra bin directories (for the PATH). Puts more local first -- -- Bool indicates whether or not to include the locals extraBinDirs :: HasEnvConfig env => RIO env (Bool -> [Path Abs Dir]) -- | Get the hoogle database path. hoogleDatabasePath :: HasEnvConfig env => RIO env (Path Abs File) -- | Hoogle directory. hoogleRoot :: HasEnvConfig env => RIO env (Path Abs Dir) -- | Where HPC reports and tix files get stored. hpcReportDir :: HasEnvConfig env => RIO env (Path Abs Dir) -- | Installation root for dependencies installationRootDeps :: HasEnvConfig env => RIO env (Path Abs Dir) -- | Installation root for locals installationRootLocal :: HasEnvConfig env => RIO env (Path Abs Dir) -- | Package database for installing dependencies into packageDatabaseDeps :: HasEnvConfig env => RIO env (Path Abs Dir) -- | Extra package databases packageDatabaseExtra :: (HasEnvConfig env, MonadReader env m) => m [Path Abs Dir] -- | Package database for installing local packages into packageDatabaseLocal :: HasEnvConfig env => RIO env (Path Abs Dir) -- | Relative directory for the platform and GHC identifier platformGhcRelDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => m (Path Rel Dir) -- | Relative directory for the platform and GHC identifier without GHC -- bindist build platformGhcVerOnlyRelDir :: (HasGHCVariant env, HasPlatform env, MonadReader env m, MonadThrow m) => m (Path Rel Dir) -- | Path for platform followed by snapshot name followed by compiler name. platformSnapAndCompilerRel :: HasEnvConfig env => RIO env (Path Rel Dir) shouldForceGhcColorFlag :: (HasEnvConfig env, HasRunner env) => RIO env Bool -- | Directory containing snapshots snapshotsDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => m (Path Abs 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) shaPathForBytes :: (IsPath Rel t, MonadThrow m) => ByteString -> m (Path Rel t) instance Stack.Types.EnvConfig.IsPath Path.Windows.Abs Path.Windows.Dir instance Stack.Types.EnvConfig.IsPath Path.Windows.Rel Path.Windows.Dir instance Stack.Types.EnvConfig.IsPath Path.Windows.Abs Path.Windows.File instance Stack.Types.EnvConfig.IsPath Path.Windows.Rel Path.Windows.File instance Stack.Types.BuildConfig.HasBuildConfig Stack.Types.EnvConfig.EnvConfig instance Stack.Types.EnvConfig.HasEnvConfig Stack.Types.EnvConfig.EnvConfig instance Stack.Types.EnvConfig.HasSourceMap Stack.Types.EnvConfig.EnvConfig instance Stack.Types.Config.HasConfig Stack.Types.EnvConfig.EnvConfig instance Stack.Types.Platform.HasPlatform Stack.Types.EnvConfig.EnvConfig instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.EnvConfig.EnvConfig instance RIO.Process.HasProcessContext Stack.Types.EnvConfig.EnvConfig instance Pantry.Types.HasPantryConfig Stack.Types.EnvConfig.EnvConfig instance Stack.Types.CompilerPaths.HasCompiler Stack.Types.EnvConfig.EnvConfig instance Stack.Types.Runner.HasRunner Stack.Types.EnvConfig.EnvConfig instance RIO.Prelude.Logger.HasLogFunc Stack.Types.EnvConfig.EnvConfig instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.EnvConfig.EnvConfig instance RIO.PrettyPrint.HasTerm Stack.Types.EnvConfig.EnvConfig module Stack.Types.Package -- | Type representing inputs to generateBuildInfoOpts. data BioInput BioInput :: !InstallMap -> !InstalledMap -> !Path Abs Dir -> !Path Abs Dir -> ![PackageName] -> ![PackageName] -> !StackBuildInfo -> ![DotCabalPath] -> ![FilePath] -> ![FilePath] -> !NamedComponent -> !Version -> BioInput [$sel:installMap:BioInput] :: BioInput -> !InstallMap [$sel:installedMap:BioInput] :: BioInput -> !InstalledMap [$sel:cabalDir:BioInput] :: BioInput -> !Path Abs Dir [$sel:distDir:BioInput] :: BioInput -> !Path Abs Dir [$sel:omitPackages:BioInput] :: BioInput -> ![PackageName] [$sel:addPackages:BioInput] :: BioInput -> ![PackageName] [$sel:buildInfo:BioInput] :: BioInput -> !StackBuildInfo [$sel:dotCabalPaths:BioInput] :: BioInput -> ![DotCabalPath] [$sel:configLibDirs:BioInput] :: BioInput -> ![FilePath] [$sel:configIncludeDirs:BioInput] :: BioInput -> ![FilePath] [$sel:componentName:BioInput] :: BioInput -> !NamedComponent [$sel:cabalVersion:BioInput] :: BioInput -> !Version -- | GHC options based on cabal information and ghc-options. data BuildInfoOpts BuildInfoOpts :: [String] -> [String] -> [String] -> Path Abs File -> BuildInfoOpts [$sel:opts:BuildInfoOpts] :: BuildInfoOpts -> [String] [$sel:oneWordOpts:BuildInfoOpts] :: BuildInfoOpts -> [String] -- | These options can safely have nubOrd applied to them, as there -- are no multi-word options (see -- https://github.com/commercialhaskell/stack/issues/1255) [$sel:packageFlags:BuildInfoOpts] :: BuildInfoOpts -> [String] [$sel:cabalMacros:BuildInfoOpts] :: BuildInfoOpts -> Path Abs File -- | Name of an executable. newtype ExeName ExeName :: Text -> ExeName [$sel:exeName:ExeName] :: ExeName -> Text newtype FileCacheInfo FileCacheInfo :: SHA256 -> FileCacheInfo [$sel:hash:FileCacheInfo] :: FileCacheInfo -> SHA256 -- | Type representing user package databases that packages can be -- installed into. data InstallLocation -- | The write-only package database, formerly known as the snapshot -- database. Snap :: InstallLocation -- | The mutable package database, formerly known as the local database. Local :: InstallLocation -- | Type representing information about what is installed. data Installed -- | A library, including its installed package id and, optionally, its -- license. Library :: PackageIdentifier -> InstalledLibraryInfo -> Installed -- | An executable. Executable :: PackageIdentifier -> Installed data InstalledLibraryInfo InstalledLibraryInfo :: GhcPkgId -> Maybe (Either License License) -> Map StackUnqualCompName GhcPkgId -> InstalledLibraryInfo [ghcPkgId] :: InstalledLibraryInfo -> GhcPkgId [license] :: InstalledLibraryInfo -> Maybe (Either License License) [subLib] :: InstalledLibraryInfo -> Map StackUnqualCompName GhcPkgId -- | Type representing user (non-global) package databases that can provide -- installed packages. data InstalledPackageLocation -- | A package database that a package can be installed into. InstalledTo :: InstallLocation -> InstalledPackageLocation -- | An 'extra' package database, specified by extra-package-dbs. ExtraPkgDb :: InstalledPackageLocation -- | Information on a locally available package of source code. data LocalPackage LocalPackage :: !Package -> !Set NamedComponent -> !Set NamedComponent -> !Bool -> !Maybe Package -> !Path Abs File -> !Bool -> !Bool -> !MemoizedWith EnvConfig (Maybe (Set FilePath)) -> !MemoizedWith EnvConfig (Map NamedComponent (Map FilePath FileCacheInfo)) -> !MemoizedWith EnvConfig (Map NamedComponent (Set (Path Abs File))) -> LocalPackage -- | The Package info itself, after resolution with package flags, -- with tests and benchmarks disabled [$sel:package:LocalPackage] :: LocalPackage -> !Package -- | Components to build, not including the library component. [$sel:components:LocalPackage] :: LocalPackage -> !Set NamedComponent -- | Components explicitly requested for build, that are marked "buildable: -- false". [$sel:unbuildable:LocalPackage] :: LocalPackage -> !Set NamedComponent -- | Whether this package is wanted as a target. [$sel:wanted:LocalPackage] :: LocalPackage -> !Bool -- | This stores the Package with tests and benchmarks enabled, if -- either is asked for by the user. [$sel:testBench:LocalPackage] :: LocalPackage -> !Maybe Package -- | Absolute path to the Cabal file. [$sel:cabalFP:LocalPackage] :: LocalPackage -> !Path Abs File -- | Is Haddock documentation being built for this package? [$sel:buildHaddocks:LocalPackage] :: LocalPackage -> !Bool [$sel:forceDirty:LocalPackage] :: 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. [$sel:dirtyFiles:LocalPackage] :: LocalPackage -> !MemoizedWith EnvConfig (Maybe (Set FilePath)) -- | current state of the files [$sel:newBuildCaches:LocalPackage] :: LocalPackage -> !MemoizedWith EnvConfig (Map NamedComponent (Map FilePath FileCacheInfo)) -- | all files used by this package [$sel:componentFiles:LocalPackage] :: LocalPackage -> !MemoizedWith EnvConfig (Map NamedComponent (Set (Path Abs File))) newtype MemoizedWith env a MemoizedWith :: RIO env a -> MemoizedWith env a [$sel:memoizedWith:MemoizedWith] :: MemoizedWith env a -> RIO env a -- | Some package info. data Package Package :: !PackageName -> !Version -> !Either License License -> ![Text] -> ![Text] -> !Map FlagName Bool -> !Map FlagName Bool -> !Maybe StackLibrary -> !CompCollection StackLibrary -> !CompCollection StackForeignLibrary -> !CompCollection StackTestSuite -> !CompCollection StackBenchmark -> !CompCollection StackExecutable -> !BuildType -> !Maybe (Map PackageName DepValue) -> !CabalSpecVersion -> StackPackageFile -> Bool -> Bool -> Package -- | Name of the package. [$sel:name:Package] :: Package -> !PackageName -- | Version of the package [$sel:version:Package] :: Package -> !Version -- | The license the package was released under. [$sel:license:Package] :: Package -> !Either License License -- | Ghc options used on package. [$sel:ghcOptions:Package] :: Package -> ![Text] -- | Additional options passed to ./Setup.hs configure [$sel:cabalConfigOpts:Package] :: Package -> ![Text] -- | Flags used on package. [$sel:flags:Package] :: Package -> !Map FlagName Bool -- | Defaults for unspecified flags. [$sel:defaultFlags:Package] :: Package -> !Map FlagName Bool -- | Does the package have a buildable main library stanza? [$sel:library:Package] :: Package -> !Maybe StackLibrary -- | The sub-libraries of the package. [$sel:subLibraries:Package] :: Package -> !CompCollection StackLibrary -- | The foreign libraries of the package. [$sel:foreignLibraries:Package] :: Package -> !CompCollection StackForeignLibrary -- | The test suites of the package. [$sel:testSuites:Package] :: Package -> !CompCollection StackTestSuite -- | The benchmarks of the package. [$sel:benchmarks:Package] :: Package -> !CompCollection StackBenchmark -- | The executables of the package. [$sel:executables:Package] :: Package -> !CompCollection StackExecutable -- | Package build-type. [$sel:buildType:Package] :: Package -> !BuildType -- | If present: custom-setup dependencies [$sel:setupDeps:Package] :: Package -> !Maybe (Map PackageName DepValue) -- | Cabal spec range [$sel:cabalSpec:Package] :: Package -> !CabalSpecVersion -- | The Cabal sourced files related to the package at the package level -- The components may have file information in their own types [$sel:file:Package] :: Package -> StackPackageFile -- | This is a requirement because when tests are not enabled, Stack's -- package dependencies should ignore test dependencies. Directly set -- from packageConfigEnableTests. [$sel:testEnabled:Package] :: Package -> Bool -- | This is a requirement because when benchmark are not enabled, Stack's -- package dependencies should ignore benchmark dependencies. Directly -- set from packageConfigEnableBenchmarks. [$sel:benchmarkEnabled:Package] :: Package -> Bool -- | Package build configuration data PackageConfig PackageConfig :: !Bool -> !Bool -> !Map FlagName Bool -> ![Text] -> ![Text] -> ActualCompiler -> !Platform -> PackageConfig -- | Are tests enabled? [$sel:enableTests:PackageConfig] :: PackageConfig -> !Bool -- | Are benchmarks enabled? [$sel:enableBenchmarks:PackageConfig] :: PackageConfig -> !Bool -- | Configured flags. [$sel:flags:PackageConfig] :: PackageConfig -> !Map FlagName Bool -- | Configured ghc options. [$sel:ghcOptions:PackageConfig] :: PackageConfig -> ![Text] -- | ./Setup.hs configure options [$sel:cabalConfigOpts:PackageConfig] :: PackageConfig -> ![Text] -- | GHC version [$sel:compilerVersion:PackageConfig] :: PackageConfig -> ActualCompiler -- | host platform [$sel:platform:PackageConfig] :: PackageConfig -> !Platform -- | Type representing package databases that can provide installed -- packages. data PackageDatabase -- | GHC's global package database. GlobalPkgDb :: PackageDatabase -- | A user package database. UserPkgDb :: InstalledPackageLocation -> Path Abs Dir -> PackageDatabase -- | Type representing varieties of package databases that can provide -- installed packages. data PackageDbVariety -- | GHC's global package database. GlobalDb :: PackageDbVariety -- | An 'extra' package database, specified by extra-package-dbs. ExtraDb :: PackageDbVariety -- | The write-only package database, for immutable packages. WriteOnlyDb :: PackageDbVariety -- | The mutable package database. MutableDb :: PackageDbVariety -- | Type representing exceptions thrown by functions exported by the -- Stack.Package module. data PackageException PackageInvalidCabalFile :: !Either PackageIdentifierRevision (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PackageException MismatchedCabalIdentifier :: !PackageIdentifierRevision -> !PackageIdentifier -> PackageException CabalFileNameParseFail :: FilePath -> PackageException CabalFileNameInvalidPackageName :: FilePath -> PackageException ComponentNotParsedBug :: String -> PackageException -- | Where the package's source is located: local directory or package -- index data PackageSource -- | Package which exist on the filesystem PSFilePath :: LocalPackage -> PackageSource -- | Package which is downloaded remotely. PSRemote :: PackageLocationImmutable -> Version -> FromSnapshot -> CommonPackage -> PackageSource -- | Get the c file path. dotCabalCFilePath :: DotCabalPath -> Maybe (Path Abs File) -- | Get the path. dotCabalGetPath :: DotCabalPath -> Path Abs File -- | Maybe get the main name from the .cabal descriptor. dotCabalMain :: DotCabalDescriptor -> Maybe FilePath -- | Get the main path. dotCabalMainPath :: DotCabalPath -> Maybe (Path Abs File) -- | Maybe get the module name from the .cabal descriptor. dotCabalModule :: DotCabalDescriptor -> Maybe ModuleName -- | Get the module path. dotCabalModulePath :: DotCabalPath -> Maybe (Path Abs File) -- | Gathers all the GhcPkgId provided by a library into a map installedMapGhcPkgId :: PackageIdentifier -> InstalledLibraryInfo -> Map PackageIdentifier GhcPkgId lpFiles :: HasEnvConfig env => LocalPackage -> RIO env (Set (Path Abs File)) lpFilesForComponents :: HasEnvConfig env => Set NamedComponent -> LocalPackage -> RIO env (Set (Path Abs File)) memoizeRefWith :: MonadIO m => RIO env a -> m (MemoizedWith env a) packageDefinedFlags :: Package -> Set FlagName packageIdentifier :: Package -> PackageIdentifier psVersion :: PackageSource -> Version runMemoizedWith :: (HasEnvConfig env, MonadReader env m, MonadIO m) => MemoizedWith EnvConfig a -> m a simpleInstalledLib :: PackageIdentifier -> GhcPkgId -> Map StackUnqualCompName GhcPkgId -> Installed toCabalMungedPackageName :: PackageName -> StackUnqualCompName -> MungedPackageName -- | A function to yield the variety of package database for a given -- package database that can provide installed packages. toPackageDbVariety :: PackageDatabase -> PackageDbVariety instance GHC.Show.Show Stack.Types.Package.PackageException instance GHC.Show.Show Stack.Types.Package.ExeName instance GHC.Classes.Ord Stack.Types.Package.ExeName instance Control.DeepSeq.NFData Stack.Types.Package.ExeName instance Data.String.IsString Stack.Types.Package.ExeName instance Data.Hashable.Class.Hashable Stack.Types.Package.ExeName instance GHC.Generics.Generic Stack.Types.Package.ExeName instance GHC.Classes.Eq Stack.Types.Package.ExeName instance Data.Data.Data Stack.Types.Package.ExeName instance GHC.Show.Show Stack.Types.Package.Package instance GHC.Show.Show Stack.Types.Package.BuildInfoOpts instance GHC.Show.Show Stack.Types.Package.PackageConfig instance GHC.Base.Monad (Stack.Types.Package.MemoizedWith env) instance GHC.Base.Functor (Stack.Types.Package.MemoizedWith env) instance GHC.Base.Applicative (Stack.Types.Package.MemoizedWith env) instance GHC.Show.Show Stack.Types.Package.FileCacheInfo instance GHC.Generics.Generic Stack.Types.Package.FileCacheInfo instance GHC.Classes.Eq Stack.Types.Package.FileCacheInfo instance GHC.Show.Show Stack.Types.Package.LocalPackage instance GHC.Show.Show Stack.Types.Package.PackageSource instance Control.DeepSeq.NFData Stack.Types.Package.FileCacheInfo instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Package.FileCacheInfo instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Package.FileCacheInfo instance GHC.Show.Show (Stack.Types.Package.MemoizedWith env a) instance GHC.Classes.Ord Stack.Types.Package.Package instance GHC.Classes.Eq Stack.Types.Package.Package instance GHC.Exception.Type.Exception Stack.Types.Package.PackageException module Stack.Types.DotConfig data DotConfig DotConfig :: !BuildConfig -> !SourceMap -> ![DumpPackage] -> DotConfig [$sel:buildConfig:DotConfig] :: DotConfig -> !BuildConfig [$sel:sourceMap:DotConfig] :: DotConfig -> !SourceMap [$sel:globalDump:DotConfig] :: DotConfig -> ![DumpPackage] instance RIO.Prelude.Logger.HasLogFunc Stack.Types.DotConfig.DotConfig instance Pantry.Types.HasPantryConfig Stack.Types.DotConfig.DotConfig instance RIO.PrettyPrint.HasTerm Stack.Types.DotConfig.DotConfig instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.DotConfig.DotConfig instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.DotConfig.DotConfig instance Stack.Types.Platform.HasPlatform Stack.Types.DotConfig.DotConfig instance Stack.Types.Runner.HasRunner Stack.Types.DotConfig.DotConfig instance RIO.Process.HasProcessContext Stack.Types.DotConfig.DotConfig instance Stack.Types.Config.HasConfig Stack.Types.DotConfig.DotConfig instance Stack.Types.BuildConfig.HasBuildConfig Stack.Types.DotConfig.DotConfig instance Stack.Types.EnvConfig.HasSourceMap Stack.Types.DotConfig.DotConfig module Path.CheckInstall -- | Checks if the installed executable will be available on the user's -- PATH. This doesn't use envSearchPath menv because it includes -- paths only visible when running in the Stack environment. warnInstallSearchPathIssues :: HasConfig env => FilePath -> [Text] -> RIO env () -- | Docker configuration module Stack.Config.Docker -- | Type representing exceptions thrown by functions exported by the -- Stack.Config.Docker module. data ConfigDockerException -- | Only LTS resolvers are supported for default image tag. ResolverNotSupportedException :: !Maybe Project -> !Maybe AbstractResolver -> ConfigDockerException -- | Add a default Docker tag name to a given base image. addDefaultTag :: MonadThrow m => String -> Maybe Project -> Maybe AbstractResolver -> m String -- | Interprets DockerOptsMonoid options. dockerOptsFromMonoid :: MonadThrow m => Maybe Project -> Maybe AbstractResolver -> DockerOptsMonoid -> m DockerOpts instance GHC.Show.Show Stack.Config.Docker.ConfigDockerException instance GHC.Exception.Type.Exception Stack.Config.Docker.ConfigDockerException module Stack.Types.ConfigureOpts -- | 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 effect on the contents of the compiled binary for checking -- if we can use an existing precompiled cache. [$sel:pathRelated:ConfigureOpts] :: ConfigureOpts -> ![String] -- | Options other than path-related options. [$sel:nonPathRelated:ConfigureOpts] :: ConfigureOpts -> ![String] -- | 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 [$sel:snapDB:BaseConfigOpts] :: BaseConfigOpts -> !Path Abs Dir [$sel:localDB:BaseConfigOpts] :: BaseConfigOpts -> !Path Abs Dir [$sel:snapInstallRoot:BaseConfigOpts] :: BaseConfigOpts -> !Path Abs Dir [$sel:localInstallRoot:BaseConfigOpts] :: BaseConfigOpts -> !Path Abs Dir [$sel:buildOpts:BaseConfigOpts] :: BaseConfigOpts -> !BuildOpts [$sel:buildOptsCLI:BaseConfigOpts] :: BaseConfigOpts -> !BuildOptsCLI [$sel:extraDBs:BaseConfigOpts] :: BaseConfigOpts -> ![Path Abs Dir] -- | Render a BaseConfigOpts to an actual list of options configureOpts :: EnvConfig -> BaseConfigOpts -> Map PackageIdentifier GhcPkgId -> Bool -> IsMutable -> Package -> ConfigureOpts configureOptsPathRelated :: BaseConfigOpts -> IsMutable -> Package -> [String] -- | Same as configureOpts, but does not include directory path -- options configureOptsNonPathRelated :: EnvConfig -> BaseConfigOpts -> Map PackageIdentifier GhcPkgId -> Bool -> Package -> [String] instance GHC.Show.Show Stack.Types.ConfigureOpts.BaseConfigOpts instance GHC.Show.Show Stack.Types.ConfigureOpts.ConfigureOpts instance GHC.Generics.Generic Stack.Types.ConfigureOpts.ConfigureOpts instance GHC.Classes.Eq Stack.Types.ConfigureOpts.ConfigureOpts instance Data.Data.Data Stack.Types.ConfigureOpts.ConfigureOpts instance Control.DeepSeq.NFData Stack.Types.ConfigureOpts.ConfigureOpts -- | Build-specific types. module Stack.Types.Build -- | Type representing user package databases that packages can be -- installed into. data InstallLocation -- | The write-only package database, formerly known as the snapshot -- database. Snap :: InstallLocation -- | The mutable package database, formerly known as the local database. Local :: InstallLocation -- | Type representing information about what is installed. data Installed -- | A library, including its installed package id and, optionally, its -- license. Library :: PackageIdentifier -> InstalledLibraryInfo -> Installed -- | An executable. Executable :: PackageIdentifier -> Installed psVersion :: PackageSource -> Version -- | A type representing tasks to perform when building. data Task Task :: !TaskType -> !TaskConfigOpts -> !Bool -> !Map PackageIdentifier GhcPkgId -> !Bool -> !CachePkgSrc -> !Bool -> Task -- | The task type, telling us how to build this [$sel:taskType:Task] :: Task -> !TaskType -- | A set of the package identifiers of dependencies for which -- GhcPkgId are missing and a function which yields configure -- options, given a dictionary of those identifiers and their -- GhcPkgId. [$sel:configOpts:Task] :: Task -> !TaskConfigOpts [$sel:buildHaddocks:Task] :: Task -> !Bool -- | A dictionary of the package identifiers of already-installed -- dependencies, and their GhcPkgId. [$sel:present:Task] :: Task -> !Map PackageIdentifier GhcPkgId -- | indicates that the package can be built in one step [$sel:allInOne:Task] :: Task -> !Bool [$sel:cachePkgSrc:Task] :: Task -> !CachePkgSrc -- | Is the build type of this package Configure. Check out -- ensureConfigureScript in Stack.Build.Execute for the motivation [$sel:buildTypeConfig:Task] :: Task -> !Bool -- | Were any of the dependencies missing? taskAnyMissing :: Task -> Bool taskIsTarget :: Task -> Bool -- | A function to yield the relevant database (write-only or mutable) of -- the given task. taskLocation :: Task -> InstallLocation -- | A function to yield the package name and version to be built by the -- given task. taskProvides :: Task -> PackageIdentifier taskTargetIsMutable :: Task -> IsMutable -- | A function to yield the relevant database (write-only or mutable) of a -- given TaskType value. taskTypeLocation :: TaskType -> InstallLocation -- | A function to yield the package name and version of a given -- TaskType value. taskTypePackageIdentifier :: TaskType -> PackageIdentifier -- | Information on a locally available package of source code. data LocalPackage LocalPackage :: !Package -> !Set NamedComponent -> !Set NamedComponent -> !Bool -> !Maybe Package -> !Path Abs File -> !Bool -> !Bool -> !MemoizedWith EnvConfig (Maybe (Set FilePath)) -> !MemoizedWith EnvConfig (Map NamedComponent (Map FilePath FileCacheInfo)) -> !MemoizedWith EnvConfig (Map NamedComponent (Set (Path Abs File))) -> LocalPackage -- | The Package info itself, after resolution with package flags, -- with tests and benchmarks disabled [$sel:package:LocalPackage] :: LocalPackage -> !Package -- | Components to build, not including the library component. [$sel:components:LocalPackage] :: LocalPackage -> !Set NamedComponent -- | Components explicitly requested for build, that are marked "buildable: -- false". [$sel:unbuildable:LocalPackage] :: LocalPackage -> !Set NamedComponent -- | Whether this package is wanted as a target. [$sel:wanted:LocalPackage] :: LocalPackage -> !Bool -- | This stores the Package with tests and benchmarks enabled, if -- either is asked for by the user. [$sel:testBench:LocalPackage] :: LocalPackage -> !Maybe Package -- | Absolute path to the Cabal file. [$sel:cabalFP:LocalPackage] :: LocalPackage -> !Path Abs File -- | Is Haddock documentation being built for this package? [$sel:buildHaddocks:LocalPackage] :: LocalPackage -> !Bool [$sel:forceDirty:LocalPackage] :: 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. [$sel:dirtyFiles:LocalPackage] :: LocalPackage -> !MemoizedWith EnvConfig (Maybe (Set FilePath)) -- | current state of the files [$sel:newBuildCaches:LocalPackage] :: LocalPackage -> !MemoizedWith EnvConfig (Map NamedComponent (Map FilePath FileCacheInfo)) -- | all files used by this package [$sel:componentFiles:LocalPackage] :: LocalPackage -> !MemoizedWith EnvConfig (Map NamedComponent (Set (Path Abs File))) -- | 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 [$sel:tasks:Plan] :: Plan -> !Map PackageName Task -- | Final actions to be taken (test, benchmark, etc) [$sel:finals:Plan] :: Plan -> !Map PackageName Task -- | Text is reason we're unregistering, for display only [$sel:unregisterLocal:Plan] :: Plan -> !Map GhcPkgId (PackageIdentifier, Text) -- | Executables that should be installed after successful building [$sel:installExes:Plan] :: Plan -> !Map Text InstallLocation -- | Options for the FinalAction DoTests data TestOpts TestOpts :: !Bool -> ![String] -> !Bool -> !Bool -> !Maybe Int -> !Bool -> TestOpts -- | Whether successful tests will be run gain [$sel:rerunTests:TestOpts] :: TestOpts -> !Bool -- | Arguments passed to the test program [$sel:additionalArgs:TestOpts] :: TestOpts -> ![String] -- | Generate a code coverage report [$sel:coverage:TestOpts] :: TestOpts -> !Bool -- | Disable running of tests [$sel:disableRun:TestOpts] :: TestOpts -> !Bool -- | test suite timeout in seconds [$sel:maximumTimeSeconds:TestOpts] :: TestOpts -> !Maybe Int -- | Whether to allow standard input [$sel:allowStdin:TestOpts] :: TestOpts -> !Bool -- | Options for the FinalAction DoBenchmarks data BenchmarkOpts BenchmarkOpts :: !Maybe String -> !Bool -> BenchmarkOpts -- | Arguments passed to the benchmark program [$sel:additionalArgs:BenchmarkOpts] :: BenchmarkOpts -> !Maybe String -- | Disable running of benchmarks [$sel:disableRun:BenchmarkOpts] :: 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 -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> !Bool -> !TestOpts -> !Bool -> !BenchmarkOpts -> !Bool -> !CabalVerbosity -> !Bool -> ![Text] -> !Bool -> !ProgressBarFormat -> !Maybe Text -> BuildOpts [$sel:libProfile:BuildOpts] :: BuildOpts -> !Bool [$sel:exeProfile:BuildOpts] :: BuildOpts -> !Bool [$sel:libStrip:BuildOpts] :: BuildOpts -> !Bool [$sel:exeStrip:BuildOpts] :: BuildOpts -> !Bool -- | Build Haddock documentation? [$sel:buildHaddocks:BuildOpts] :: BuildOpts -> !Bool -- | Options to pass to haddock [$sel:haddockOpts:BuildOpts] :: BuildOpts -> !HaddockOpts -- | Open haddocks in the browser? [$sel:openHaddocks:BuildOpts] :: BuildOpts -> !Bool -- | Build haddocks for dependencies? [$sel:haddockDeps:BuildOpts] :: BuildOpts -> !Maybe Bool -- | Build haddocks for all symbols and packages, like cabal haddock -- --internal [$sel:haddockInternal:BuildOpts] :: BuildOpts -> !Bool -- | Build hyperlinked source. Disable for no sources. [$sel:haddockHyperlinkSource:BuildOpts] :: BuildOpts -> !Bool -- | Build with flags to generate Haddock documentation suitable to upload -- to Hackage. [$sel:haddockForHackage:BuildOpts] :: BuildOpts -> !Bool -- | Install executables to user path after building? [$sel:installExes:BuildOpts] :: BuildOpts -> !Bool -- | Install executables to compiler tools path after building? [$sel:installCompilerTool:BuildOpts] :: BuildOpts -> !Bool -- | Fetch all packages immediately ^ Watch files for changes and -- automatically rebuild [$sel:preFetch:BuildOpts] :: BuildOpts -> !Bool -- | Keep building/running after failure [$sel:keepGoing:BuildOpts] :: BuildOpts -> !Maybe Bool -- | Keep intermediate files and build directories [$sel:keepTmpFiles:BuildOpts] :: BuildOpts -> !Bool -- | Force treating all local packages as having dirty files [$sel:forceDirty:BuildOpts] :: BuildOpts -> !Bool -- | Turn on tests for local targets [$sel:tests:BuildOpts] :: BuildOpts -> !Bool -- | Additional test arguments [$sel:testOpts:BuildOpts] :: BuildOpts -> !TestOpts -- | Turn on benchmarks for local targets [$sel:benchmarks:BuildOpts] :: BuildOpts -> !Bool -- | Additional test arguments ^ Commands (with arguments) to run after a -- successful build ^ Only perform the configure step when building [$sel:benchmarkOpts:BuildOpts] :: BuildOpts -> !BenchmarkOpts -- | Perform the configure step even if already configured [$sel:reconfigure:BuildOpts] :: BuildOpts -> !Bool -- | Ask Cabal to be verbose in its builds [$sel:cabalVerbose:BuildOpts] :: BuildOpts -> !CabalVerbosity -- | Whether to enable split-objs. [$sel:splitObjs:BuildOpts] :: BuildOpts -> !Bool -- | Which components to skip when building [$sel:skipComponents:BuildOpts] :: BuildOpts -> ![Text] -- | Should we use the interleaved GHC output when building multiple -- packages? [$sel:interleavedOutput:BuildOpts] :: BuildOpts -> !Bool -- | Format of the progress bar [$sel:progressBar:BuildOpts] :: BuildOpts -> !ProgressBarFormat [$sel:ddumpDir:BuildOpts] :: BuildOpts -> !Maybe Text -- | 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 -- | Refuse to build anything in the snapshot database, see -- https://github.com/commercialhaskell/stack/issues/5272 BSOnlyLocals :: BuildSubset defaultBuildOpts :: BuildOpts -- | Type representing different types of task, depending on what is to be -- built. data TaskType -- | Building local source code. TTLocalMutable :: LocalPackage -> TaskType -- | Building something from the package index (upstream). TTRemotePackage :: IsMutable -> Package -> PackageLocationImmutable -> TaskType installLocationIsMutable :: InstallLocation -> IsMutable -- | 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 [$sel:missing:TaskConfigOpts] :: TaskConfigOpts -> !Set PackageIdentifier -- | Produce the list of options given the missing GhcPkgIds [$sel:opts:TaskConfigOpts] :: 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. [$sel:times:BuildCache] :: BuildCache -> Map FilePath FileCacheInfo -- | Stored on disk to know whether the flags have changed. data ConfigCache ConfigCache :: !ConfigureOpts -> !Set GhcPkgId -> !Set ByteString -> !Bool -> !CachePkgSrc -> !Text -> ConfigCache -- | All Cabal configure options used for this package. [$sel:configureOpts:ConfigCache] :: 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. [$sel:deps:ConfigCache] :: 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. [$sel:components:ConfigCache] :: ConfigCache -> !Set ByteString -- | Are haddocks to be built? [$sel:buildHaddocks:ConfigCache] :: ConfigCache -> !Bool [$sel:pkgSrc:ConfigCache] :: ConfigCache -> !CachePkgSrc -- | Value of the PATH env var, see -- https://github.com/commercialhaskell/stack/issues/3138 [$sel:pathEnvVar:ConfigCache] :: ConfigCache -> !Text -- | Render a BaseConfigOpts to an actual list of options configureOpts :: EnvConfig -> BaseConfigOpts -> Map PackageIdentifier GhcPkgId -> Bool -> IsMutable -> Package -> ConfigureOpts data CachePkgSrc CacheSrcUpstream :: CachePkgSrc CacheSrcLocal :: FilePath -> CachePkgSrc toCachePkgSrc :: PackageSource -> CachePkgSrc newtype FileCacheInfo FileCacheInfo :: SHA256 -> FileCacheInfo [$sel:hash:FileCacheInfo] :: FileCacheInfo -> SHA256 -- | Information on a compiled package: the library .conf file (if -- relevant), the sub-libraries (if present) and all of the executable -- paths. data PrecompiledCache base PrecompiledCache :: !Maybe (Path base File) -> ![Path base File] -> ![Path base File] -> PrecompiledCache base -- | .conf file inside the package database [$sel:library:PrecompiledCache] :: PrecompiledCache base -> !Maybe (Path base File) -- | .conf file inside the package database, for each of the sub-libraries [$sel:subLibs:PrecompiledCache] :: PrecompiledCache base -> ![Path base File] -- | Full paths to executables [$sel:exes:PrecompiledCache] :: PrecompiledCache base -> ![Path base File] data ExcludeTHLoading ExcludeTHLoading :: ExcludeTHLoading KeepTHLoading :: ExcludeTHLoading data ConvertPathsToAbsolute ConvertPathsToAbsolute :: ConvertPathsToAbsolute KeepPathsAsIs :: ConvertPathsToAbsolute -- | special marker for expected failures in curator builds, using those we -- need to keep log handle open as build continues further even after a -- failure data KeepOutputOpen KeepOpen :: KeepOutputOpen CloseOnException :: KeepOutputOpen instance GHC.Show.Show Stack.Types.Build.PkgDepsOracle instance Control.DeepSeq.NFData Stack.Types.Build.PkgDepsOracle instance GHC.Classes.Eq Stack.Types.Build.PkgDepsOracle instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Build.BuildCache instance GHC.Show.Show Stack.Types.Build.BuildCache instance GHC.Generics.Generic Stack.Types.Build.BuildCache instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Build.BuildCache instance GHC.Classes.Eq Stack.Types.Build.BuildCache instance GHC.Show.Show Stack.Types.Build.CachePkgSrc instance GHC.Read.Read Stack.Types.Build.CachePkgSrc instance GHC.Generics.Generic Stack.Types.Build.CachePkgSrc instance GHC.Classes.Eq Stack.Types.Build.CachePkgSrc instance Data.Data.Data Stack.Types.Build.CachePkgSrc instance GHC.Show.Show Stack.Types.Build.ConfigCache instance GHC.Generics.Generic Stack.Types.Build.ConfigCache instance GHC.Classes.Eq Stack.Types.Build.ConfigCache instance Data.Data.Data Stack.Types.Build.ConfigCache instance GHC.Show.Show Stack.Types.Build.TaskType instance GHC.Show.Show Stack.Types.Build.Task instance GHC.Show.Show Stack.Types.Build.Plan instance GHC.Show.Show (Stack.Types.Build.PrecompiledCache base) instance GHC.Generics.Generic (Stack.Types.Build.PrecompiledCache base) instance GHC.Classes.Eq (Stack.Types.Build.PrecompiledCache base) instance GHC.Classes.Eq Stack.Types.Build.KeepOutputOpen instance Control.DeepSeq.NFData (Stack.Types.Build.PrecompiledCache Path.Windows.Abs) instance Control.DeepSeq.NFData (Stack.Types.Build.PrecompiledCache Path.Windows.Rel) instance GHC.Show.Show Stack.Types.Build.TaskConfigOpts instance Control.DeepSeq.NFData Stack.Types.Build.ConfigCache instance Control.DeepSeq.NFData Stack.Types.Build.CachePkgSrc instance Database.Persist.Class.PersistField.PersistField Stack.Types.Build.CachePkgSrc instance Database.Persist.Sql.Class.PersistFieldSql Stack.Types.Build.CachePkgSrc instance Control.DeepSeq.NFData Stack.Types.Build.BuildCache -- | Work with SQLite database used for caches across an entire user -- account. module Stack.Storage.User -- | Initialize the database. initUserStorage :: HasLogFunc env => Path Abs File -> (UserStorage -> RIO env a) -> RIO env a -- | Key used to retrieve the precompiled cache type PrecompiledCacheKey = Unique PrecompiledCacheParent -- | Build key used to retrieve the precompiled cache precompiledCacheKey :: Path Rel Dir -> ActualCompiler -> Version -> Text -> ByteString -> Bool -> PrecompiledCacheKey -- | Load PrecompiledCache from the database. loadPrecompiledCache :: (HasConfig env, HasLogFunc env) => PrecompiledCacheKey -> RIO env (Maybe (PrecompiledCache Rel)) -- | Insert or update PrecompiledCache to the database. savePrecompiledCache :: (HasConfig env, HasLogFunc env) => PrecompiledCacheKey -> PrecompiledCache Rel -> RIO env () -- | Get the record of whether an executable is compatible with a Docker -- image loadDockerImageExeCache :: (HasConfig env, HasLogFunc env) => Text -> Path Abs File -> UTCTime -> RIO env (Maybe Bool) -- | Sets the record of whether an executable is compatible with a Docker -- image saveDockerImageExeCache :: (HasConfig env, HasLogFunc env) => Text -> Path Abs File -> UTCTime -> Bool -> RIO env () -- | Load compiler information, if available, and confirm that the -- referenced files are unchanged. May throw exceptions! loadCompilerPaths :: HasConfig env => Path Abs File -> CompilerBuild -> Bool -> RIO env (Maybe CompilerPaths) -- | Save compiler information. May throw exceptions! saveCompilerPaths :: HasConfig env => CompilerPaths -> RIO env () -- | How many upgrade checks have occurred since the given timestamp? upgradeChecksSince :: HasConfig env => UTCTime -> RIO env Int -- | Log in the database that an upgrade check occurred at the given time. logUpgradeCheck :: HasConfig env => UTCTime -> RIO env () instance GHC.Show.Show Stack.Storage.User.PrecompiledCacheParent instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance GHC.Show.Show Stack.Storage.User.PrecompiledCacheSubLib instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance GHC.Show.Show Stack.Storage.User.PrecompiledCacheExe instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance GHC.Show.Show Stack.Storage.User.DockerImageExeCache instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.User.LastPerformed instance Database.Persist.Class.PersistField.PersistField Stack.Storage.User.LastPerformed instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.User.LastPerformed instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.User.LastPerformed instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.User.LastPerformed instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.User.LastPerformed instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.User.LastPerformed (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.LastPerformed) instance Database.Persist.Class.PersistEntity.SymbolToField "action" Stack.Storage.User.LastPerformed Stack.Types.Cache.Action instance Database.Persist.Class.PersistEntity.SymbolToField "timestamp" Stack.Storage.User.LastPerformed Data.Time.Clock.Internal.UTCTime.UTCTime instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.User.LastPerformed instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.User.CompilerCache instance Database.Persist.Class.PersistField.PersistField Stack.Storage.User.CompilerCache instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.User.CompilerCache instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.User.CompilerCache instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.User.CompilerCache instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.User.CompilerCache instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.User.CompilerCache (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.CompilerCache) instance Database.Persist.Class.PersistEntity.SymbolToField "actualVersion" Stack.Storage.User.CompilerCache Stack.Types.Compiler.ActualCompiler instance Database.Persist.Class.PersistEntity.SymbolToField "arch" Stack.Storage.User.CompilerCache Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "ghcPath" Stack.Storage.User.CompilerCache GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "ghcSize" Stack.Storage.User.CompilerCache GHC.Int.Int64 instance Database.Persist.Class.PersistEntity.SymbolToField "ghcModified" Stack.Storage.User.CompilerCache GHC.Int.Int64 instance Database.Persist.Class.PersistEntity.SymbolToField "ghcPkgPath" Stack.Storage.User.CompilerCache GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "runghcPath" Stack.Storage.User.CompilerCache GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "haddockPath" Stack.Storage.User.CompilerCache GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "cabalVersion" Stack.Storage.User.CompilerCache Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "globalDb" Stack.Storage.User.CompilerCache GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "globalDbCacheSize" Stack.Storage.User.CompilerCache GHC.Int.Int64 instance Database.Persist.Class.PersistEntity.SymbolToField "globalDbCacheModified" Stack.Storage.User.CompilerCache GHC.Int.Int64 instance Database.Persist.Class.PersistEntity.SymbolToField "info" Stack.Storage.User.CompilerCache Data.ByteString.Internal.Type.ByteString instance Database.Persist.Class.PersistEntity.SymbolToField "globalDump" Stack.Storage.User.CompilerCache Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.User.CompilerCache instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.User.DockerImageExeCache instance Database.Persist.Class.PersistField.PersistField Stack.Storage.User.DockerImageExeCache instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.User.DockerImageExeCache instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.User.DockerImageExeCache instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.User.DockerImageExeCache instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.User.DockerImageExeCache instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.User.DockerImageExeCache (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.DockerImageExeCache) instance Database.Persist.Class.PersistEntity.SymbolToField "imageHash" Stack.Storage.User.DockerImageExeCache Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "exePath" Stack.Storage.User.DockerImageExeCache GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "exeTimestamp" Stack.Storage.User.DockerImageExeCache Data.Time.Clock.Internal.UTCTime.UTCTime instance Database.Persist.Class.PersistEntity.SymbolToField "compatible" Stack.Storage.User.DockerImageExeCache GHC.Types.Bool instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.User.DockerImageExeCache instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Class.PersistField.PersistField Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.User.PrecompiledCacheExe (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheExe) instance Database.Persist.Class.PersistEntity.SymbolToField "parent" Stack.Storage.User.PrecompiledCacheExe Stack.Storage.User.PrecompiledCacheParentId instance Database.Persist.Class.PersistEntity.SymbolToField "value" Stack.Storage.User.PrecompiledCacheExe GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.User.PrecompiledCacheExe instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Class.PersistField.PersistField Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.User.PrecompiledCacheSubLib (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheSubLib) instance Database.Persist.Class.PersistEntity.SymbolToField "parent" Stack.Storage.User.PrecompiledCacheSubLib Stack.Storage.User.PrecompiledCacheParentId instance Database.Persist.Class.PersistEntity.SymbolToField "value" Stack.Storage.User.PrecompiledCacheSubLib GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.User.PrecompiledCacheSubLib instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.User.PrecompiledCacheParent instance Database.Persist.Class.PersistField.PersistField Stack.Storage.User.PrecompiledCacheParent instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.User.PrecompiledCacheParent instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.User.PrecompiledCacheParent instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.User.PrecompiledCacheParent instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.User.PrecompiledCacheParent instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.User.PrecompiledCacheParent (Database.Persist.Class.PersistEntity.Key Stack.Storage.User.PrecompiledCacheParent) instance Database.Persist.Class.PersistEntity.SymbolToField "platformGhcDir" Stack.Storage.User.PrecompiledCacheParent GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "compiler" Stack.Storage.User.PrecompiledCacheParent Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "cabalVersion" Stack.Storage.User.PrecompiledCacheParent Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "packageKey" Stack.Storage.User.PrecompiledCacheParent Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "optionsHash" Stack.Storage.User.PrecompiledCacheParent Data.ByteString.Internal.Type.ByteString instance Database.Persist.Class.PersistEntity.SymbolToField "haddock" Stack.Storage.User.PrecompiledCacheParent GHC.Types.Bool instance Database.Persist.Class.PersistEntity.SymbolToField "library" Stack.Storage.User.PrecompiledCacheParent (GHC.Maybe.Maybe GHC.IO.FilePath) instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.User.PrecompiledCacheParent instance GHC.Show.Show Stack.Storage.User.StorageUserException instance GHC.Exception.Type.Exception Stack.Storage.User.StorageUserException -- | Work with SQLite database used for caches across a single project. module Stack.Storage.Project -- | Initialize the database. initProjectStorage :: HasLogFunc env => Path Abs File -> (ProjectStorage -> RIO env a) -> RIO env a -- | Key used to retrieve configuration or flag cache type ConfigCacheKey = Unique ConfigCacheParent -- | Build key used to retrieve configuration or flag cache configCacheKey :: Path Abs Dir -> ConfigCacheType -> ConfigCacheKey -- | Load ConfigCache from the database. loadConfigCache :: (HasBuildConfig env, HasLogFunc env) => ConfigCacheKey -> RIO env (Maybe ConfigCache) -- | Insert or update ConfigCache to the database. saveConfigCache :: (HasBuildConfig env, HasLogFunc env) => ConfigCacheKey -> ConfigCache -> RIO env () -- | Mark ConfigCache as inactive in the database. We use a flag -- instead of deleting the records since, in most cases, the same cache -- will be written again within in a few seconds (after `cabal -- configure`), so this avoids unnecessary database churn. deactiveConfigCache :: HasBuildConfig env => ConfigCacheKey -> RIO env () instance GHC.Show.Show Stack.Storage.Project.ConfigCacheParent instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance GHC.Show.Show Stack.Storage.Project.ConfigCacheDirOption instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance GHC.Show.Show Stack.Storage.Project.ConfigCacheNoDirOption instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance GHC.Show.Show Stack.Storage.Project.ConfigCacheDep instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance GHC.Show.Show Stack.Storage.Project.ConfigCacheComponent instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Class.PersistField.PersistField Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.Project.ConfigCacheComponent (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheComponent) instance Database.Persist.Class.PersistEntity.SymbolToField "parent" Stack.Storage.Project.ConfigCacheComponent Stack.Storage.Project.ConfigCacheParentId instance Database.Persist.Class.PersistEntity.SymbolToField "value" Stack.Storage.Project.ConfigCacheComponent Data.ByteString.Internal.Type.ByteString instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.Project.ConfigCacheComponent instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Class.PersistField.PersistField Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.Project.ConfigCacheDep (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDep) instance Database.Persist.Class.PersistEntity.SymbolToField "parent" Stack.Storage.Project.ConfigCacheDep Stack.Storage.Project.ConfigCacheParentId instance Database.Persist.Class.PersistEntity.SymbolToField "value" Stack.Storage.Project.ConfigCacheDep Stack.Types.GhcPkgId.GhcPkgId instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.Project.ConfigCacheDep instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Class.PersistField.PersistField Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.Project.ConfigCacheNoDirOption (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheNoDirOption) instance Database.Persist.Class.PersistEntity.SymbolToField "parent" Stack.Storage.Project.ConfigCacheNoDirOption Stack.Storage.Project.ConfigCacheParentId instance Database.Persist.Class.PersistEntity.SymbolToField "index" Stack.Storage.Project.ConfigCacheNoDirOption GHC.Types.Int instance Database.Persist.Class.PersistEntity.SymbolToField "value" Stack.Storage.Project.ConfigCacheNoDirOption GHC.Base.String instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.Project.ConfigCacheNoDirOption instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Class.PersistField.PersistField Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.Project.ConfigCacheDirOption (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheDirOption) instance Database.Persist.Class.PersistEntity.SymbolToField "parent" Stack.Storage.Project.ConfigCacheDirOption Stack.Storage.Project.ConfigCacheParentId instance Database.Persist.Class.PersistEntity.SymbolToField "index" Stack.Storage.Project.ConfigCacheDirOption GHC.Types.Int instance Database.Persist.Class.PersistEntity.SymbolToField "value" Stack.Storage.Project.ConfigCacheDirOption GHC.Base.String instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.Project.ConfigCacheDirOption instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Storage.Project.ConfigCacheParent instance Database.Persist.Class.PersistField.PersistField Stack.Storage.Project.ConfigCacheParent instance Database.Persist.Sql.Class.PersistFieldSql Stack.Storage.Project.ConfigCacheParent instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.SqlBackend.Internal.SqlBackend Stack.Storage.Project.ConfigCacheParent instance Database.Persist.Class.PersistUnique.OnlyOneUniqueKey Stack.Storage.Project.ConfigCacheParent instance Database.Persist.Class.PersistUnique.AtLeastOneUniqueKey Stack.Storage.Project.ConfigCacheParent instance Database.Persist.Class.PersistEntity.SymbolToField "id" Stack.Storage.Project.ConfigCacheParent (Database.Persist.Class.PersistEntity.Key Stack.Storage.Project.ConfigCacheParent) instance Database.Persist.Class.PersistEntity.SymbolToField "directory" Stack.Storage.Project.ConfigCacheParent GHC.IO.FilePath instance Database.Persist.Class.PersistEntity.SymbolToField "type" Stack.Storage.Project.ConfigCacheParent Stack.Types.Cache.ConfigCacheType instance Database.Persist.Class.PersistEntity.SymbolToField "pkgSrc" Stack.Storage.Project.ConfigCacheParent Stack.Types.Build.CachePkgSrc instance Database.Persist.Class.PersistEntity.SymbolToField "active" Stack.Storage.Project.ConfigCacheParent GHC.Types.Bool instance Database.Persist.Class.PersistEntity.SymbolToField "pathEnvVar" Stack.Storage.Project.ConfigCacheParent Data.Text.Internal.Text instance Database.Persist.Class.PersistEntity.SymbolToField "haddock" Stack.Storage.Project.ConfigCacheParent GHC.Types.Bool instance Database.Persist.Class.PersistEntity.SafeToInsert Stack.Storage.Project.ConfigCacheParent module Stack.Types.Build.Exception -- | Type representing exceptions thrown by functions exported by modules -- with names beginning Stack.Build. data BuildException Couldn'tFindPkgId :: PackageName -> BuildException Couldn'tParseTargets :: [Text] -> BuildException UnknownTargets :: Set PackageName -> Map PackageName Version -> Path Abs File -> BuildException TestSuiteFailure :: PackageIdentifier -> Map Text (Maybe ExitCode) -> Maybe (Path Abs File) -> ByteString -> BuildException TestSuiteTypeUnsupported :: TestSuiteInterface -> BuildException LocalPackageDoesn'tMatchTarget :: PackageName -> Version -> Version -> BuildException NoSetupHsFound :: Path Abs Dir -> BuildException InvalidGhcOptionsSpecification :: [PackageName] -> BuildException TestSuiteExeMissing :: Bool -> String -> String -> String -> BuildException CabalCopyFailed :: Bool -> String -> BuildException LocalPackagesPresent :: [PackageIdentifier] -> BuildException CouldNotLockDistDir :: !Path Abs File -> BuildException TaskCycleBug :: PackageIdentifier -> BuildException PackageIdMissingBug :: PackageIdentifier -> BuildException AllInOneBuildBug :: BuildException MultipleResultsBug :: PackageName -> [DumpPackage] -> BuildException TemplateHaskellNotFoundBug :: BuildException HaddockIndexNotFound :: BuildException ShowBuildErrorBug :: BuildException CallStackEmptyBug :: BuildException data BuildPrettyException ConstructPlanFailed :: [ConstructPlanException] -> Path Abs File -> Path Abs Dir -> Bool -> ParentMap -> Set PackageName -> Map PackageName [PackageName] -> BuildPrettyException ExecutionFailure :: [SomeException] -> BuildPrettyException CabalExitedUnsuccessfully :: ExitCode -> PackageIdentifier -> Path Abs File -> [String] -> Maybe (Path Abs File) -> [Text] -> BuildPrettyException SetupHsBuildFailure :: ExitCode -> Maybe PackageIdentifier -> Path Abs File -> [String] -> Maybe (Path Abs File) -> [Text] -> BuildPrettyException TargetParseException :: [StyleDoc] -> BuildPrettyException SomeTargetsNotBuildable :: [(PackageName, NamedComponent)] -> BuildPrettyException InvalidFlagSpecification :: Set UnusedFlags -> BuildPrettyException GHCProfOptionInvalid :: BuildPrettyException NotOnlyLocal :: [PackageName] -> [Text] -> BuildPrettyException CompilerVersionMismatch :: Maybe (ActualCompiler, Arch) -> (WantedCompiler, Arch) -> GHCVariant -> CompilerBuild -> VersionCheck -> Maybe (Path Abs File) -> StyleDoc -> BuildPrettyException -- | Helper function to pretty print an error message for target parse -- errors. pprintTargetParseErrors :: [StyleDoc] -> StyleDoc data ConstructPlanException DependencyCycleDetected :: [PackageName] -> ConstructPlanException DependencyPlanFailures :: Package -> Map PackageName (VersionRange, LatestApplicableVersion, BadDependency) -> ConstructPlanException -- | Recommend adding to extra-deps, give a helpful version number? UnknownPackage :: PackageName -> ConstructPlanException -- | The latest applicable version and it's latest Cabal file revision. For -- display purposes only, Nothing if package not found type LatestApplicableVersion = Maybe (Version, BlobKey) -- | Reason why a dependency was not used data BadDependency NotInBuildPlan :: BadDependency Couldn'tResolveItsDependencies :: Version -> BadDependency DependencyMismatch :: Version -> BadDependency -- | See description of DepType HasNoLibrary :: BadDependency BDDependencyCycleDetected :: ![PackageName] -> BadDependency instance GHC.Show.Show Stack.Types.Build.Exception.BuildException instance GHC.Show.Show Stack.Types.Build.Exception.BadDependency instance GHC.Classes.Ord Stack.Types.Build.Exception.BadDependency instance GHC.Classes.Eq Stack.Types.Build.Exception.BadDependency instance GHC.Show.Show Stack.Types.Build.Exception.ConstructPlanException instance GHC.Classes.Eq Stack.Types.Build.Exception.ConstructPlanException instance GHC.Show.Show Stack.Types.Build.Exception.BuildPrettyException instance GHC.Show.Show Stack.Types.Build.Exception.DepsPath instance GHC.Classes.Ord Stack.Types.Build.Exception.DepsPath instance GHC.Classes.Eq Stack.Types.Build.Exception.DepsPath instance Text.PrettyPrint.Leijen.Extended.Pretty Stack.Types.Build.Exception.BuildPrettyException instance GHC.Exception.Type.Exception Stack.Types.Build.Exception.BuildPrettyException instance GHC.Exception.Type.Exception Stack.Types.Build.Exception.BuildException module Stack.Setup.Installed getCompilerVersion :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> Path Abs File -> RIO env ActualCompiler 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. ghc-git-COMMIT_ID-FLAVOUR ToolGhcGit :: !Text -> !Text -> Tool toolString :: Tool -> String toolNameString :: Tool -> String parseToolText :: Text -> Maybe Tool filterTools :: PackageName -> (Version -> Bool) -> [Tool] -> [PackageIdentifier] -- | Binary directories for the given installed package toolExtraDirs :: 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.Classes.Eq Stack.Setup.Installed.Tool instance GHC.Classes.Ord Stack.Setup.Installed.Tool module Stack.Constants.Config -- | The directory containing the files used for dirtiness check of source -- files. buildCachesDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs Dir) -- | The filename used for modification check of a Cabal file. configCabalMod :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs File) -- | The filename used for the project root from the last build of a -- package. configPackageProjectRoot :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs File) -- | The filename used for modification check of setup-config. configSetupConfigMod :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs File) -- | Package's build artifacts directory. distDirFromDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs Dir) -- | Relative location of build artifacts. distRelativeDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => m (Path Rel Dir) -- | GHCi files directory. ghciDirL :: HasBuildConfig env => Getting r env (Path Abs Dir) -- | Directory for HPC work. hpcDirFromDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs Dir) -- | Relative location of directory for HPC work. hpcRelativeDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => m (Path Rel Dir) -- | Image staging dir from project root. imageStagingDir :: (HasConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> Int -> m (Path Abs Dir) -- | Output .o/.hi directory. objectInterfaceDirL :: HasBuildConfig env => Getting r env (Path Abs Dir) -- | Docker sandbox from project root. projectDockerSandboxDir :: (HasConfig env, MonadReader env m) => Path Abs Dir -> m (Path Abs Dir) -- | The directory containing all dist directories, including all different -- platform/compiler combinations. rootDistDirFromDir :: (HasConfig env, MonadReader env m) => Path Abs Dir -> m (Path Abs Dir) -- | Package's setup-config storing Cabal configuration. setupConfigFromDir :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs File) -- | Directory for project templates. templatesDir :: Config -> Path Abs Dir -- | The filename used to mark tests as having built. testBuiltFile :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs File) -- | The filename used to mark tests as having succeeded. testSuccessFile :: (HasEnvConfig env, MonadReader env m, MonadThrow m) => Path Abs Dir -> m (Path Abs File) -- | Package's working directory. workDirFromDir :: (HasConfig env, MonadReader env m) => Path Abs Dir -> m (Path Abs Dir) -- | Nix configuration module Stack.Config.Nix nixCompiler :: WantedCompiler -> Either ConfigNixException Text nixCompilerVersion :: WantedCompiler -> Either ConfigNixException Text -- | Interprets NixOptsMonoid options. nixOptsFromMonoid :: (HasRunner env, HasTerm env) => NixOptsMonoid -> OS -> RIO env NixOpts instance GHC.Show.Show Stack.Config.Nix.ConfigNixException instance GHC.Exception.Type.Exception Stack.Config.Nix.ConfigNixException module Stack.Config.ConfigureScript ensureConfigureScript :: (HasProcessContext env, HasTerm env) => Path b Dir -> RIO env () -- | A module which exports all component-level file-gathering logic. It -- also includes utility functions for handling paths and directories. module Stack.ComponentFile resolveOrWarn :: Text -> (Path Abs Dir -> String -> RIO GetPackageFileContext (Maybe a)) -> FilePath -> RIO GetPackageFileContext (Maybe a) -- | The directory where generated files are put like .o or .hs (from .x -- files). componentOutputDir :: NamedComponent -> Path Abs Dir -> Path Abs Dir -- | See componentBuildDir componentBuildDir :: Version -> NamedComponent -> Path Abs Dir -> Path Abs Dir -- | Make the global autogen dir if Cabal version is new enough. packageAutogenDir :: Version -> Path Abs Dir -> Maybe (Path Abs Dir) -- | Make the build dir. Note that Cabal >= 2.0 uses the -- componentBuildDir above for some things. buildDir :: Path Abs Dir -> Path Abs Dir -- | Make the autogen dir. componentAutogenDir :: Version -> NamedComponent -> Path Abs Dir -> Path Abs Dir data ComponentFile ComponentFile :: !Map ModuleName (Path Abs File) -> ![DotCabalPath] -> ![PackageWarning] -> ComponentFile [moduleFileMap] :: ComponentFile -> !Map ModuleName (Path Abs File) [otherFile] :: ComponentFile -> ![DotCabalPath] [packageWarning] :: ComponentFile -> ![PackageWarning] -- | Get all files referenced by the library. Handle all libraries (CLib -- and SubLib), based on empty name or not. stackLibraryFiles :: StackLibrary -> RIO GetPackageFileContext (NamedComponent, ComponentFile) -- | Get all files referenced by the executable. stackExecutableFiles :: StackExecutable -> RIO GetPackageFileContext (NamedComponent, ComponentFile) -- | Get all files referenced by the test. stackTestSuiteFiles :: StackTestSuite -> RIO GetPackageFileContext (NamedComponent, ComponentFile) -- | Get all files referenced by the benchmark. stackBenchmarkFiles :: StackBenchmark -> RIO GetPackageFileContext (NamedComponent, ComponentFile) -- | A module which exports all package-level file-gathering logic. module Stack.PackageFile -- | Gets all of the modules, files, build files, and data files that -- constitute the package. This is primarily used for dirtiness checking -- during build, as well as use by "stack ghci" getPackageFile :: (HasEnvConfig s, MonadReader s m, MonadThrow m, MonadUnliftIO m) => Package -> Path Abs File -> m PackageComponentFile stackPackageFileFromCabal :: PackageDescription -> StackPackageFile -- | Dealing with Cabal. module Stack.Package -- | Read package.buildinfo 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 Package, which contains all -- of the info needed for Stack to build the Package given the -- current configuration. resolvePackage :: PackageConfig -> GenericPackageDescription -> Package packageFromPackageDescription :: PackageConfig -> [PackageFlag] -> PackageDescription -> Package -- | Some package info. data Package Package :: !PackageName -> !Version -> !Either License License -> ![Text] -> ![Text] -> !Map FlagName Bool -> !Map FlagName Bool -> !Maybe StackLibrary -> !CompCollection StackLibrary -> !CompCollection StackForeignLibrary -> !CompCollection StackTestSuite -> !CompCollection StackBenchmark -> !CompCollection StackExecutable -> !BuildType -> !Maybe (Map PackageName DepValue) -> !CabalSpecVersion -> StackPackageFile -> Bool -> Bool -> Package -- | Name of the package. [$sel:name:Package] :: Package -> !PackageName -- | Version of the package [$sel:version:Package] :: Package -> !Version -- | The license the package was released under. [$sel:license:Package] :: Package -> !Either License License -- | Ghc options used on package. [$sel:ghcOptions:Package] :: Package -> ![Text] -- | Additional options passed to ./Setup.hs configure [$sel:cabalConfigOpts:Package] :: Package -> ![Text] -- | Flags used on package. [$sel:flags:Package] :: Package -> !Map FlagName Bool -- | Defaults for unspecified flags. [$sel:defaultFlags:Package] :: Package -> !Map FlagName Bool -- | Does the package have a buildable main library stanza? [$sel:library:Package] :: Package -> !Maybe StackLibrary -- | The sub-libraries of the package. [$sel:subLibraries:Package] :: Package -> !CompCollection StackLibrary -- | The foreign libraries of the package. [$sel:foreignLibraries:Package] :: Package -> !CompCollection StackForeignLibrary -- | The test suites of the package. [$sel:testSuites:Package] :: Package -> !CompCollection StackTestSuite -- | The benchmarks of the package. [$sel:benchmarks:Package] :: Package -> !CompCollection StackBenchmark -- | The executables of the package. [$sel:executables:Package] :: Package -> !CompCollection StackExecutable -- | Package build-type. [$sel:buildType:Package] :: Package -> !BuildType -- | If present: custom-setup dependencies [$sel:setupDeps:Package] :: Package -> !Maybe (Map PackageName DepValue) -- | Cabal spec range [$sel:cabalSpec:Package] :: Package -> !CabalSpecVersion -- | The Cabal sourced files related to the package at the package level -- The components may have file information in their own types [$sel:file:Package] :: Package -> StackPackageFile -- | This is a requirement because when tests are not enabled, Stack's -- package dependencies should ignore test dependencies. Directly set -- from packageConfigEnableTests. [$sel:testEnabled:Package] :: Package -> Bool -- | This is a requirement because when benchmark are not enabled, Stack's -- package dependencies should ignore benchmark dependencies. Directly -- set from packageConfigEnableBenchmarks. [$sel:benchmarkEnabled:Package] :: Package -> Bool -- | Package build configuration data PackageConfig PackageConfig :: !Bool -> !Bool -> !Map FlagName Bool -> ![Text] -> ![Text] -> ActualCompiler -> !Platform -> PackageConfig -- | Are tests enabled? [$sel:enableTests:PackageConfig] :: PackageConfig -> !Bool -- | Are benchmarks enabled? [$sel:enableBenchmarks:PackageConfig] :: PackageConfig -> !Bool -- | Configured flags. [$sel:flags:PackageConfig] :: PackageConfig -> !Map FlagName Bool -- | Configured ghc options. [$sel:ghcOptions:PackageConfig] :: PackageConfig -> ![Text] -- | ./Setup.hs configure options [$sel:cabalConfigOpts:PackageConfig] :: PackageConfig -> ![Text] -- | GHC version [$sel:compilerVersion:PackageConfig] :: PackageConfig -> ActualCompiler -- | host platform [$sel:platform:PackageConfig] :: PackageConfig -> !Platform -- | Path for the package's build log. buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File) -- | Type representing exceptions thrown by functions exported by the -- Stack.Package module. data PackageException PackageInvalidCabalFile :: !Either PackageIdentifierRevision (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PackageException MismatchedCabalIdentifier :: !PackageIdentifierRevision -> !PackageIdentifier -> PackageException CabalFileNameParseFail :: FilePath -> PackageException CabalFileNameInvalidPackageName :: FilePath -> PackageException ComponentNotParsedBug :: String -> PackageException -- | Evaluates the conditions of a GenericPackageDescription, -- yielding a resolved PackageDescription. resolvePackageDescription :: PackageConfig -> GenericPackageDescription -> PackageDescription -- | Get all dependencies of the package (buildable targets only). packageDependencies :: PackageDescription -> Map PackageName VersionRange -- | Force a package to be treated as a custom build type, see -- https://github.com/commercialhaskell/stack/issues/4488 applyForceCustomBuild :: Version -> Package -> Package -- | Check if the package has a main library that is buildable. hasBuildableMainLibrary :: Package -> Bool -- | Check if the main library has any exposed modules. -- -- This should become irrelevant at some point since there's nothing -- inherently wrong or different with packages exposing only modules in -- internal libraries (for instance). mainLibraryHasExposedModules :: Package -> Bool -- | Aggregate all unknown tools from all components. Mostly meant for -- build tools specified in the legacy manner (build-tools:) that failed -- the hard-coded lookup. See unknownTools for more information. packageUnknownTools :: Package -> Set Text buildableForeignLibs :: Package -> Set Text buildableSubLibs :: Package -> Set Text buildableExes :: Package -> Set Text buildableTestSuites :: Package -> Set Text buildableBenchmarks :: Package -> Set Text -- | This is an action used to collect info needed for "stack ghci". This -- info isn't usually needed, so computation of it is deferred. getPackageOpts :: (HasEnvConfig env, MonadReader env m, MonadThrow m, MonadUnliftIO m) => Package -> InstallMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> m (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent [DotCabalPath], Map NamedComponent BuildInfoOpts) -- | Iterate/fold on all the package dependencies, components, setup deps -- and all. processPackageDepsToList :: Monad m => Package -> (PackageName -> DepValue -> m resT) -> m [resT] -- | List all package's dependencies in a "free" context through the -- identity monad. listOfPackageDeps :: Package -> [PackageName] -- | The set of package's dependencies. setOfPackageDeps :: Package -> Set PackageName -- | This implements a topological sort on all targeted components for the -- build and their dependencies. It's only targeting internal -- dependencies, so it's doing a topological sort on a subset of a -- package's components. -- -- Note that in Cabal they use the Data.Graph struct to pursue the same -- goal. But dong this here would require a large number intermediate -- data structure. This is needed because we need to get the right -- GhcPkgId of the relevant internal dependencies of a component before -- building it as a component. topSortPackageComponent :: Package -> Target -> Bool -> Seq NamedComponent -- | A module providing types and related helper functions used in module -- Stack.Build.ConstructPlan. module Stack.Types.Build.ConstructPlan -- | Type representing information about packages, namely information about -- whether or not a package is already installed and, unless the package -- is not to be built (global packages), where its source code is -- located. data PackageInfo -- | This indicates that the package is already installed, and that we -- shouldn't build it from source. This is only the case for global -- packages. PIOnlyInstalled :: InstallLocation -> Installed -> PackageInfo -- | This indicates that the package isn't installed, and we know where to -- find its source. PIOnlySource :: PackageSource -> PackageInfo -- | This indicates that the package is installed and we know where to find -- its source. We may want to reinstall from source. PIBoth :: PackageSource -> Installed -> PackageInfo -- | A type synonym representing dictionaries of package names, and -- combined information about the package in respect of whether or not it -- is already installed and, unless the package is not to be built -- (global packages), where its source code is located. type CombinedMap = Map PackageName PackageInfo -- | Type synonym representing values used during the construction of a -- build plan. The type is an instance of Monad, hence its name. type M = WriterT W (StateT (Map PackageName (Either ConstructPlanException AddDepRes)) (RIO Ctx)) -- | Type representing values used as the output to be collected during the -- construction of a build plan. data W W :: !Map PackageName (Either ConstructPlanException Task) -> !Map Text InstallLocation -> !Map PackageName Text -> ![StyleDoc] -> [StyleDoc] -> !ParentMap -> W -- | A dictionary of package names, and either a final task to perform when -- building the package or an exception. [wFinals] :: W -> !Map PackageName (Either ConstructPlanException Task) -- | A dictionary of executables to be installed, and location where the -- executable's binary is placed. [wInstall] :: W -> !Map Text InstallLocation -- | A dictionary of local packages, and the reason why the local package -- is considered dirty. [wDirty] :: W -> !Map PackageName Text -- | Warnings. [wWarnings] :: W -> ![StyleDoc] -> [StyleDoc] -- | A dictionary of package names, and a list of pairs of the identifier -- of a package depending on the package and the version range specified -- for the dependency by that package. Used in the reporting of failure -- to construct a build plan. [wParents] :: W -> !ParentMap -- | Type representing results of addDep. data AddDepRes -- | A task must be performed to provide the package name. ADRToInstall :: Task -> AddDepRes -- | An existing installation provides the package name. ADRFound :: InstallLocation -> Installed -> AddDepRes toTask :: AddDepRes -> Maybe Task adrVersion :: AddDepRes -> Version adrHasLibrary :: AddDepRes -> Bool -- | Type representing values used as the environment to be read from -- during the construction of a build plan (the 'context'). data Ctx Ctx :: !BaseConfigOpts -> !PackageLocationImmutable -> Map FlagName Bool -> [Text] -> [Text] -> M Package -> !CombinedMap -> !EnvConfig -> ![PackageName] -> !Set PackageName -> !Set PackageName -> !Maybe Curator -> !Text -> Ctx -- | Basic information used to determine configure options [baseConfigOpts] :: Ctx -> !BaseConfigOpts [loadPackage] :: Ctx -> !PackageLocationImmutable -> Map FlagName Bool -> [Text] -> [Text] -> M Package -- | A dictionary of package names, and combined information about the -- package in respect of whether or not it is already installed and, -- unless the package is not to be built (global packages), where its -- source code is located. [combinedMap] :: Ctx -> !CombinedMap -- | Configuration after the environment has been setup. [ctxEnvConfig] :: Ctx -> !EnvConfig [callStack] :: Ctx -> ![PackageName] [wanted] :: Ctx -> !Set PackageName [localNames] :: Ctx -> !Set PackageName [curator] :: Ctx -> !Maybe Curator [pathEnvVar] :: Ctx -> !Text -- | State to be maintained during the calculation of local packages to -- unregister. data UnregisterState UnregisterState :: !Map GhcPkgId (PackageIdentifier, Text) -> ![DumpPackage] -> !Bool -> UnregisterState [toUnregister] :: UnregisterState -> !Map GhcPkgId (PackageIdentifier, Text) [toKeep] :: UnregisterState -> ![DumpPackage] [anyAdded] :: UnregisterState -> !Bool -- | Warn about tools in the snapshot definition. States the tool name -- expected and the package name using it. data ToolWarning ToolWarning :: ExeName -> PackageName -> ToolWarning instance GHC.Show.Show Stack.Types.Build.ConstructPlan.PackageInfo instance GHC.Generics.Generic Stack.Types.Build.ConstructPlan.W instance GHC.Show.Show Stack.Types.Build.ConstructPlan.AddDepRes instance GHC.Show.Show Stack.Types.Build.ConstructPlan.ToolWarning instance Stack.Types.Platform.HasPlatform Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.GHCVariant.HasGHCVariant Stack.Types.Build.ConstructPlan.Ctx instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.Runner.HasRunner Stack.Types.Build.ConstructPlan.Ctx instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate Stack.Types.Build.ConstructPlan.Ctx instance RIO.PrettyPrint.HasTerm Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.Config.HasConfig Stack.Types.Build.ConstructPlan.Ctx instance Pantry.Types.HasPantryConfig Stack.Types.Build.ConstructPlan.Ctx instance RIO.Process.HasProcessContext Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.BuildConfig.HasBuildConfig Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.EnvConfig.HasSourceMap Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.CompilerPaths.HasCompiler Stack.Types.Build.ConstructPlan.Ctx instance Stack.Types.EnvConfig.HasEnvConfig Stack.Types.Build.ConstructPlan.Ctx instance GHC.Base.Semigroup Stack.Types.Build.ConstructPlan.W instance GHC.Base.Monoid Stack.Types.Build.ConstructPlan.W module Stack.BuildInfo versionString' :: String -- | Hpack version we're compiled against hpackVersion :: String -- | If 1 is enabled, the Git hash in the build directory, otherwise -- Nothing. maybeGitHash :: Maybe String -- | Generate haddocks module Stack.Build.Haddock -- | Generate Haddock index and contents for local packages and their -- dependencies. generateDepsHaddockIndex :: (HasCompiler env, HasProcessContext env, HasTerm env) => BaseConfigOpts -> Map GhcPkgId DumpPackage -> Map GhcPkgId DumpPackage -> Map GhcPkgId DumpPackage -> [LocalPackage] -> RIO env () -- | Generate Haddock index and contents for local packages. generateLocalHaddockIndex :: (HasCompiler env, HasProcessContext env, HasTerm env) => BaseConfigOpts -> Map GhcPkgId DumpPackage -> [LocalPackage] -> RIO env () -- | Generate Haddock index and contents for all snapshot packages. generateSnapHaddockIndex :: (HasCompiler env, HasProcessContext env, HasTerm env) => BaseConfigOpts -> Map GhcPkgId DumpPackage -> Map GhcPkgId DumpPackage -> RIO env () openHaddocksInBrowser :: HasTerm env => BaseConfigOpts -> Map PackageName (PackageIdentifier, InstallLocation) -> Set PackageName -> RIO env () -- | Determine whether to build haddocks for dependencies. shouldHaddockDeps :: BuildOpts -> Bool -- | Determine whether we should haddock for a package. shouldHaddockPackage :: BuildOpts -> Set PackageName -> PackageName -> Bool generateLocalHaddockForHackageArchives :: (HasEnvConfig env, HasTerm env) => [LocalPackage] -> RIO env () -- | 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 CTime) -- | Try to read the mod time of setup-config file from the last build tryGetSetupConfigMod :: HasEnvConfig env => Path Abs Dir -> RIO env (Maybe CTime) -- | Try to read the project root from the last build of a package tryGetPackageProjectRoot :: HasEnvConfig env => Path Abs Dir -> RIO env (Maybe ByteString) -- | Get all of the installed executables getInstalledExes :: HasEnvConfig env => InstallLocation -> RIO env [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 :: HasEnvConfig env => Path Abs Dir -> RIO env () -- | Mark the given executable as installed markExeInstalled :: HasEnvConfig env => InstallLocation -> PackageIdentifier -> RIO env () -- | Mark the given executable as not installed markExeNotInstalled :: HasEnvConfig env => InstallLocation -> PackageIdentifier -> RIO env () 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 tryGetCabalMod writeCabalMod :: HasEnvConfig env => Path Abs Dir -> CTime -> RIO env () -- | See tryGetSetupConfigMod writeSetupConfigMod :: HasEnvConfig env => Path Abs Dir -> Maybe CTime -> RIO env () -- | See tryGetPackageProjectRoot writePackageProjectRoot :: HasEnvConfig env => Path Abs Dir -> ByteString -> RIO env () -- | Status of a test suite data TestStatus TSSuccess :: TestStatus TSFailure :: TestStatus TSUnknown :: TestStatus -- | Mark test suite status setTestStatus :: HasEnvConfig env => Path Abs Dir -> TestStatus -> RIO env () -- | Check if the test suite already passed getTestStatus :: HasEnvConfig env => Path Abs Dir -> RIO env TestStatus -- | Write out information about a newly built package writePrecompiledCache :: HasEnvConfig env => BaseConfigOpts -> PackageLocationImmutable -> ConfigureOpts -> Bool -> Installed -> Set Text -> RIO env () -- | Check the cache for a precompiled package matching the given -- configuration. readPrecompiledCache :: forall env. HasEnvConfig env => PackageLocationImmutable -> ConfigureOpts -> Bool -> RIO env (Maybe (PrecompiledCache Abs)) -- | Stored on disk to know whether the files have changed. newtype BuildCache BuildCache :: Map FilePath FileCacheInfo -> BuildCache -- | Modification times of files. [$sel:times:BuildCache] :: BuildCache -> Map FilePath FileCacheInfo module GHC.Utils.GhcPkg.Main.Compat -- | Function equivalent to: -- --
-- ghc-pkg --no-user-package-db --package-db=<pkgDb> unregister [--ipid] <P> --ghcPkgUnregisterForce :: HasTerm env => Path Abs Dir -> Path Abs Dir -> Bool -> [String] -> RIO env () instance GHC.Show.Show GHC.Utils.GhcPkg.Main.Compat.GhcPkgPrettyException instance Text.PrettyPrint.Leijen.Extended.Pretty GHC.Utils.GhcPkg.Main.Compat.GhcPkgPrettyException instance GHC.Exception.Type.Exception GHC.Utils.GhcPkg.Main.Compat.GhcPkgPrettyException instance GHC.Show.Show GHC.Utils.GhcPkg.Main.Compat.PackageArg -- | Functions for the GHC package database. module Stack.GhcPkg -- | Create a package database in the given directory, if it doesn't exist. createDatabase :: (HasProcessContext env, HasTerm env) => GhcPkgExe -> Path Abs Dir -> RIO env () -- | Get the value of a field of the package. findGhcPkgField :: (HasProcessContext env, HasTerm env) => GhcPkgExe -> [Path Abs Dir] -> String -> Text -> RIO env (Maybe Text) -- | Get the global package database getGlobalDB :: (HasProcessContext env, HasTerm env) => GhcPkgExe -> RIO env (Path Abs Dir) -- | Run the ghc-pkg executable ghcPkg :: (HasProcessContext env, HasTerm env) => GhcPkgExe -> [Path Abs Dir] -> [String] -> RIO env (Either SomeException ByteString) -- | 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 -- | unregister list of package ghcids, batching available from GHC 8.2.1, -- see -- https://github.com/commercialhaskell/stack/issues/2662#issuecomment-460342402 -- using GHC package id where available (from GHC 7.9) -- -- The version of the ghc-pkg executable supplied with GHCs published -- before 28 August 2023 does not efficiently bulk unregister. Until an -- efficient ghc-pkg is available, this function no longer uses: -- --
-- eres <- ghcPkg pkgexe [pkgDb] args -- where -- args = "unregister" : "--user" : "--force" : -- map packageIdentifierString idents ++ -- if null gids then [] else "--ipid" : map ghcPkgIdString gids ---- -- but uses: -- --
-- globalDb <- view $ compilerPathsL.to cpGlobalDB -- eres <- tryAny $ liftIO $ -- ghcPkgUnregisterUserForce globalDb pkgDb hasIpid pkgarg_strs --unregisterGhcPkgIds :: (HasCompiler env, HasProcessContext env, HasTerm env) => Bool -> GhcPkgExe -> Path Abs Dir -> NonEmpty (Either PackageIdentifier GhcPkgId) -> RIO env () 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 () -- | Type representing dump information for a single package, as output by -- the ghc-pkg describe command. data DumpPackage DumpPackage :: !GhcPkgId -> !PackageIdentifier -> !Maybe SublibDump -> !Maybe License -> ![FilePath] -> ![Text] -> !Bool -> !Set ModuleName -> ![GhcPkgId] -> ![FilePath] -> !Maybe FilePath -> !Bool -> DumpPackage -- | The id field. [$sel:ghcPkgId:DumpPackage] :: DumpPackage -> !GhcPkgId -- | The name and version fields. The name field -- is the munged package name. If the package is not for a sub library, -- its munged name is its name. [$sel:packageIdent:DumpPackage] :: DumpPackage -> !PackageIdentifier -- | The sub library information if it's a sub-library. [$sel:sublib:DumpPackage] :: DumpPackage -> !Maybe SublibDump [$sel:license:DumpPackage] :: DumpPackage -> !Maybe License -- | The library-dirs field. [$sel:libDirs:DumpPackage] :: DumpPackage -> ![FilePath] -- | The hs-libraries field. [$sel:libraries:DumpPackage] :: DumpPackage -> ![Text] [$sel:hasExposedModules:DumpPackage] :: DumpPackage -> !Bool [$sel:exposedModules:DumpPackage] :: DumpPackage -> !Set ModuleName -- | The depends field (packages on which this package depends). [$sel:depends:DumpPackage] :: DumpPackage -> ![GhcPkgId] [$sel:haddockInterfaces:DumpPackage] :: DumpPackage -> ![FilePath] [$sel:haddockHtml:DumpPackage] :: DumpPackage -> !Maybe FilePath [$sel:isExposed:DumpPackage] :: DumpPackage -> !Bool -- | Convert a stream of bytes into a stream of DumpPackages conduitDumpPackage :: MonadThrow m => ConduitM Text DumpPackage m () -- | Call ghc-pkg dump with appropriate flags and stream to the -- given sink, using either the global package database or the given -- package databases. ghcPkgDump :: (HasProcessContext env, HasTerm env) => GhcPkgExe -> [Path Abs Dir] -> ConduitM Text Void (RIO env) a -> RIO env a -- | Call ghc-pkg describe with appropriate flags and stream to -- the given sink, using either the global package database or the given -- package databases. ghcPkgDescribe :: (HasCompiler env, HasProcessContext env, HasTerm env) => GhcPkgExe -> PackageName -> [Path Abs Dir] -> ConduitM Text Void (RIO env) a -> RIO env a -- | Find the package IDs matching the given constraints with all -- dependencies installed. Packages not mentioned in the provided -- Map are allowed to be present too. sinkMatching :: Monad m => Map PackageName Version -> ConduitM DumpPackage o m (Map PackageName DumpPackage) -- | Prune a list of possible packages down to those whose dependencies are -- met. -- --
-- #!/usr/bin/env stack ---- -- Additional arguments can be specified in a haskell comment following -- the #! line. The contents inside the comment must be a single -- valid stack command line, starting with stack as the command -- and followed by the options to use for executing this file. -- -- The comment must be on the line immediately following the #! -- 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: -- --
-- #!/usr/bin/env stack -- -- stack --resolver lts-3.14 --install-ghc runghc --package random ---- -- Here is an example of a multi line block comment: -- --
-- #!/usr/bin/env stack
-- {- stack
-- --resolver lts-3.14
-- --install-ghc
-- runghc
-- --package random
-- -}
--
--
-- When the #! line is not present, the file can still be
-- executed using stack <file name> 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 (NonEmpty String)
-- | The general Stack configuration that starts everything off. This
-- should be smart to fallback 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
-- | Load the configuration, using current directory, environment
-- variables, and defaults as necessary.
loadConfig :: (HasRunner env, HasTerm env) => (Config -> RIO env a) -> RIO env a
-- | Load and parse YAML from the given config file. Throws
-- ParseConfigFileException when there's a decoding error.
loadConfigYaml :: HasLogFunc env => (Value -> Parser (WithJSONWarnings a)) -> Path Abs File -> RIO env a
packagesParser :: Parser [String]
-- | 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 :: HasTerm env => Config -> RIO env (Path Abs Dir)
-- | Download the Snapshots value from stackage.org.
getSnapshots :: HasConfig env => RIO env Snapshots
-- | Turn an AbstractResolver into a Resolver.
makeConcreteResolver :: HasConfig env => AbstractResolver -> RIO env RawSnapshotLocation
-- | checkOwnership dir throws
-- UserDoesn'tOwnDirectory if dir isn't owned by the
-- current user.
--
-- If dir doesn't exist, its parent directory is checked
-- instead. If the parent directory doesn't exist either,
-- NoSuchDirectory (parent dir) is thrown.
checkOwnership :: MonadIO m => Path Abs Dir -> m ()
-- | True if we are currently running inside a Docker container.
getInContainer :: MonadIO m => m Bool
-- | True if we are currently running inside a Nix.
getInNixShell :: MonadIO m => m Bool
defaultConfigYaml :: (IsString s, Semigroup s) => s
-- | Get the location of the project config file, if it exists.
getProjectConfig :: HasTerm env => StackYamlLoc -> RIO env (ProjectConfig (Path Abs File))
-- | Load the build configuration, adds build-specific values to config
-- loaded by loadConfig. values.
withBuildConfig :: RIO BuildConfig a -> RIO Config a
-- | Runs the provided action with a new LogFunc, given a
-- StylesUpdate.
withNewLogFunc :: MonadUnliftIO m => GlobalOpts -> Bool -> StylesUpdate -> (LogFunc -> m a) -> m a
-- | Get the Stack root, e.g. ~/.stack, and determine whether the
-- user owns it.
--
-- On Windows, the second value is always True.
determineStackRootAndOwnership :: MonadIO m => ConfigMonoid -> m (Path Abs Dir, Path Abs Dir, Bool)
-- | Run commands in a nix-shell
module Stack.Nix
-- | Command-line argument for "nix"
nixCmdName :: String
nixHelpOptName :: String
runShellAndExit :: RIO Config void
instance GHC.Show.Show Stack.Nix.NixException
instance GHC.Exception.Type.Exception Stack.Nix.NixException
module Stack.Options.NixParser
nixOptsParser :: Bool -> Parser NixOptsMonoid
-- | Make changes to project or global configuration.
module Stack.ConfigCmd
data ConfigCmdSet
ConfigCmdSetSnapshot :: !Unresolved AbstractResolver -> ConfigCmdSet
ConfigCmdSetResolver :: !Unresolved AbstractResolver -> ConfigCmdSet
ConfigCmdSetSystemGhc :: !CommandScope -> !Bool -> ConfigCmdSet
ConfigCmdSetInstallGhc :: !CommandScope -> !Bool -> ConfigCmdSet
ConfigCmdSetDownloadPrefix :: !CommandScope -> !Text -> ConfigCmdSet
configCmdSetParser :: Parser ConfigCmdSet
cfgCmdSet :: (HasConfig env, HasGHCVariant env) => ConfigCmdSet -> RIO env ()
cfgCmdSetName :: String
configCmdEnvParser :: Parser EnvSettings
cfgCmdEnv :: EnvSettings -> RIO EnvConfig ()
cfgCmdEnvName :: String
cfgCmdName :: String
instance GHC.Show.Show Stack.ConfigCmd.ConfigCmdException
instance GHC.Show.Show Stack.ConfigCmd.KeyType
instance GHC.Classes.Eq Stack.ConfigCmd.KeyType
instance GHC.Show.Show Stack.ConfigCmd.EnvVarAction
instance GHC.Exception.Type.Exception Stack.ConfigCmd.ConfigCmdException
-- | Provides all the necessary types and functions for running cabal
-- Setup.hs commands. Only used in the Execute and
-- ExecutePackage modules
module Stack.Build.ExecuteEnv
data ExecuteEnv
ExecuteEnv :: !MVar () -> !BuildOpts -> !BuildOptsCLI -> !BaseConfigOpts -> !TVar (Map PackageIdentifier Installed) -> !Path Abs Dir -> !Path Abs File -> !Path Abs File -> !Maybe (Path Abs File) -> !Version -> !Int -> ![LocalPackage] -> !Path Abs Dir -> !Map GhcPkgId DumpPackage -> !TVar (Map GhcPkgId DumpPackage) -> !TVar (Map GhcPkgId DumpPackage) -> !TChan (Path Abs Dir, Path Abs File) -> !IORef (Set PackageName) -> !Maybe Int -> !Text -> ExecuteEnv
[$sel:installLock:ExecuteEnv] :: ExecuteEnv -> !MVar ()
[$sel:buildOpts:ExecuteEnv] :: ExecuteEnv -> !BuildOpts
[$sel:buildOptsCLI:ExecuteEnv] :: ExecuteEnv -> !BuildOptsCLI
[$sel:baseConfigOpts:ExecuteEnv] :: ExecuteEnv -> !BaseConfigOpts
[$sel:ghcPkgIds:ExecuteEnv] :: ExecuteEnv -> !TVar (Map PackageIdentifier Installed)
[$sel:tempDir:ExecuteEnv] :: ExecuteEnv -> !Path Abs Dir
-- | Temporary Setup.hs for simple builds
[$sel:setupHs:ExecuteEnv] :: ExecuteEnv -> !Path Abs File
-- | Temporary SetupShim.hs, to provide access to initial-build-steps
[$sel:setupShimHs:ExecuteEnv] :: ExecuteEnv -> !Path Abs File
-- | Compiled version of eeSetupHs
[$sel:setupExe:ExecuteEnv] :: ExecuteEnv -> !Maybe (Path Abs File)
[$sel:cabalPkgVer:ExecuteEnv] :: ExecuteEnv -> !Version
[$sel:totalWanted:ExecuteEnv] :: ExecuteEnv -> !Int
[$sel:locals:ExecuteEnv] :: ExecuteEnv -> ![LocalPackage]
[$sel:globalDB:ExecuteEnv] :: ExecuteEnv -> !Path Abs Dir
[$sel:globalDumpPkgs:ExecuteEnv] :: ExecuteEnv -> !Map GhcPkgId DumpPackage
[$sel:snapshotDumpPkgs:ExecuteEnv] :: ExecuteEnv -> !TVar (Map GhcPkgId DumpPackage)
[$sel:localDumpPkgs:ExecuteEnv] :: ExecuteEnv -> !TVar (Map GhcPkgId DumpPackage)
[$sel:logFiles:ExecuteEnv] :: ExecuteEnv -> !TChan (Path Abs Dir, Path Abs File)
-- | Stores which packages with custom-setup have already had their
-- Setup.hs built.
[$sel:customBuilt:ExecuteEnv] :: ExecuteEnv -> !IORef (Set PackageName)
-- | For nicer interleaved output: track the largest package name size
[$sel:largestPackageName:ExecuteEnv] :: ExecuteEnv -> !Maybe Int
-- | Value of the PATH environment variable
[$sel:pathEnvVar:ExecuteEnv] :: ExecuteEnv -> !Text
-- | Execute a function that takes an ExecuteEnv.
withExecuteEnv :: forall env a. HasEnvConfig env => BuildOpts -> BuildOptsCLI -> BaseConfigOpts -> [LocalPackage] -> [DumpPackage] -> [DumpPackage] -> [DumpPackage] -> Maybe Int -> (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:
--
--