-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | The Haskell Tool Stack -- -- Please see the README.md for usage information, and the wiki on Github -- for more details. Also, note that the API for the library is not -- currently stable, and may change significantly, even between minor -- releases. It is currently only intended for use by the executable. @package stack @version 1.9.1.1 -- | 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 ByteString) httpLBS :: MonadIO m => Request -> m (Response ByteString) httpNoBody :: MonadIO m => Request -> m (Response ()) httpSink :: MonadUnliftIO m => Request -> (Response () -> ConduitM ByteString Void m a) -> m a setUserAgent :: Request -> Request withResponse :: (MonadUnliftIO m, MonadIO n) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a withResponseByManager :: MonadUnliftIO m => Request -> Manager -> (Response BodyReader -> m a) -> m a -- | Set the request method setRequestMethod :: ByteString -> Request -> Request -- | Set the given request header to the given list of values. Removes any -- previously set header values with the same name. setRequestHeader :: HeaderName -> [ByteString] -> Request -> Request -- | Add a request header name/value combination addRequestHeader :: HeaderName -> ByteString -> Request -> Request -- | Set the request body to the given 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 -- | Instead of using the default global Manager, use the supplied -- Manager. setRequestManager :: Manager -> Request -> Request -- | Get all response headers getResponseHeaders :: () => Response a -> [(HeaderName, ByteString)] -- | Get the response body getResponseBody :: () => Response a -> a -- | Get the integral status code of the response getResponseStatusCode :: () => Response a -> Int -- | Response headers sent by the server. -- -- Since 0.1.0 responseHeaders :: Response body -> ResponseHeaders -- | Status code of the response. -- -- Since 0.1.0 responseStatus :: Response body -> Status -- | Response body sent by the server. -- -- Since 0.1.0 responseBody :: Response body -> body -- | Convert a URL into a 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 -- | Same as parseRequest, but parse errors cause an impure -- exception. Mostly useful for static strings which are known to be -- correctly formatted. parseRequest_ :: String -> Request -- | A default request value, a GET request of localhost/:80, with an empty -- request body. -- -- Note that the default checkResponse does nothing. defaultRequest :: Request -- | Validate a URI, then add it to the request. setUri :: MonadThrow m => Request -> URI -> 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 -- | Keeps track of open connections for keep-alive. -- -- If possible, you should share a single Manager between multiple -- threads and requests. -- -- Since 0.1.0 data Manager -- | Header type Header = (HeaderName, ByteString) -- | Header name type HeaderName = CI ByteString -- | An exception which may be generated by this library data HttpException -- | Most exceptions are specific to a Request. Inspect the -- HttpExceptionContent value for details on what occurred. HttpExceptionRequest :: Request -> HttpExceptionContent -> 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 -- | HTTP Header names according to -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html hAccept :: HeaderName -- | HTTP Header names according to -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html hContentLength :: HeaderName -- | HTTP Header names according to -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html hContentMD5 :: HeaderName -- | HTTP Header names according to -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html hCacheControl :: HeaderName -- | HTTP Header names according to -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html hRange :: HeaderName -- | HTTP Method constants. methodPut :: Method -- | OK 200 ok200 :: Status -- | Partial Content 206 partialContent206 :: Status -- | Define a HTTP proxy, consisting of a hostname and port number. data Proxy -- | Use the given proxy settings, regardless of the proxy value in the -- Request. -- -- Since 0.4.7 useProxy :: Proxy -> ProxyOverride -- | Never connect using a proxy, regardless of the proxy value in the -- Request. -- -- Since 0.4.7 noProxy :: ProxyOverride -- | Get the proxy settings from the default environment variable -- (http_proxy for insecure, https_proxy for secure). -- If no variable is set, then fall back to the given value. -- Nothing is equivalent to noProxy, Just is -- equivalent to useProxy. -- -- Since 0.4.7 proxyEnvironment :: Maybe Proxy -> ProxyOverride -- | Set the proxy override value, for both HTTP (insecure) and HTTPS -- (insecure) connections. -- -- Since 0.4.7 managerSetProxy :: ProxyOverride -> ManagerSettings -> ManagerSettings -- | Add form data to the 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 :: Text -> FilePath -> RequestBody -> Part -- | Make a Part whose content is a strict ByteString. -- -- The Part does not have a file name or content type associated -- with it. partBS :: Text -> ByteString -> Part -- | Make a Part whose content is a lazy ByteString. -- -- The Part does not have a file name or content type associated -- with it. partLBS :: Text -> ByteString -> Part -- | Extra Path utilities. module Path.Extra -- | Convert to FilePath but don't add a trailing slash. toFilePathNoTrailingSep :: Path loc Dir -> FilePath -- | Drop the root (either / on POSIX or C:\, -- D:\, etc. on Windows). dropRoot :: Path Abs t -> Path Rel t -- | Collapse intermediate "." and ".." directories from path, then parse -- it with parseAbsDir. (probably should be moved to the Path -- module) parseCollapsedAbsDir :: MonadThrow m => FilePath -> m (Path Abs Dir) -- | Collapse intermediate "." and ".." directories from path, then parse -- it with parseAbsFile. (probably should be moved to the Path -- module) parseCollapsedAbsFile :: MonadThrow m => FilePath -> m (Path Abs File) -- | Add a relative FilePath to the end of a Path We can't parse the -- FilePath first because we need to account for ".." in the FilePath -- (#2895) concatAndColapseAbsDir :: MonadThrow m => Path Abs Dir -> FilePath -> m (Path Abs Dir) -- | If given file in Maybe does not exist, ensure we have -- Nothing. This is to be used in conjunction with -- forgivingAbsence and resolveFile. -- -- Previously the idiom forgivingAbsence (relsoveFile …) alone -- was used, which relied on canonicalizePath throwing -- isDoesNotExistError when path does not exist. As it turns out, -- this behavior is actually not intentional and unreliable, see -- https://github.com/haskell/directory/issues/44. This was -- “fixed” in version 1.2.3.0 of directory package (now -- it never throws). To make it work with all versions, we need to use -- the following idiom: -- --
--   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) module Paths_stack version :: Version getBinDir :: IO FilePath getLibDir :: IO FilePath getDynLibDir :: IO FilePath getDataDir :: IO FilePath getLibexecDir :: IO FilePath getDataFileName :: FilePath -> IO FilePath getSysconfDir :: IO FilePath module Stack.Prelude -- | Get a source for a file. Unlike sourceFile, doesn't require -- ResourceT. Unlike explicit withBinaryFile and -- sourceHandle usage, you can't accidentally use -- WriteMode instead of ReadMode. withSourceFile :: MonadUnliftIO m => FilePath -> (ConduitM i ByteString m () -> m a) -> m a -- | Same idea as withSourceFile, see comments there. withSinkFile :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a -- | Like withSinkFile, but ensures that the file is atomically -- moved after all contents are written. withSinkFileCautious :: MonadUnliftIO m => FilePath -> (ConduitM ByteString o m () -> m a) -> m a -- | Path version withSystemTempDir :: MonadUnliftIO m => String -> (Path Abs Dir -> m a) -> m a -- | Like 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 ProcessExitedUnsuccessfully 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 return if present stripCR :: Text -> Text -- | hIsTerminaDevice does not recognise handles to mintty terminals as -- terminal devices, but isMinTTYHandle does. hIsTerminalDeviceOrMinTTY :: MonadIO m => Handle -> m Bool -- | Prompt the user by sending text to stdout, and taking a line of input -- from stdin. prompt :: MonadIO m => Text -> m Text -- | Prompt the user by sending text to stdout, and collecting a line of -- input from stdin. While taking input from stdin, input echoing is -- disabled, to hide passwords. -- -- Based on code from cabal-install, Distribution.Client.Upload promptPassword :: MonadIO m => Text -> m Text -- | Prompt the user by sending text to stdout, and collecting a line of -- input from stdin. If something other than "y" or "n" is entered, then -- print a message indicating that "y" or "n" is expected, and ask again. promptBool :: MonadIO m => Text -> m Bool -- | Append two lists, i.e., -- --
--   [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. (++) :: () => [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 :: () => a -> b -> b -- | 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 :: () => (a -> Bool) -> [a] -> [a] -- | 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 short, excess elements of the longer list are -- discarded: -- --
--   zip [1] ['a', 'b'] = [(1, 'a')]
--   zip [1, 2] ['a'] = [(1, 'a')]
--   
-- -- zip is right-lazy: -- --
--   zip [] _|_ = []
--   zip _|_ [] = _|_
--   
zip :: () => [a] -> [b] -> [(a, b)] -- | Extract the first component of a pair. fst :: () => (a, b) -> a -- | Extract the second component of a pair. snd :: () => (a, b) -> b -- | otherwise is defined as the value True. It helps to make -- guards more readable. eg. -- --
--   f x | x < 0     = ...
--       | otherwise = ...
--   
otherwise :: Bool -- | 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 -- | 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 :: () => (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 levity-polymorphic in its result type, so -- that foo $ True where foo :: Bool -> Int# is well-typed ($) :: () => (a -> b) -> a -> b infixr 0 $ -- | general coercion from integral types fromIntegral :: (Integral a, Num b) => a -> b -- | general coercion to fractional types realToFrac :: (Real a, Fractional b) => a -> b -- | Conditional failure of Alternative computations. Defined by -- --
--   guard True  = pure ()
--   guard False = empty
--   
-- --

Examples

-- -- Common uses of guard include conditionally signaling an error -- in an error monad and conditionally rejecting the current choice in an -- Alternative-based parser. -- -- As an example of signaling an error in the error monad Maybe, -- consider a safe division function safeDiv x y that returns -- Nothing when the denominator y is zero and -- Just (x `div` y) otherwise. For example: -- --
--   >>> 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. -- --

Examples

-- -- A common use of join is to run an IO computation -- returned from an STM transaction, since STM transactions -- can't perform IO directly. Recall that -- --
--   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 -- | 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, == -- is customarily expected to implement an equivalence relationship where -- two values comparing equal are indistinguishable by "public" -- functions, with a "public" function being one not allowing to see -- implementation details. For example, for a type representing -- non-normalised natural numbers modulo 100, a "public" function doesn't -- make the difference between 1 and 201. It is expected to have the -- following properties: -- -- -- -- Minimal complete definition: either == or /=. class Eq a (==) :: Eq a => a -> a -> Bool (/=) :: Eq a => a -> a -> Bool infix 4 == infix 4 /= -- | Trigonometric and hyperbolic functions and related functions. -- -- The Haskell Report defines no laws for Floating. However, -- '(+)', '(*)' and exp are customarily expected to define an -- exponential field and have the following properties: -- -- class Fractional a => Floating a pi :: Floating a => a exp :: Floating a => a -> a log :: Floating a => a -> a sqrt :: Floating a => a -> a (**) :: Floating a => a -> a -> a logBase :: Floating a => a -> a -> a sin :: Floating a => a -> a cos :: Floating a => a -> a tan :: Floating a => a -> a asin :: Floating a => a -> a acos :: Floating a => a -> a atan :: Floating a => a -> a sinh :: Floating a => a -> a cosh :: Floating a => a -> a tanh :: Floating a => a -> a asinh :: Floating a => a -> a acosh :: Floating a => a -> a atanh :: Floating a => a -> a infixr 8 ** -- | Fractional numbers, supporting real division. -- -- The Haskell Report defines no laws for Fractional. However, -- '(+)' and '(*)' are customarily expected to define a division ring and -- have the following properties: -- -- -- -- Note that it isn't customarily expected that a type instance of -- Fractional implement a field. However, all instances in -- base do. class Num a => Fractional a -- | fractional division (/) :: Fractional a => a -> a -> a -- | reciprocal fraction recip :: Fractional a => a -> a -- | Conversion from a Rational (that is Ratio -- Integer). A floating literal stands for an application of -- fromRational to a value of type Rational, so such -- literals have type (Fractional a) => a. fromRational :: Fractional a => Rational -> a infixl 7 / -- | Integral numbers, supporting integer division. -- -- The Haskell Report defines no laws for Integral. However, -- Integral instances are customarily expected to define a -- Euclidean domain and have the following properties for the 'div'/'mod' -- and 'quot'/'rem' pairs, given suitable Euclidean functions f -- and g: -- -- -- -- An example of a suitable Euclidean function, for Integer's -- instance, is abs. class (Real a, Enum a) => Integral a -- | integer division truncated toward zero quot :: Integral a => a -> a -> a -- | integer remainder, satisfying -- --
--   (x `quot` y)*y + (x `rem` y) == x
--   
rem :: Integral a => a -> a -> a -- | integer division truncated toward negative infinity div :: Integral a => a -> a -> a -- | integer modulus, satisfying -- --
--   (x `div` y)*y + (x `mod` y) == x
--   
mod :: Integral a => a -> a -> a -- | simultaneous quot and rem quotRem :: Integral a => a -> a -> (a, a) -- | simultaneous div and mod divMod :: Integral a => a -> a -> (a, a) -- | conversion to Integer toInteger :: Integral a => a -> Integer infixl 7 `mod` infixl 7 `div` infixl 7 `rem` infixl 7 `quot` -- | 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 laws: -- -- -- -- Furthermore, the Monad and Applicative operations should -- relate as follows: -- -- -- -- The above laws imply: -- -- -- -- and that pure and (<*>) satisfy the applicative -- functor laws. -- -- The instances of Monad for lists, Maybe and IO -- defined in the Prelude satisfy these laws. class Applicative m => Monad (m :: Type -> Type) -- | Sequentially compose two actions, passing any value produced by the -- first as an argument to the second. (>>=) :: Monad m => m a -> (a -> m b) -> m b -- | Sequentially compose two actions, discarding any value produced by the -- first, like sequencing operators (such as the semicolon) in imperative -- languages. (>>) :: Monad m => m a -> m b -> m b -- | Inject a value into the monadic type. return :: Monad m => a -> m a -- | Fail with a message. This operation is not part of the mathematical -- definition of a monad, but is invoked on pattern-match failure in a -- do expression. -- -- As part of the MonadFail proposal (MFP), this function is moved to its -- own class MonadFail (see Control.Monad.Fail for more -- details). The definition here will be removed in a future release. fail :: Monad m => String -> m a infixl 1 >>= infixl 1 >> -- | The Data class comprehends a fundamental primitive -- gfoldl for folding over constructor applications, say terms. -- This primitive can be instantiated in several ways to map over the -- immediate subterms of a term; see the gmap combinators later -- in this class. Indeed, a generic programmer does not necessarily need -- to use the ingenious gfoldl primitive but rather the intuitive -- gmap combinators. The gfoldl primitive is completed by -- means to query top-level constructors, to turn constructor -- representations into proper terms, and to list all possible datatype -- constructors. This completion allows us to serve generic programming -- scenarios like read, show, equality, term generation. -- -- The combinators gmapT, gmapQ, gmapM, etc are all -- provided with default definitions in terms of gfoldl, leaving -- open the opportunity to provide datatype-specific definitions. (The -- inclusion of the gmap combinators as members of class -- Data allows the programmer or the compiler to derive -- specialised, and maybe more efficient code per datatype. Note: -- gfoldl is more higher-order than the gmap combinators. -- This is subject to ongoing benchmarking experiments. It might turn out -- that the gmap combinators will be moved out of the class -- Data.) -- -- Conceptually, the definition of the gmap combinators in terms -- of the primitive gfoldl requires the identification of the -- gfoldl function arguments. Technically, we also need to -- identify the type constructor c for the construction of the -- result type from the folded term type. -- -- In the definition of gmapQx combinators, we use -- phantom type constructors for the c in the type of -- gfoldl because the result type of a query does not involve the -- (polymorphic) type of the term argument. In the definition of -- gmapQl we simply use the plain constant type constructor -- because gfoldl is left-associative anyway and so it is readily -- suited to fold a left-associative binary operation over the immediate -- subterms. In the definition of gmapQr, extra effort is needed. We use -- a higher-order accumulation trick to mediate between left-associative -- constructor application vs. right-associative binary operation (e.g., -- (:)). When the query is meant to compute a value of type -- r, then the result type withing generic folding is r -- -> r. So the result of folding is a function to which we -- finally pass the right unit. -- -- With the -XDeriveDataTypeable option, GHC can generate -- instances of the Data class automatically. For example, given -- the declaration -- --
--   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 :: 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 -- | The Functor class is used for types that can be mapped over. -- Instances of Functor should satisfy the following laws: -- --
--   fmap id  ==  id
--   fmap (f . g)  ==  fmap f . fmap g
--   
-- -- The instances of Functor for lists, Maybe and IO -- satisfy these laws. class Functor (f :: Type -> Type) fmap :: Functor f => (a -> b) -> f a -> f b -- | Replace all locations in the input with the same value. The default -- definition is fmap . const, but this may be -- overridden with a more efficient version. (<$) :: Functor f => a -> f b -> f a infixl 4 <$ -- | Basic numeric class. -- -- The Haskell Report defines no laws for Num. However, '(+)' and -- '(*)' are customarily expected to define a ring and have the following -- properties: -- -- -- -- Note that it isn't customarily expected that a type instance of -- both Num and Ord implement an ordered ring. Indeed, in -- base only Integer and Rational do. class Num a (+) :: Num a => a -> a -> a (-) :: Num a => a -> a -> a (*) :: Num a => a -> a -> a -- | Unary negation. negate :: Num a => a -> a -- | Absolute value. abs :: Num a => a -> a -- | Sign of a number. The functions abs and signum should -- satisfy the law: -- --
--   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 7 * infixl 6 + -- | 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. -- -- The Haskell Report defines no laws for Ord. However, -- <= is customarily expected to implement a non-strict partial -- order and have the following properties: -- -- -- -- Note that the following operator interactions are expected to hold: -- --
    --
  1. x >= y = y <= x
  2. --
  3. x < y = x <= y && x /= y
  4. --
  5. x > y = y < x
  6. --
  7. x < y = compare x y == LT
  8. --
  9. x > y = compare x y == GT
  10. --
  11. x == y = compare x y == EQ
  12. --
  13. min x y == if x <= y then x else y = True
  14. --
  15. max x y == if x >= y then x else y = True
  16. --
-- -- Minimal complete definition: either compare or <=. -- Using compare can be more efficient for complex types. class Eq a => Ord a compare :: Ord a => a -> a -> Ordering (<) :: Ord a => a -> a -> Bool (<=) :: Ord a => a -> a -> Bool (>) :: Ord a => a -> a -> Bool (>=) :: Ord a => a -> a -> Bool max :: Ord a => a -> a -> a min :: Ord a => a -> a -> a infix 4 >= infix 4 <= infix 4 < infix 4 > -- | Parsing of Strings, producing values. -- -- Derived instances of Read make the following assumptions, which -- derived instances of Show obey: -- -- -- -- For example, given the declarations -- --
--   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 class (Num a, Ord a) => Real a -- | the rational equivalent of its real argument with full precision toRational :: Real a => a -> Rational -- | Efficient, machine-independent access to the components of a -- floating-point number. class (RealFrac a, Floating a) => RealFloat a -- | a constant function, returning the radix of the representation (often -- 2) floatRadix :: RealFloat a => a -> Integer -- | a constant function, returning the number of digits of -- floatRadix in the significand floatDigits :: RealFloat a => a -> Int -- | a constant function, returning the lowest and highest values the -- exponent may assume floatRange :: RealFloat a => a -> (Int, Int) -- | The function decodeFloat applied to a real floating-point -- number returns the significand expressed as an Integer and an -- appropriately scaled exponent (an Int). If -- decodeFloat x yields (m,n), then x -- is equal in value to m*b^^n, where b is the -- floating-point radix, and furthermore, either m and -- n are both zero or else b^(d-1) <= abs m < -- b^d, where d is the value of floatDigits -- x. In particular, decodeFloat 0 = (0,0). If the -- type contains a negative zero, also decodeFloat (-0.0) = -- (0,0). The result of decodeFloat x is -- unspecified if either of isNaN x or -- isInfinite x is True. decodeFloat :: RealFloat a => a -> (Integer, Int) -- | encodeFloat performs the inverse of decodeFloat in the -- sense that for finite x with the exception of -0.0, -- uncurry encodeFloat (decodeFloat x) = -- x. encodeFloat m n is one of the two closest -- representable floating-point numbers to m*b^^n (or -- ±Infinity if overflow occurs); usually the closer, but if -- m contains too many bits, the result may be rounded in the -- wrong direction. encodeFloat :: RealFloat a => Integer -> Int -> a -- | exponent corresponds to the second component of -- decodeFloat. exponent 0 = 0 and for finite -- nonzero x, exponent x = snd (decodeFloat x) -- + floatDigits x. If x is a finite floating-point -- number, it is equal in value to significand x * b ^^ -- exponent x, where b is the floating-point radix. -- The behaviour is unspecified on infinite or NaN values. exponent :: RealFloat a => a -> Int -- | The first component of decodeFloat, scaled to lie in the open -- interval (-1,1), either 0.0 or of absolute -- value >= 1/b, where b is the floating-point -- radix. The behaviour is unspecified on infinite or NaN -- values. significand :: RealFloat a => a -> a -- | multiplies a floating-point number by an integer power of the radix scaleFloat :: RealFloat a => Int -> a -> a -- | True if the argument is an IEEE "not-a-number" (NaN) value isNaN :: RealFloat a => a -> Bool -- | True if the argument is an IEEE infinity or negative infinity isInfinite :: RealFloat a => a -> Bool -- | True if the argument is too small to be represented in -- normalized format isDenormalized :: RealFloat a => a -> Bool -- | True if the argument is an IEEE negative zero isNegativeZero :: RealFloat a => a -> Bool -- | True if the argument is an IEEE floating point number isIEEE :: RealFloat a => a -> Bool -- | a version of arctangent taking two real floating-point arguments. For -- real floating x and y, atan2 y x -- computes the angle (from the positive x-axis) of the vector from the -- origin to the point (x,y). atan2 y x returns -- a value in the range [-pi, pi]. It follows the -- Common Lisp semantics for the origin when signed zeroes are supported. -- atan2 y 1, with y in a type that is -- RealFloat, should return the same value as atan -- y. A default definition of atan2 is provided, but -- implementors can provide a more accurate implementation. atan2 :: RealFloat a => a -> a -> a -- | Extracting components of fractions. class (Real a, Fractional a) => RealFrac a -- | The function properFraction takes a real fractional number -- x and returns a pair (n,f) such that x = -- n+f, and: -- -- -- -- The default definitions of the ceiling, floor, -- truncate and round functions are in terms of -- properFraction. properFraction :: (RealFrac a, Integral b) => a -> (b, a) -- | truncate x returns the integer nearest x -- between zero and x truncate :: (RealFrac a, Integral b) => a -> b -- | round x returns the nearest integer to x; the -- even integer if x is equidistant between two integers round :: (RealFrac a, Integral b) => a -> b -- | ceiling x returns the least integer not less than -- x ceiling :: (RealFrac a, Integral b) => a -> b -- | floor x returns the greatest integer not greater than -- x floor :: (RealFrac a, Integral b) => a -> b -- | Conversion of values to readable Strings. -- -- Derived instances of Show have the following properties, which -- are compatible with derived instances of Read: -- -- -- -- For example, given the declarations -- --
--   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, -- -- class Show a -- | A specialised variant of showsPrec, using precedence context -- zero, and returning an ordinary String. show :: Show a => a -> String -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable (a :: k) -- | Class for string-like datastructures; used by the overloaded string -- extension (-XOverloadedStrings in GHC). class IsString a fromString :: IsString a => String -> a -- | A functor with application, providing operations to -- -- -- -- A minimal complete definition must include implementations of -- pure and of either <*> or liftA2. If it -- defines both, then they must behave the same as their default -- definitions: -- --
--   (<*>) = liftA2 id
--   
-- --
--   liftA2 f x y = f <$> x <*> y
--   
-- -- Further, any definition must satisfy the following: -- -- -- -- The other methods have the following default definitions, which may be -- overridden with equivalent specialized implementations: -- -- -- -- As a consequence of these laws, the Functor instance for -- f will satisfy -- -- -- -- It may be useful to note that supposing -- --
--   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. (<*>) :: 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 <*>. liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c -- | Sequence actions, discarding the value of the first argument. (*>) :: Applicative f => f a -> f b -> f b -- | Sequence actions, discarding the value of the second argument. (<*) :: Applicative f => f a -> f b -> f a infixl 4 <*> infixl 4 *> infixl 4 <* -- | Data structures that can be folded. -- -- For example, given a data type -- --
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   
-- -- a suitable instance would be -- --
--   instance Foldable Tree where
--      foldMap f Empty = mempty
--      foldMap f (Leaf x) = f x
--      foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r
--   
-- -- This is suitable even for abstract types, as the monoid is assumed to -- satisfy the monoid laws. Alternatively, one could define -- foldr: -- --
--   instance Foldable Tree where
--      foldr f z Empty = z
--      foldr f z (Leaf x) = f x z
--      foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l
--   
-- -- Foldable instances are expected to satisfy the following -- laws: -- --
--   foldr f z t = appEndo (foldMap (Endo . f) t ) z
--   
-- --
--   foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
--   
-- --
--   fold = foldMap id
--   
-- --
--   length = getSum . foldMap (Sum . const  1)
--   
-- -- sum, product, maximum, and minimum -- should all be essentially equivalent to foldMap forms, such -- as -- --
--   sum = getSum . foldMap Sum
--   
-- -- but may be less defined. -- -- If the type is also a Functor instance, it should satisfy -- --
--   foldMap f = fold . fmap f
--   
-- -- which implies that -- --
--   foldMap f . fmap g = foldMap (f . g)
--   
class Foldable (t :: Type -> Type) -- | Combine the elements of a structure using a monoid. fold :: (Foldable t, Monoid m) => t m -> m -- | Map each element of the structure to a monoid, and combine the -- results. foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m -- | Right-associative fold of a structure. -- -- In the case of lists, 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, -- foldr can produce a terminating expression from an infinite -- list. -- -- For a general Foldable structure this should be semantically -- identical to, -- --
--   foldr f z = foldr f z . toList
--   
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b -- | Left-associative fold of a structure but with strict application of -- the operator. -- -- This ensures that each step of the fold is forced to weak head normal -- form before being applied, avoiding the collection of thunks that -- would otherwise occur. This is often what you want to strictly reduce -- a finite list to a single, monolithic result (e.g. length). -- -- 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. toList :: Foldable t => t a -> [a] -- | Test whether the structure is empty. The default implementation is -- optimized for structures that are similar to cons-lists, because there -- is no general way to do better. null :: Foldable t => t a -> Bool -- | Returns the size/length of a finite structure as an Int. The -- default implementation is optimized for structures that are similar to -- cons-lists, because there is no general way to do better. length :: Foldable t => t a -> Int -- | Does the element occur in the structure? elem :: (Foldable t, Eq a) => a -> t a -> Bool -- | The sum function computes the sum of the numbers of a -- structure. sum :: (Foldable t, Num a) => t a -> a -- | The product function computes the product of the numbers of a -- structure. product :: (Foldable t, Num a) => t a -> a infix 4 `elem` -- | Functors representing data structures that can be traversed from left -- to right. -- -- A definition of traverse must satisfy the following laws: -- -- -- -- A definition of sequenceA must satisfy the following laws: -- -- -- -- where an applicative transformation is a function -- --
--   t :: (Applicative f, Applicative g) => f a -> g a
--   
-- -- preserving the Applicative operations, i.e. -- -- -- -- and the identity functor Identity and composition of functors -- Compose are defined as -- --
--   newtype Identity a = Identity a
--   
--   instance Functor Identity where
--     fmap f (Identity x) = Identity (f x)
--   
--   instance Applicative Identity where
--     pure x = Identity x
--     Identity f <*> Identity x = Identity (f x)
--   
--   newtype Compose f g a = Compose (f (g a))
--   
--   instance (Functor f, Functor g) => Functor (Compose f g) where
--     fmap f (Compose x) = Compose (fmap (fmap f) x)
--   
--   instance (Applicative f, Applicative g) => Applicative (Compose f g) where
--     pure x = Compose (pure (pure x))
--     Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
--   
-- -- (The naturality law is implied by parametricity.) -- -- Instances are similar to Functor, e.g. given a data type -- --
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   
-- -- a suitable instance would be -- --
--   instance Traversable Tree where
--      traverse f Empty = pure Empty
--      traverse f (Leaf x) = Leaf <$> f x
--      traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--   
-- -- This is suitable even for abstract types, as the laws for -- <*> imply a form of associativity. -- -- The superclass instances should satisfy the following: -- -- 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 :: (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 :: (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_. mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) -- | Evaluate each monadic action in the structure from left to right, and -- collect the results. For a version that ignores the results see -- sequence_. sequence :: (Traversable t, Monad m) => t (m a) -> m (t 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 . toid
--   to . fromid
--   
class Generic a -- | The class of semigroups (types with an associative binary operation). -- -- Instances should satisfy the associativity law: -- -- class Semigroup a -- | An associative operation. (<>) :: Semigroup a => a -> a -> a -- | Reduce a non-empty list with <> -- -- The default definition should be sufficient, but this can be -- overridden for efficiency. sconcat :: Semigroup a => NonEmpty a -> a -- | Repeat a value n times. -- -- Given that this works on a Semigroup it is allowed to fail if -- you request 0 or fewer repetitions, and the default definition will do -- so. -- -- By making this a member of the class, idempotent semigroups and -- monoids can upgrade this to execute in O(1) by picking -- stimes = stimesIdempotent or stimes = -- stimesIdempotentMonoid respectively. stimes :: (Semigroup a, Integral b) => b -> a -> a infixr 6 <> -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following laws: -- -- -- -- The method names refer to the monoid of lists under concatenation, but -- there are many other instances. -- -- Some types can be viewed as a monoid in more than one way, e.g. both -- addition and multiplication on numbers. In such cases we often define -- newtypes and make those instances of Monoid, e.g. -- Sum and Product. -- -- NOTE: Semigroup is a superclass of Monoid since -- base-4.11.0.0. class Semigroup a => Monoid a -- | Identity of mappend mempty :: Monoid a => a -- | An associative operation -- -- NOTE: This method is redundant and has the default -- implementation mappend = '(<>)' since -- base-4.11.0.0. 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 :: Monoid a => [a] -> a data Bool False :: Bool True :: Bool -- | 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 -- | Invariant: Jn# and Jp# are used iff value doesn't fit in -- S# -- -- Useful properties resulting from the invariants: -- -- data Integer -- | Type representing arbitrary-precision non-negative integers. -- --
--   >>> 2^100 :: Natural
--   1267650600228229401496703205376
--   
-- -- Operations whose result would be negative throw -- (Underflow :: ArithException), -- --
--   >>> -1 :: Natural
--   *** Exception: arithmetic underflow
--   
data Natural -- | 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"). -- --

Examples

-- -- The type Either String Int is the type -- of values which can be either a String or an Int. The -- Left constructor can be used only on Strings, and the -- Right constructor can be used only on Ints: -- --
--   >>> 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 -- | CallStacks are a lightweight method of obtaining a partial -- call-stack at any point in the program. -- -- A function can request its call-site with the HasCallStack -- constraint. For example, we can define -- --
--   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>:2:1 in interactive:Ghci1
--   
-- -- GHC solves HasCallStack constraints in three steps: -- --
    --
  1. If there is a CallStack in scope -- i.e. the enclosing -- function has a HasCallStack constraint -- GHC will append the -- new call-site to the existing CallStack.
  2. --
  3. If there is no CallStack in scope -- e.g. in the GHCi -- session above -- and the enclosing definition does not have an -- explicit type signature, GHC will infer a HasCallStack -- constraint for the enclosing definition (subject to the monomorphism -- restriction).
  4. --
  5. If there is no CallStack in scope and the enclosing -- definition has an explicit type signature, GHC will solve the -- HasCallStack constraint for the singleton CallStack -- containing just the current call-site.
  6. --
-- -- CallStacks do not interact with the RTS and do not require -- compilation with -prof. On the other hand, as they are built -- up explicitly via the HasCallStack constraints, they will -- generally not contain as much information as the simulated call-stacks -- maintained by the RTS. -- -- A CallStack is a [(String, SrcLoc)]. The -- String is the name of function that was called, the -- SrcLoc is the call-site. The list is ordered with the most -- recently called function at the head. -- -- NOTE: The intrepid user may notice that HasCallStack is just an -- alias for an implicit parameter ?callStack :: CallStack. This -- is an implementation detail and should not be considered part -- of the CallStack API, we may decide to change the -- implementation in the future. data CallStack -- | A compact representation of a Word8 vector. -- -- It has a lower memory overhead than a ByteString and 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. -- -- It is suitable for use as an internal representation for code that -- needs to keep many short strings in memory, but it should not -- be used as an interchange type. That is, it should not generally be -- used in public APIs. The ByteString type is usually more -- suitable for use in interfaces; it is more flexible and it supports a -- wide range of operations. data ShortByteString -- | A space-efficient representation of a 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 -- | Swap bytes in Word16. byteSwap16 :: Word16 -> Word16 -- | Reverse order of bytes in Word32. byteSwap32 :: Word32 -> Word32 -- | Reverse order of bytes in Word64. byteSwap64 :: Word64 -> Word64 -- | 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 '()'. -- --

Generic NFData deriving

-- -- Starting with GHC 7.2, you can automatically derive instances for -- types possessing a Generic instance. -- -- Note: Generic1 can be auto-derived starting with GHC 7.4 -- --
--   {-# 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)
--   
-- --

Compatibility with previous deepseq versions

-- -- Prior to version 1.4.0.0, the default implementation of the rnf -- method was defined as -- --
--   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 -> () -- | A Map from keys k to values a. data Map k a -- | Boolean "not" not :: Bool -> Bool -- | Boolean "or" (||) :: Bool -> Bool -> Bool infixr 2 || -- | Boolean "and" (&&) :: Bool -> Bool -> Bool infixr 3 && -- | error stops execution and displays an error message. error :: 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 :: HasCallStack => a -- | A String is a list of characters. String constants in Haskell -- are values of type String. type String = [Char] -- | 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 <|> -- | 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 is a unary function which evaluates to x for -- all inputs. -- --
--   >>> 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. ($!) :: () => (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 -- | curry converts an uncurried function to a curried function. -- --

Examples

-- --
--   >>> curry fst 1 2
--   1
--   
curry :: () => ((a, b) -> c) -> a -> b -> c -- | uncurry converts a curried function to a function on pairs. -- --

Examples

-- --
--   >>> 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 -- | 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. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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 _. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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 and -- Maybe value. If the Maybe is Nothing, it returns -- the default values; otherwise, it returns the value contained in the -- Maybe. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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 not given Nothing. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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. -- --

Examples

-- -- Using mapMaybe f x is a shortcut for -- catMaybes $ map f x in most cases: -- --
--   >>> 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 :: () => 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 :: () => [a] -> [a] -- | lookup key assocs looks up a key in an association -- list. lookup :: Eq a => a -> [(a, b)] -> Maybe b even :: Integral a => a -> Bool odd :: Integral a => a -> Bool -- | raise a number to a non-negative integral power (^) :: (Num a, Integral b) => a -> b -> a infixr 8 ^ -- | raise a number to an integral power (^^) :: (Fractional a, Integral b) => a -> b -> a infixr 8 ^^ -- | 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 -- | 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. -- --

Examples

-- -- Convert from a Maybe Int to a -- Maybe String using show: -- --
--   >>> 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. -- --

Examples

-- -- Replace the contents of a Maybe Int with -- unit: -- --
--   >>> 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 () -- |
--   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 -- | Case analysis for the Either type. If the value is -- Left a, apply the first function to a; if it -- is Right b, apply the second function to b. -- --

Examples

-- -- We create two values of type Either String -- Int, one using the Left constructor and another -- using the Right constructor. Then we apply "either" the -- length function (if we have a String) or the -- "times-two" function (if we have an Int): -- --
--   >>> 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 -- | lines breaks a string up into a list of strings at newline -- characters. The resulting strings do not contain newlines. -- -- Note that after splitting the string at newline characters, the last -- part of the string is considered a line even if it doesn't end with a -- newline. For example, -- --
--   >>> lines ""
--   []
--   
-- --
--   >>> lines "\n"
--   [""]
--   
-- --
--   >>> lines "one"
--   ["one"]
--   
-- --
--   >>> lines "one\n"
--   ["one"]
--   
-- --
--   >>> lines "one\n\n"
--   ["one",""]
--   
-- --
--   >>> lines "one\ntwo"
--   ["one","two"]
--   
-- --
--   >>> lines "one\ntwo\n"
--   ["one","two"]
--   
-- -- Thus lines s contains at least as many elements as -- newlines in s. lines :: String -> [String] -- | unlines is an inverse operation to lines. It joins -- lines, after appending a terminating newline to each. -- --
--   >>> unlines ["Hello", "World", "!"]
--   "Hello\nWorld\n!\n"
--   
unlines :: [String] -> String -- | words breaks a string up into a list of words, which were -- delimited by white space. -- --
--   >>> words "Lorem ipsum\ndolor"
--   ["Lorem","ipsum","dolor"]
--   
words :: String -> [String] -- | unwords is an inverse operation to words. It joins words -- with separating spaces. -- --
--   >>> unwords ["Lorem", "ipsum", "dolor"]
--   "Lorem ipsum dolor"
--   
unwords :: [String] -> String -- | 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 -- | Map each element of a structure to an action, evaluate these actions -- from left to right, and ignore the results. For a version that doesn't -- ignore the results see traverse. 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. -- --
--   >>> 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. -- -- As of base 4.8.0.0, sequence_ is just sequenceA_, -- specialized to Monad. sequence_ :: (Foldable t, Monad m) => t (m a) -> m () -- | The concatenation of all the elements of a container of lists. concat :: Foldable t => t [a] -> [a] -- | Map a function over all the elements of a container and concatenate -- the resulting lists. concatMap :: Foldable t => (a -> [b]) -> t a -> [b] -- | 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 :: 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 :: Foldable t => t Bool -> Bool -- | Determines whether any element of the structure satisfies the -- predicate. any :: Foldable t => (a -> Bool) -> t a -> Bool -- | Determines whether all elements of the structure satisfy the -- predicate. all :: Foldable t => (a -> Bool) -> t a -> Bool -- | notElem is the negation of elem. notElem :: (Foldable t, Eq a) => a -> t a -> Bool infix 4 `notElem` -- | 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 -- | One or none. optional :: Alternative f => f a -> f (Maybe 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 () -- | Builders denote sequences of bytes. They are Monoids -- where mempty is the zero-length sequence and mappend is -- concatenation, which runs in O(1). data Builder -- | The class of types that can be converted to a hash value. -- -- Minimal implementation: hashWithSalt. class Hashable a -- | A space efficient, packed, unboxed Unicode text type. data Text -- | A map from keys to values. A map cannot contain duplicate keys; each -- key can map to at most one value. data HashMap k v -- | A class for monads in which exceptions may be thrown. -- -- Instances should obey the following law: -- --
--   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, Exception e) => e -> m 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: -- -- -- -- Most handles will also have a current I/O position indicating where -- the next input or output operation will occur. A handle is -- readable if it manages only input or both input and output; -- likewise, it is writable if it manages only output or both -- input and output. A handle is open when first allocated. Once -- it is closed it can no longer be used for either input or output, -- though an implementation cannot re-use its storage while references -- remain to it. Handles are in the Show and Eq classes. -- The string produced by showing a handle is system dependent; it should -- include enough information to identify the handle for debugging. A -- handle is equal according to == only to itself; no attempt is -- made to compare the internal state of different handles for equality. data Handle -- | A ThreadId is an abstract type representing a handle to a -- thread. ThreadId is an instance of Eq, Ord and -- Show, where the Ord instance implements an arbitrary -- total ordering over ThreadIds. The Show instance lets -- you convert an arbitrary-valued ThreadId to string form; -- showing a ThreadId value is occasionally useful when debugging -- or diagnosing the behaviour of a concurrent program. -- -- Note: in GHC, if you have a ThreadId, you essentially -- have a pointer to the thread itself. This means the thread itself -- can't be garbage collected until you drop the ThreadId. This -- misfeature will hopefully be corrected at a later date. data ThreadId -- | A version of waitBoth that can be used inside an STM -- transaction. waitBothSTM :: () => Async a -> Async b -> STM (a, b) -- | A version of waitEither_ that can be used inside an STM -- transaction. waitEitherSTM_ :: () => Async a -> Async b -> STM () -- | A version of waitEither that can be used inside an STM -- transaction. waitEitherSTM :: () => Async a -> Async b -> STM (Either a 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)) -- | A version of waitAny that can be used inside an STM -- transaction. waitAnySTM :: () => [Async a] -> STM (Async a, a) -- | A version of waitAnyCatch that can be used inside an STM -- transaction. waitAnyCatchSTM :: () => [Async a] -> STM (Async a, Either SomeException a) -- | A version of poll that can be used inside an STM transaction. pollSTM :: () => Async a -> STM (Maybe (Either SomeException a)) -- | A version of waitCatch that can be used inside an STM -- transaction. waitCatchSTM :: () => Async a -> STM (Either SomeException a) -- | A version of wait that can be used inside an STM transaction. waitSTM :: () => Async a -> STM a -- | An asynchronous action spawned by async or withAsync. -- Asynchronous actions are executed in a separate thread, and operations -- are provided for waiting for asynchronous actions to complete and -- obtaining their results (see e.g. wait). data Async 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 -- | Uninhabited data type data Void -- | Chan is an abstract type representing an unbounded FIFO -- channel. data Chan 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. liftIO :: MonadIO m => IO a -> m a -- | Strict version of <$>. (<$!>) :: Monad m => (a -> b) -> m a -> m b infixl 4 <$!> -- | Like replicateM, but discards the result. replicateM_ :: Applicative m => Int -> m a -> m () -- | Like foldM, but discards the result. foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m () -- | zipWithM_ is the extension of zipWithM which ignores the -- final result. zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m () -- | The zipWithM function generalizes zipWith to arbitrary -- applicative functors. zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c] -- | Repeat an action indefinitely. -- --

Examples

-- -- A common use of forever is to process input from network -- sockets, Handles, and channels (e.g. MVar and -- Chan). -- -- For example, here is how we might implement an echo server, -- using forever both to listen for client connections on a -- network socket and to echo client input on client connection handles: -- --
--   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
--   
forever :: Applicative f => f a -> f b -- | 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 <=< -- | Left-to-right composition of Kleisli arrows. (>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c infixr 1 >=> -- | 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) -- | Send the first component of the input through the argument arrow, and -- copy the rest unchanged to the output. first :: Arrow a => a b c -> a (b, d) (c, d) -- | A mirror image of first. -- -- The default definition may be overridden with a more efficient version -- if desired. second :: Arrow a => a b c -> a (d, b) (d, c) -- | Split the input between the two argument arrows and combine their -- output. Note that this is in general not a functor. -- -- The default definition may be overridden with a more efficient version -- if desired. (***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c') infixr 3 *** -- | Fanout: send the input to both argument arrows and combine their -- output. -- -- The default definition may be overridden with a more efficient version -- if desired. (&&&) :: Arrow a => a b c -> a b c' -> a b (c, c') infixr 3 &&& -- | Identity functor and monad. (a non-strict monad) newtype Identity a Identity :: a -> Identity a [runIdentity] :: Identity a -> a -- | A handle managing output to the Haskell program's standard error -- channel. stderr :: Handle -- | A handle managing input from the Haskell program's standard input -- channel. stdin :: Handle -- | Write the supplied value into a TVar. writeTVar :: () => TVar a -> a -> STM () -- | Return the current value stored in a TVar. readTVar :: () => TVar a -> STM a -- | Create a new TVar holding a value supplied newTVar :: () => a -> STM (TVar a) -- | A monad supporting atomic memory transactions. data STM a -- | Shared memory locations that support atomic memory transactions. data TVar a -- | Superclass for asynchronous exceptions. data SomeAsyncException [SomeAsyncException] :: forall e. Exception e => e -> SomeAsyncException -- | Defines the exit codes that a program can return. data ExitCode -- | indicates successful termination; ExitSuccess :: ExitCode -- | indicates program failure with an exit code. The exact interpretation -- of the code is operating-system dependent. In particular, some values -- may be prohibited (e.g. 0 on a POSIX-compliant system). ExitFailure :: Int -> ExitCode -- | A handle managing output to the Haskell program's standard output -- channel. stdout :: Handle -- | Three kinds of buffering are supported: line-buffering, -- block-buffering or no-buffering. These modes have the following -- effects. For output, items are written out, or flushed, from -- the internal buffer according to the buffer mode: -- -- -- -- An implementation is free to flush the buffer more frequently, but not -- less frequently, than specified above. The output buffer is emptied as -- soon as it has been written out. -- -- Similarly, input occurs according to the buffer mode for the handle: -- -- -- -- The default buffering mode when a handle is opened is -- implementation-dependent and may depend on the file system object -- which is attached to that handle. For most implementations, physical -- files will normally be block-buffered and terminals will normally be -- line-buffered. data BufferMode -- | buffering is disabled if possible. NoBuffering :: BufferMode -- | line-buffering should be enabled if possible. LineBuffering :: BufferMode -- | block-buffering should be enabled if possible. The size of the buffer -- is n items if the argument is Just n and is -- otherwise implementation-dependent. BlockBuffering :: Maybe Int -> BufferMode -- | A mode that determines the effect of hSeek hdl mode -- i. data SeekMode -- | A mutable variable in the IO monad data IORef a -- | Exceptions that occur in the IO monad. An -- IOException records a more specific error type, a descriptive -- string and maybe the handle that was used when the error was flagged. data IOException -- | Any type that you wish to throw or catch as an exception must be an -- instance of the 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 -- | The Const functor. newtype Const a (b :: k) :: forall k. () => Type -> k -> Type Const :: a -> Const a [getConst] :: Const a -> a -- | The sum of a collection of actions, generalizing concat. As of -- base 4.8.0.0, msum is just asum, specialized to -- MonadPlus. msum :: (Foldable t, MonadPlus m) => t (m a) -> m a -- | The sum of a collection of actions, generalizing concat. -- -- asum [Just Hello, Nothing, Just World] Just Hello asum :: (Foldable t, Alternative f) => t (f a) -> f a -- | Evaluate each action in the structure from left to right, and ignore -- the results. For a version that doesn't ignore the results see -- sequenceA. sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f () -- | forM_ is mapM_ with its arguments flipped. For a version -- that doesn't ignore the results see forM. -- -- As of base 4.8.0.0, forM_ is just for_, specialized to -- Monad. forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m () -- | Map each element of a structure to a monadic action, evaluate these -- actions from left to right, and ignore the results. For a version that -- doesn't ignore the results see mapM. -- -- As of base 4.8.0.0, mapM_ is just traverse_, specialized -- to Monad. mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m () -- | Maybe monoid returning the leftmost non-Nothing value. -- -- First a is isomorphic to Alt Maybe -- a, but precedes it historically. -- --
--   >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world"))
--   Just "hello"
--   
-- -- Use of this type is discouraged. Note the following equivalence: -- --
--   Data.Monoid.First x === Maybe (Data.Semigroup.First x)
--   
-- -- In addition to being equivalent in the structural sense, the two also -- have Monoid instances that behave the same. This type will be -- marked deprecated in GHC 8.8, and removed in GHC 8.10. Users are -- advised to use the variant from Data.Semigroup and wrap it in -- Maybe. newtype First a First :: Maybe a -> First a [getFirst] :: First a -> Maybe a -- | The monoid of endomorphisms under composition. -- --
--   >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
--   
--   >>> appEndo computation "Haskell"
--   "Hello, Haskell!"
--   
newtype Endo a Endo :: (a -> a) -> Endo a [appEndo] :: Endo a -> a -> a -- | Monoid under addition. -- --
--   >>> getSum (Sum 1 <> Sum 2 <> mempty)
--   3
--   
newtype Sum a Sum :: a -> Sum a [getSum] :: Sum a -> a -- | 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 -- | Return True if the given value is a Right-value, -- False otherwise. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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 True if the given value is a Left-value, -- False otherwise. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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 -- | 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. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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]) -- | Extracts from a list of Either all the Right elements. -- All the Right elements are extracted in order. -- --

Examples

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

Examples

-- -- Basic usage: -- --
--   >>> let list = [ Left "foo", Right 3, Left "bar", Right 7, Left "baz" ]
--   
--   >>> lefts list
--   ["foo","bar","baz"]
--   
lefts :: () => [Either a b] -> [a] -- | 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) :: forall k. () => k -> Type Proxy :: Proxy -- | Left-to-right composition (>>>) :: Category cat => cat a b -> cat b c -> cat a c infixr 1 >>> -- | See openFile data IOMode ReadMode :: IOMode WriteMode :: IOMode AppendMode :: IOMode ReadWriteMode :: IOMode -- | The member functions of this class facilitate writing values of -- primitive types to raw memory (which may have been allocated with the -- above mentioned routines) and reading values from blocks of raw -- memory. The class, furthermore, includes support for computing the -- storage requirements and alignment restrictions of storable types. -- -- Memory addresses are represented as values of type 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 -- | 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. -- --

Examples

-- -- Basic usage: -- --
--   >>> 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 -- | & 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 & -- | 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 :: () => (b -> b -> c) -> (a -> b) -> a -> a -> c infixl 0 `on` -- | 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' argument, hence the recursion is reintroduced. fix :: () => (a -> a) -> a -- | Flipped version of <$. -- --

Examples

-- -- Replace the contents of a Maybe Int with a -- constant String: -- --
--   >>> 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 $> -- | Flipped version of <$>. -- --
--   (<&>) = flip fmap
--   
-- --

Examples

-- -- Apply (+1) to a list, a Just and a Right: -- --
--   >>> 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 <&> -- | An MVar (pronounced "em-var") is a synchronising variable, used -- for communication between concurrent threads. It can be thought of as -- a box, which may be empty or full. data MVar a -- | Lift a ternary function to actions. liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d -- | Lift a function to actions. This function may be used as a value for -- fmap in a Functor instance. liftA :: Applicative f => (a -> b) -> f a -> f b -- | 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 -- | 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] :: forall e. Exception e => e -> SomeException -- | 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 -- | 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 :: k -> Type) (a :: k) :: forall k. () => Type -> k -> Type -> k -> Type ReaderT :: (r -> m a) -> ReaderT r [runReaderT] :: ReaderT r -> r -> m a -- | Run a pipeline until processing completes. -- -- Since 1.2.1 runConduit :: Monad m => ConduitT () Void m r -> m r -- | 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: -- -- (.|) :: Monad m => ConduitM a b m () -> ConduitM b c m r -> ConduitM a c m r infixr 2 .| -- | Same as ConduitT, for backwards compat type ConduitM = ConduitT -- | 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 value u returned by askUnliftIO, it must -- meet the monad transformer laws as reformulated for -- MonadUnliftIO: -- -- -- -- The third is a currently nameless law which ensures that the current -- context is preserved. -- -- -- -- If you have a name for this, please submit it in a pull request for -- great glory. class MonadIO m => MonadUnliftIO (m :: Type -> Type) -- | Capture the current monadic context, providing the ability to run -- monadic actions in IO. -- -- See UnliftIO for an explanation of why we need a helper -- datatype here. askUnliftIO :: MonadUnliftIO m => m (UnliftIO m) -- | Convenience function for capturing the monadic context and running an -- 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 -- | Class of monads which can perform primitive state-transformer actions class Monad m => PrimMonad (m :: Type -> Type) where { -- | State token type type family PrimState (m :: Type -> Type) :: Type; } -- | Execute a primitive operation primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a -- | The class of monad transformers. Instances should satisfy the -- following laws, which state that lift is a monad -- transformation: -- -- class MonadTrans (t :: Type -> Type -> Type -> Type) -- | Lift a computation from the argument monad to the constructed monad. lift :: (MonadTrans t, Monad m) => m a -> t m a -- | A map of integers to values a. data IntMap a -- | A set of integers. data IntSet -- | A set of values a. data Set 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 -- | the deep analogue of $!. In the expression f $!! x, -- x is fully evaluated before the function f is -- applied to it. ($!!) :: NFData a => (a -> b) -> a -> b infixr 0 $!! -- | 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 -- | 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 -- | (^.) 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 ^. -- | 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 -- | 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 -- | 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 -- | 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 -- | 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 -- | 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 -- | 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. -- -- type Lens s t a b = forall (f :: Type -> Type). Functor f => a -> f b -> s -> f t -- | This is a type alias for monomorphic lenses which don't change the -- type of the container (or of the value inside). type Lens' s a = Lens s s a a -- | Retrieves a function of the current environment. asks :: MonadReader r m => (r -> a) -> m a -- | See examples in 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 -- | 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 -- | Runs a Reader and extracts the final value from it. (The -- inverse of reader.) runReader :: () => Reader r a -> r -> a -- | 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 file path. data File -- | A directory path. data Dir -- | 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 -- | Path of some base and type. -- -- The type variables are: -- -- -- -- Internally is a string. The string can be of two formats only: -- --
    --
  1. File format: file.txt, foo/bar.txt, -- /foo/bar.txt
  2. --
  3. Directory format: foo/, /foo/bar/
  4. --
-- -- All directories end in a trailing separator. There are no duplicate -- path separators //, no .., no ./, no -- ~/, etc. data Path b t -- | 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 () -- | 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 -- | Wrap up a synchronous exception to be treated as an asynchronous -- exception. -- -- This is intended to be created via toAsyncException. data AsyncExceptionWrapper [AsyncExceptionWrapper] :: forall e. Exception e => e -> AsyncExceptionWrapper -- | Wrap up an asynchronous exception to be treated as a synchronous -- exception. -- -- This is intended to be created via toSyncException. data SyncExceptionWrapper [SyncExceptionWrapper] :: forall e. Exception e => e -> SyncExceptionWrapper -- | Generalized version of Handler. data Handler (m :: Type -> Type) a [Handler] :: forall (m :: Type -> Type) a e. Exception e => (e -> m a) -> Handler m a -- | Unlifted catch, but will not catch asynchronous exceptions. catch :: (MonadUnliftIO m, Exception e) => m a -> (e -> m a) -> m a -- | catch specialized to only catching IOExceptions. catchIO :: MonadUnliftIO m => m a -> (IOException -> m a) -> m a -- | catch specialized to catch all synchronous exception. catchAny :: MonadUnliftIO m => m a -> (SomeException -> m a) -> m a -- | Same as catch, but fully force evaluation of the result value -- to find all impure exceptions. catchDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> (e -> m a) -> m a -- | catchDeep specialized to catch all synchronous exception. catchAnyDeep :: (NFData a, MonadUnliftIO m) => m a -> (SomeException -> m a) -> m a -- | 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 version of catch. handle :: (MonadUnliftIO m, Exception e) => (e -> m a) -> m a -> m a -- | handle specialized to only catching IOExceptions. handleIO :: MonadUnliftIO m => (IOException -> m a) -> m a -> m a -- | Flipped version of catchAny. handleAny :: MonadUnliftIO m => (SomeException -> m a) -> m a -> m a -- | Flipped version of catchDeep. handleDeep :: (MonadUnliftIO m, Exception e, NFData a) => (e -> m a) -> m a -> m a -- | Flipped version of catchAnyDeep. handleAnyDeep :: (MonadUnliftIO m, NFData a) => (SomeException -> m a) -> m a -> m a -- | Flipped catchJust. handleJust :: (MonadUnliftIO m, Exception e) => (e -> Maybe b) -> (b -> m a) -> m a -> m a -- | Unlifted try, but will not catch asynchronous exceptions. try :: (MonadUnliftIO m, Exception e) => m a -> m (Either e a) -- | try specialized to only catching IOExceptions. tryIO :: MonadUnliftIO m => m a -> m (Either IOException a) -- | try specialized to catch all synchronous exceptions. tryAny :: MonadUnliftIO m => m a -> m (Either SomeException a) -- | Same as try, but fully force evaluation of the result value to -- find all impure exceptions. tryDeep :: (MonadUnliftIO m, Exception e, NFData a) => m a -> m (Either e a) -- | tryDeep specialized to catch all synchronous exceptions. tryAnyDeep :: (MonadUnliftIO m, NFData a) => m a -> m (Either SomeException 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) -- | 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 -- | Same as upstream catches, but will not catch asynchronous -- exceptions. catches :: MonadUnliftIO m => m a -> [Handler m a] -> m a -- | Same as catches, but fully force evaluation of the result value -- to find all impure exceptions. catchesDeep :: (MonadUnliftIO m, NFData a) => m a -> [Handler m a] -> m a -- | Lifted version of evaluate. evaluate :: MonadIO m => a -> m a -- | Deeply evaluate a value using evaluate and NFData. evaluateDeep :: (MonadIO m, NFData a) => a -> m a -- | Async safe version of bracket. bracket :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c -- | Async safe version of bracket_. bracket_ :: MonadUnliftIO m => m a -> m b -> m c -> m c -- | Async safe version of bracketOnError. bracketOnError :: MonadUnliftIO m => m a -> (a -> m b) -> (a -> m c) -> m c -- | A variant of bracketOnError where the return value from the -- first computation is not required. bracketOnError_ :: MonadUnliftIO m => m a -> m b -> m c -> m c -- | Async safe version of finally. finally :: MonadUnliftIO m => m a -> m b -> m a -- | Like onException, but provides the handler the thrown -- exception. withException :: (MonadUnliftIO m, Exception e) => m a -> (e -> m b) -> m a -- | Async safe version of onException. onException :: MonadUnliftIO m => m a -> m b -> m a -- | Synchronously throw the given exception. throwIO :: (MonadIO m, Exception e) => e -> m a -- | Convert an exception into a synchronous exception. -- -- For synchronous exceptions, this is the same as toException. -- For asynchronous exceptions, this will wrap up the exception with -- SyncExceptionWrapper. toSyncException :: Exception e => e -> SomeException -- | Convert an exception into an asynchronous exception. -- -- For asynchronous exceptions, this is the same as toException. -- For synchronous exceptions, this will wrap up the exception with -- AsyncExceptionWrapper. toAsyncException :: Exception e => e -> SomeException -- | Check if the given exception is synchronous. isSyncException :: Exception e => e -> Bool -- | Check if the given exception is asynchronous. isAsyncException :: Exception e => e -> Bool -- | Unlifted version of mask. mask :: MonadUnliftIO m => ((forall a. () => m a -> m a) -> m b) -> m b -- | Unlifted version of uninterruptibleMask. uninterruptibleMask :: MonadUnliftIO m => ((forall a. () => m a -> m a) -> m b) -> m b -- | Unlifted version of mask_. mask_ :: MonadUnliftIO m => m a -> m a -- | Unlifted version of uninterruptibleMask_. uninterruptibleMask_ :: MonadUnliftIO m => m a -> m a -- | A convenience function for throwing a user error. This is useful for -- cases where it would be too high a burden to define your own exception -- type. -- -- This throws an exception of type StringException. When GHC -- supports it (base 4.9 and GHC 8.0 and onward), it includes a call -- stack. throwString :: (MonadIO m, HasCallStack) => String -> m a -- | Smart constructor for a StringException that deals with the -- call stack. stringException :: HasCallStack -> String -> StringException -- | Throw an asynchronous exception to another thread. -- -- Synchronously typed exceptions will be wrapped into an -- 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 () -- | Generate a pure value which, when forced, will synchronously throw the -- given exception. -- -- Generally it's better to avoid using this function and instead use -- throwIO, see -- https://github.com/fpco/safe-exceptions#quickstart. impureThrow :: Exception e => e -> a -- | Unwrap an Either value, throwing its Left value as a -- runtime exception via throwIO if present. fromEither :: (Exception e, MonadIO m) => Either e a -> m a -- | 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 -- | Unlifted Concurrently. newtype Concurrently (m :: Type -> Type) a Concurrently :: m a -> Concurrently a [runConcurrently] :: Concurrently a -> m a -- | Unlifted async. async :: MonadUnliftIO m => m a -> m (Async a) -- | 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 withAsync. withAsync :: MonadUnliftIO m => m a -> (Async a -> m b) -> m b -- | 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 wait. wait :: MonadIO m => Async a -> m a -- | Lifted poll. poll :: MonadIO m => Async a -> m (Maybe (Either SomeException a)) -- | Lifted waitCatch. waitCatch :: MonadIO m => Async a -> m (Either SomeException a) -- | Lifted cancel. cancel :: MonadIO m => Async a -> m () -- | Lifted uninterruptibleCancel. uninterruptibleCancel :: MonadIO m => Async a -> m () -- | Lifted cancelWith. Additionally uses toAsyncException to -- ensure async exception safety. cancelWith :: (Exception e, MonadIO m) => Async a -> e -> m () -- | Lifted waitAny. waitAny :: MonadIO m => [Async a] -> m (Async a, a) -- | Lifted waitAnyCatch. waitAnyCatch :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) -- | Lifted waitAnyCancel. waitAnyCancel :: MonadIO m => [Async a] -> m (Async a, a) -- | Lifted waitAnyCatchCancel. waitAnyCatchCancel :: MonadIO m => [Async a] -> m (Async a, Either SomeException a) -- | Lifted waitEither. waitEither :: MonadIO m => Async a -> Async b -> m (Either a b) -- | Lifted waitEitherCatch. waitEitherCatch :: MonadIO m => Async a -> Async b -> m (Either (Either SomeException a) (Either SomeException b)) -- | Lifted waitEitherCancel. waitEitherCancel :: MonadIO m => Async a -> Async b -> m (Either a 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 () -- | Lifted waitBoth. waitBoth :: MonadIO m => Async a -> Async b -> m (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 (a, b) -- | Unlifted concurrently_. concurrently_ :: MonadUnliftIO m => m a -> m b -> m () -- | Unlifted mapConcurrently. mapConcurrently :: (MonadUnliftIO m, Traversable t) => (a -> m b) -> t a -> m (t b) -- | Unlifted forConcurrently. forConcurrently :: (MonadUnliftIO m, Traversable t) => t a -> (a -> m b) -> m (t b) -- | Unlifted mapConcurrently_. mapConcurrently_ :: (MonadUnliftIO m, Foldable f) => (a -> m b) -> f a -> m () -- | Unlifted forConcurrently_. forConcurrently_ :: (MonadUnliftIO m, Foldable f) => f a -> (a -> m b) -> m () -- | Unlifted replicateConcurrently. replicateConcurrently :: MonadUnliftIO m => Int -> m a -> m [a] -- | Unlifted replicateConcurrently_. replicateConcurrently_ :: MonadUnliftIO m => Int -> m a -> 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 hClose hClose :: MonadIO m => Handle -> m () -- | Lifted version of hFlush hFlush :: MonadIO m => Handle -> m () -- | 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 hGetBuffering hGetBuffering :: MonadIO m => Handle -> m BufferMode -- | Lifted version of hSeek hSeek :: MonadIO m => Handle -> SeekMode -> Integer -> 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 hIsSeekable hIsSeekable :: MonadIO m => Handle -> m Bool -- | Lifted version of hIsTerminalDevice hIsTerminalDevice :: 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 hWaitForInput hWaitForInput :: MonadIO m => Handle -> Int -> m Bool -- | Lifted version of hReady hReady :: MonadIO m => Handle -> m Bool -- | Get the number of seconds which have passed since an arbitrary -- starting time, useful for calculating runtime in a program. getMonotonicTime :: MonadIO m => m Double -- | Lifted 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 () -- | Lifted modifyIORef. modifyIORef :: MonadIO m => IORef a -> (a -> a) -> m () -- | Lifted modifyIORef'. modifyIORef' :: MonadIO m => IORef a -> (a -> a) -> m () -- | Lifted atomicModifyIORef. atomicModifyIORef :: MonadIO m => IORef a -> (a -> (a, b)) -> m b -- | Lifted atomicModifyIORef'. atomicModifyIORef' :: MonadIO m => IORef a -> (a -> (a, b)) -> m b -- | Lifted atomicWriteIORef. atomicWriteIORef :: MonadIO m => IORef a -> a -> m () -- | Unlifted mkWeakIORef. mkWeakIORef :: MonadUnliftIO m => IORef a -> m () -> m (Weak (IORef 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 putMVar. putMVar :: MonadIO m => MVar a -> a -> m () -- | Lifted readMVar. readMVar :: MonadIO m => MVar a -> m a -- | Lifted swapMVar. swapMVar :: MonadIO m => MVar a -> a -> m a -- | Lifted tryTakeMVar. tryTakeMVar :: MonadIO m => MVar a -> m (Maybe a) -- | Lifted tryPutMVar. tryPutMVar :: MonadIO m => MVar a -> a -> m Bool -- | Lifted isEmptyMVar. isEmptyMVar :: MonadIO m => MVar a -> m Bool -- | Lifted tryReadMVar. tryReadMVar :: MonadIO m => MVar a -> m (Maybe a) -- | Unlifted withMVar. withMVar :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b -- | Unlifted withMVarMasked. withMVarMasked :: MonadUnliftIO m => MVar a -> (a -> m b) -> m b -- | Unlifted modifyMVar_. modifyMVar_ :: MonadUnliftIO m => MVar a -> (a -> m a) -> m () -- | 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)) -- | A "run once" value, with results saved. Extract the value with -- runMemoized. For single-threaded usage, you can use -- memoizeRef to create a value. If you need guarantees that only -- one thread will run the action at a time, use memoizeMVar. -- -- Note that this type provides a Show instance for convenience, -- but not useful information can be provided. data Memoized a -- | 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) -- | Lifted version of atomically atomically :: MonadIO m => STM a -> m a -- | Renamed retry for unqualified export retrySTM :: () => STM a -- | Renamed check for unqualified export checkSTM :: Bool -> STM () -- | Lifted version of newTVarIO newTVarIO :: MonadIO m => a -> m (TVar a) -- | Lifted version of readTVarIO readTVarIO :: MonadIO m => TVar a -> m a -- | Lifted version of registerDelay registerDelay :: MonadIO m => Int -> m (TVar Bool) -- | Lifted version of mkWeakTVar mkWeakTVar :: MonadUnliftIO m => TVar a -> m () -> m (Weak (TVar a)) -- | Lifted version of newTMVarIO newTMVarIO :: MonadIO m => a -> m (TMVar a) -- | Lifted version of newEmptyTMVarIO newEmptyTMVarIO :: MonadIO m => m (TMVar a) -- | Lifted version of mkWeakTMVar mkWeakTMVar :: MonadUnliftIO m => TMVar a -> m () -> m (Weak (TMVar a)) -- | 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) -- | 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 -- | 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 -- | 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 -- | Unlifted timeout. timeout :: MonadUnliftIO m => Int -> m a -> m (Maybe a) -- | A helper function for implementing MonadUnliftIO instances. -- Useful for the common case where you want to simply delegate to the -- underlying transformer. -- --

Example

-- --
--   newtype AppT m a = AppT { unAppT :: ReaderT Int (ResourceT m) a }
--     deriving (Functor, Applicative, Monad, MonadIO)
--     -- Unfortunately, deriving MonadUnliftIO does not work.
--   
--   instance MonadUnliftIO m => 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 -- | Convert an action in m to an action in IO. toIO :: MonadUnliftIO m => m a -> m (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 -- | 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) -- | The ability to run any monadic action m a as IO a. -- -- This is more precisely a natural transformation. We need to new -- datatype (instead of simply using a forall) due to lack of -- support in GHC for impredicative types. newtype UnliftIO (m :: Type -> Type) UnliftIO :: (forall a. () => m a -> IO a) -> UnliftIO [unliftIO] :: UnliftIO -> forall a. () => m a -> IO a -- | TBQueue is an abstract type representing a bounded FIFO -- channel. data TBQueue a -- | Builds and returns a new instance of TBQueue. newTBQueue :: () => Natural -> STM (TBQueue a) -- | Write a value to a TBQueue; blocks if the queue is full. writeTBQueue :: () => TBQueue a -> a -> STM () -- | Read the next value from the TBQueue. readTBQueue :: () => TBQueue a -> STM a -- | A version of readTBQueue which does not retry. Instead it -- returns Nothing if no value is available. tryReadTBQueue :: () => TBQueue a -> STM (Maybe a) -- | Get the next value from the TBQueue without removing it, -- retrying if the channel is empty. peekTBQueue :: () => TBQueue a -> STM a -- | A version of peekTBQueue which does not retry. Instead it -- returns Nothing if no value is available. tryPeekTBQueue :: () => TBQueue a -> STM (Maybe a) -- | Put a data item back onto a channel, where it will be the next item -- read. Blocks if the queue is full. unGetTBQueue :: () => TBQueue a -> a -> STM () -- | Returns True if the supplied TBQueue is empty. isEmptyTBQueue :: () => TBQueue a -> STM Bool -- | Returns True if the supplied TBQueue is full. isFullTBQueue :: () => TBQueue a -> STM Bool -- | TChan is an abstract type representing an unbounded FIFO -- channel. data TChan a -- | Build and return a new instance of TChan newTChan :: () => STM (TChan a) -- | Create a write-only TChan. More precisely, readTChan -- will retry even after items have been written to the channel. -- The only way to read a broadcast channel is to duplicate it with -- dupTChan. -- -- Consider a server that broadcasts messages to clients: -- --
--   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) -- | 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 -- | Create a TMVar which contains the supplied value. newTMVar :: () => a -> STM (TMVar a) -- | Create a TMVar which is initially empty. newEmptyTMVar :: () => STM (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 -- | Check whether a given TMVar is empty. isEmptyTMVar :: () => TMVar a -> STM Bool -- | TQueue is an abstract type representing an unbounded FIFO -- channel. data TQueue 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 () -- | Swap the contents of a TVar for a new value. swapTVar :: () => TVar a -> a -> STM a traceDisplayStack :: Display a => a -> b -> b traceDisplayMarkerIO :: (Display a, MonadIO m) => a -> m () traceDisplayMarker :: Display a => a -> b -> b traceDisplayEventIO :: (Display a, MonadIO m) => a -> m () traceDisplayEvent :: Display a => a -> b -> b traceDisplayM :: (Display a, Applicative f) => a -> f () traceDisplayIO :: (Display a, MonadIO m) => a -> m () traceDisplayId :: Display a => a -> a traceDisplay :: Display a => a -> b -> b traceShowStack :: Show a => a -> b -> b traceShowMarkerIO :: (Show a, MonadIO m) => a -> m () traceShowMarker :: Show a => a -> b -> b traceShowEventIO :: (Show a, MonadIO m) => a -> m () traceShowEvent :: Show a => a -> b -> b traceShowM :: (Show a, Applicative f) => a -> f () traceShowIO :: (Show a, MonadIO m) => a -> m () traceShowId :: Show a => a -> a traceShow :: Show a => a -> b -> b traceStack :: () => Text -> a -> a traceMarkerIO :: MonadIO m => Text -> m () traceMarker :: () => Text -> a -> a traceEventIO :: MonadIO m => Text -> m () traceEvent :: () => Text -> a -> a traceM :: Applicative f => Text -> f () traceIO :: MonadIO m => Text -> m () traceId :: Text -> Text trace :: () => Text -> a -> a -- | Run with a default configured SimpleApp, consisting of: -- -- runSimpleApp :: MonadIO m => RIO SimpleApp a -> m 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 -- | create a new unboxed SomeRef newUnboxedSomeRef :: (MonadIO m, Unbox a) => a -> m (SomeRef a) -- | create a new boxed SomeRef newSomeRef :: MonadIO m => a -> m (SomeRef a) -- | Modify a SomeRef This function is subject to change due to the lack of -- atomic operations modifySomeRef :: MonadIO m => SomeRef a -> (a -> a) -> m () -- | Write to a SomeRef writeSomeRef :: MonadIO m => SomeRef a -> a -> m () -- | Read from a SomeRef readSomeRef :: MonadIO m => SomeRef a -> m a liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a runRIO :: MonadIO m => env -> RIO env a -> m a -- | The Reader+IO monad. This is different from a ReaderT because: -- -- newtype RIO env a RIO :: ReaderT env IO a -> RIO env a [unRIO] :: RIO env a -> ReaderT env IO a -- | Abstraction over how to read from and write to a mutable reference data SomeRef a -- | Environment values with stateful capabilities to SomeRef class HasStateRef s env | env -> s stateRefL :: HasStateRef s env => Lens' env (SomeRef s) -- | Environment values with writing capabilities to SomeRef class HasWriteRef w env | env -> w writeRefL :: HasWriteRef w env => Lens' env (SomeRef w) -- | Modify a value in a 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 () -- | 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 () -- | Read the value in a URef readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a -- | Create a new URef newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a) -- | 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 -- | Helpful type synonym for using a URef from an IO-based -- stack. type IOURef = URef PrimState IO decodeUtf8Lenient :: ByteString -> Text tshow :: Show a => a -> Text -- | Disable logging capabilities in a given sub-routine -- -- Intended to skip logging in general purpose implementations, where -- secrets might be logged accidently. noLogging :: (HasLogFunc env, MonadReader env m) => m a -> m a -- | Is the log func configured to use color output? -- -- Intended for use by code which wants to optionally add additional -- color to its log messages. logFuncUseColorL :: HasLogFunc env => SimpleGetter env Bool -- | Convert a CallStack value into a Utf8Builder indicating -- the first source location. -- -- TODO Consider showing the entire call stack instead. displayCallStack :: CallStack -> Utf8Builder -- | Use code location in the log output. -- -- Default: true if in verbose mode, false otherwise. setLogUseLoc :: Bool -> LogOptions -> LogOptions -- | Use ANSI color codes in the log output. -- -- Default: true if in verbose mode and the Handle is a -- terminal device. setLogUseColor :: Bool -> LogOptions -> LogOptions -- | Include the time when printing log messages. -- -- Default: true in debug mode, false otherwise. setLogUseTime :: Bool -> LogOptions -> LogOptions -- | Do we treat output as a terminal. If True, we will enabled -- sticky logging functionality. -- -- Default: checks if the Handle provided to -- logOptionsHandle is a terminal with hIsTerminalDevice. setLogTerminal :: 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 -- | Use the verbose format for printing log messages. -- -- Default: follows the value of the verbose flag. setLogVerboseFormat :: Bool -> 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 -- | Set the minimum log level. Messages below this level will not be -- printed. -- -- Default: in verbose mode, LevelDebug. Otherwise, -- LevelInfo. setLogMinLevel :: LogLevel -> LogOptions -> LogOptions -- | Given a LogOptions value, run the given function with the -- specified LogFunc. A common way to use this function is: -- --
--   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 -- | Given a LogOptions value, returns both a new LogFunc and -- a sub-routine that disposes it. -- -- Intended for use if you want to deal with the teardown of -- LogFunc yourself, otherwise prefer the withLogFunc -- function instead. -- -- @since 0.1.3.0 newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ()) -- | 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. logOptionsHandle :: MonadIO m => Handle -> Bool -> m LogOptions -- | 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) -- | 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 () -- | 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 () -- | Log a message with the specified textual level and the given source. logOtherS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> LogSource -> Utf8Builder -> m () -- | Log an error level message with the given source. logErrorS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () -- | Log a warn level message with the given source. logWarnS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () -- | Log an info level message with the given source. logInfoS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () -- | Log a debug level message with the given source. logDebugS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m () -- | Log a message with the specified textual level and no source. logOther :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> Utf8Builder -> m () -- | Log an error level message with no source. logError :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () -- | Log a warn level message with no source. logWarn :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () -- | Log an info level message with no source. logInfo :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () -- | Log a debug level message with no source. logDebug :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m () -- | Generic, basic function for creating other logging functions. logGeneric :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> LogLevel -> Utf8Builder -> m () -- | Create a LogFunc from the given function. mkLogFunc :: (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> LogFunc -- | The log level of a message. data LogLevel LevelDebug :: LogLevel LevelInfo :: LogLevel LevelWarn :: LogLevel LevelError :: LogLevel LevelOther :: !Text -> LogLevel -- | Where in the application a log message came from. Used for display -- purposes only. type LogSource = Text -- | Environment values with a logging function. class HasLogFunc env logFuncL :: HasLogFunc env => Lens' env LogFunc -- | A logging function, wrapped in a newtype for better error messages. -- -- An implementation may choose any behavior of this value it wishes, -- including printing to standard output or no action at all. data LogFunc -- | Configuration for how to create a LogFunc. Intended to be used -- with the withLogFunc function. data LogOptions fromStrictBytes :: ByteString -> LByteString toStrictBytes :: LByteString -> ByteString sappend :: Semigroup s => s -> s -> s type UVector = Vector type SVector = Vector type GVector = Vector type LByteString = ByteString type LText = Text -- | Helper function to force an action to run in IO. Especially -- useful for overly general contexts, like hspec tests. asIO :: () => IO a -> IO a -- | Run the second value if the first value returns False unlessM :: Monad m => m Bool -> m () -> m () -- | Run the second value if the first value returns True whenM :: Monad m => m Bool -> m () -> m () -- | Strip out duplicates nubOrd :: Ord a => [a] -> [a] -- | Extend foldMap to allow side effects. -- -- Internally, this is implemented using a strict left fold. This is used -- for performance reasons. It also necessitates that this function has a -- Monad constraint and not just an Applicative -- constraint. For more information, see -- https://github.com/commercialhaskell/rio/pull/99#issuecomment-394179757. foldMapM :: (Monad m, Monoid w, Foldable t) => (a -> m w) -> t a -> m w -- |
--   forMaybeM == flip mapMaybeM
--   
forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b] -- | Monadic mapMaybe. mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b] -- |
--   forMaybeA == flip mapMaybeA
--   
forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b] -- | Applicative mapMaybe. mapMaybeA :: Applicative f => (a -> f (Maybe b)) -> [a] -> f [b] -- | Get a First value with a default fallback fromFirst :: () => a -> First a -> a -- | Apply a function to a Left constructor mapLeft :: () => (a1 -> a2) -> Either a1 b -> Either a2 b -- | Read a file in UTF8 encoding, throwing an exception on invalid -- character encoding. -- -- This function will use OS-specific line ending handling. readFileUtf8 :: MonadIO m => FilePath -> m Text -- | Same as writeFile, but generalized to MonadIO writeFileBinary :: MonadIO m => FilePath -> ByteString -> m () -- | Same as readFile, but generalized to MonadIO readFileBinary :: MonadIO m => FilePath -> m ByteString hPutBuilder :: MonadIO m => Handle -> Builder -> m () -- | Write a file in UTF8 encoding -- -- This function will use OS-specific line ending handling. writeFileUtf8 :: MonadIO m => FilePath -> Text -> m () -- | Lazily get the contents of a file. Unlike readFile, this -- ensures that if an exception is thrown, the file handle is closed -- immediately. withLazyFile :: MonadUnliftIO m => FilePath -> (ByteString -> m a) -> m a yieldThread :: MonadIO m => m () view :: MonadReader s m => Getting a s a -> m a -- | Write the given Utf8Builder value to a file. writeFileUtf8Builder :: MonadIO m => FilePath -> Utf8Builder -> m () -- | Convert a Utf8Builder value into a lazy Text. utf8BuilderToLazyText :: Utf8Builder -> Text -- | Convert a Utf8Builder value into a strict Text. utf8BuilderToText :: Utf8Builder -> Text -- | Convert a ByteString into a Utf8Builder. -- -- NOTE This function performs no checks to ensure that the data -- is, in fact, UTF8 encoded. If you provide non-UTF8 data, later -- functions may fail. displayBytesUtf8 :: ByteString -> Utf8Builder -- | Use the Show instance for a value to convert it to a -- Utf8Builder. displayShow :: Show a => a -> Utf8Builder -- | A builder of binary data, with the invariant that the underlying data -- is supposed to be UTF-8 encoded. newtype Utf8Builder Utf8Builder :: Builder -> Utf8Builder [getUtf8Builder] :: Utf8Builder -> Builder -- | A typeclass for values which can be converted to a Utf8Builder. -- The intention of this typeclass is to provide a human-friendly display -- of the data. class Display a display :: Display a => a -> Utf8Builder -- | Boxed vectors, supporting efficient slicing. data Vector a class (Vector Vector a, MVector MVector a) => Unbox a -- | A set of values. A set cannot contain duplicate values. data HashSet a -- | Lifted version of myThreadId. myThreadId :: MonadIO m => m ThreadId -- | Lifted version of threadDelay. threadDelay :: MonadIO m => Int -> m () -- | Lifted version of threadWaitRead. threadWaitRead :: MonadIO m => Fd -> m () -- | Lifted version of threadWaitWrite. threadWaitWrite :: MonadIO m => Fd -> m () -- | Lifted version of isCurrentThreadBound. isCurrentThreadBound :: MonadIO m => m Bool -- | An exception type for representing Unicode encoding errors. data UnicodeException -- | Could not decode a byte sequence because it was invalid under the -- given encoding, or ran out of input in mid-decode. DecodeError :: String -> Maybe Word8 -> UnicodeException -- | Tried to encode a character that could not be represented under the -- given encoding, or ran out of input in mid-encode. EncodeError :: String -> Maybe Char -> UnicodeException -- | Replace an invalid input byte with the Unicode replacement character -- U+FFFD. lenientDecode :: OnDecodeError -- | Decode a ByteString containing UTF-8 encoded text. -- -- NOTE: The replacement character returned by -- OnDecodeError MUST be within the BMP plane; surrogate code -- points will automatically be remapped to the replacement char -- U+FFFD (since 0.11.3.0), whereas code points beyond -- the BMP will throw an error (since 1.2.3.1); For earlier -- versions of text using those unsupported code points would -- result in undefined behavior. 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 -- | Encode text using UTF-8 encoding. encodeUtf8 :: Text -> ByteString -- | The Store typeclass provides efficient serialization and -- deserialization to raw pointer addresses. -- -- The peek and poke methods should be defined such that -- decodeEx (encode x) == x . class Store a module Stack.Options.Utils -- | If argument is True, hides the option from usage and help hideMods :: Bool -> Mod f a -- | Allows adjust global options depending on their context Note: This was -- being used to remove ambibuity between the local and global -- implementation of stack init --resolver option. Now that stack init -- has no local --resolver this is not being used anymore but the code is -- kept for any similar future use cases. data GlobalOptsContext -- | Global options before subcommand name OuterGlobalOpts :: GlobalOptsContext -- | Global options following any other subcommand OtherCmdGlobalOpts :: GlobalOptsContext BuildCmdGlobalOpts :: GlobalOptsContext GhciCmdGlobalOpts :: GlobalOptsContext instance GHC.Classes.Eq Stack.Options.Utils.GlobalOptsContext instance GHC.Show.Show Stack.Options.Utils.GlobalOptsContext module Stack.Options.LogLevelParser -- | Parser for a logging level. logLevelOptsParser :: Bool -> Maybe LogLevel -> Parser (Maybe LogLevel) module Stack.Ghci.Script data GhciScript -- | A valid Haskell module name. data ModuleName cmdAdd :: Set (Either ModuleName (Path Abs File)) -> GhciScript cmdCdGhc :: Path Abs Dir -> GhciScript cmdModule :: Set ModuleName -> GhciScript scriptToLazyByteString :: GhciScript -> LByteString scriptToBuilder :: GhciScript -> Builder scriptToFile :: Path Abs File -> GhciScript -> IO () instance GHC.Show.Show Stack.Ghci.Script.GhciCommand instance GHC.Base.Semigroup Stack.Ghci.Script.GhciScript instance GHC.Base.Monoid Stack.Ghci.Script.GhciScript module Stack.FileWatch fileWatch :: Handle -> ((Set (Path Abs File) -> IO ()) -> IO ()) -> IO () fileWatchPoll :: Handle -> ((Set (Path Abs File) -> IO ()) -> IO ()) -> IO () -- | Finding files. module Path.Find -- | Find the location of a file matching the given predicate. findFileUp :: (MonadIO m, MonadThrow m) => Path Abs Dir -> (Path Abs File -> Bool) -> Maybe (Path Abs Dir) -> m (Maybe (Path Abs File)) -- | Find the location of a directory matching the given predicate. findDirUp :: (MonadIO m, MonadThrow m) => Path Abs Dir -> (Path Abs Dir -> Bool) -> Maybe (Path Abs Dir) -> m (Maybe (Path Abs Dir)) -- | Find files matching predicate below a root directory. -- -- NOTE: this skips symbolic directory links, to avoid loops. This may -- not make sense for all uses of file finding. -- -- TODO: write one of these that traverses symbolic links but efficiently -- ignores loops. findFiles :: Path Abs Dir -> (Path Abs File -> Bool) -> (Path Abs Dir -> Bool) -> IO [Path Abs File] -- | 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) -- | 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 -> (a -> b) -> Parser c -> Parser a -> ExceptT b (Writer (Mod CommandFields (b, c))) () -- | Add a command that takes sub-commands to the options dispatcher. addSubCommands :: Monoid c => String -> String -> String -> Parser c -> ExceptT b (Writer (Mod CommandFields (b, c))) () -> ExceptT b (Writer (Mod CommandFields (b, c))) () -- | Generate and execute a complicated options parser. complicatedOptions :: Monoid a => Version -> Maybe String -> String -> String -> String -> String -> Parser a -> Maybe (ParserFailure ParserHelp -> [String] -> IO (a, (b, a))) -> ExceptT b (Writer (Mod CommandFields (b, a))) () -> IO (a, b) -- | Generate a complicated options parser. complicatedParser :: Monoid a => String -> Parser a -> ExceptT b (Writer (Mod CommandFields (b, a))) () -> Parser (a, (b, a)) -- | Extra functions for optparse-applicative. module Options.Applicative.Builder.Extra -- | Enable/disable flags for a 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 -- | Enable/disable flags for a (Maybe Bool). maybeBoolFlags :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (Maybe Bool) -- | Like maybeBoolFlags, but parsing a First. firstBoolFlags :: String -> String -> Mod FlagFields (Maybe Bool) -> Parser (First Bool) -- | Enable/disable flags for any type. enableDisableFlags :: a -> a -> a -> String -> String -> Mod FlagFields a -> Parser a -- | Enable/disable flags for any type, without a default (to allow -- chaining with <|>) 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) 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 [pcoAbsolute] :: PathCompleterOpts -> Bool [pcoRelative] :: PathCompleterOpts -> Bool [pcoRootDir] :: PathCompleterOpts -> Maybe FilePath [pcoFileFilter] :: PathCompleterOpts -> FilePath -> Bool [pcoDirFilter] :: PathCompleterOpts -> FilePath -> Bool defaultPathCompleterOpts :: PathCompleterOpts pathCompleterWith :: PathCompleterOpts -> Completer unescapeBashArg :: String -> String module Stack.Options.SolverParser -- | Parser for solverCmd solverOptsParser :: Parser Bool -- | Tag a Store instance with structural version info to ensure we're -- reading a compatible format. module Data.Store.VersionTagged versionedEncodeFile :: Data a => VersionConfig a -> Q Exp versionedDecodeOrLoad :: Data a => VersionConfig a -> Q Exp versionedDecodeFile :: Data a => VersionConfig a -> Q Exp storeVersionConfig :: String -> String -> VersionConfig a module Data.Monoid.Map -- | Utility newtype wrapper to make make Map's Monoid also use the -- element's Monoid. newtype MonoidMap k a MonoidMap :: Map k a -> MonoidMap k a instance GHC.Base.Functor (Data.Monoid.Map.MonoidMap k) instance GHC.Generics.Generic (Data.Monoid.Map.MonoidMap k a) instance (GHC.Show.Show k, GHC.Show.Show a) => GHC.Show.Show (Data.Monoid.Map.MonoidMap k a) instance (GHC.Classes.Ord k, GHC.Read.Read k, GHC.Read.Read a) => GHC.Read.Read (Data.Monoid.Map.MonoidMap k a) instance (GHC.Classes.Ord k, GHC.Classes.Ord a) => GHC.Classes.Ord (Data.Monoid.Map.MonoidMap k a) instance (GHC.Classes.Eq k, GHC.Classes.Eq a) => GHC.Classes.Eq (Data.Monoid.Map.MonoidMap k a) instance (GHC.Classes.Ord k, GHC.Base.Semigroup a) => GHC.Base.Semigroup (Data.Monoid.Map.MonoidMap k a) instance (GHC.Classes.Ord k, GHC.Base.Semigroup a) => GHC.Base.Monoid (Data.Monoid.Map.MonoidMap k a) module Data.IORef.RunOnce runOnce :: (MonadUnliftIO m, MonadIO n) => m a -> m (n a) -- | More readable combinators for writing parsers. module Data.Attoparsec.Combinators -- | Concatenate two parsers. appending :: (Applicative f, Semigroup a) => f a -> f a -> f a -- | Alternative parsers. alternating :: Alternative f => f a -> f a -> f a -- | Pure something. pured :: (Applicative g, Applicative f) => g a -> g (f a) -- | Concatting the result of an action. concating :: (Monoid m, Applicative f) => f [m] -> f m -- | Parsing of stack command line arguments module Data.Attoparsec.Args -- | Mode for parsing escape characters. data EscapingMode Escaping :: EscapingMode NoEscaping :: EscapingMode -- | A basic argument parser. It supports space-separated text, and string -- quotation with identity escaping: x -> 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.Enum.Enum Data.Attoparsec.Args.EscapingMode instance GHC.Classes.Eq Data.Attoparsec.Args.EscapingMode instance GHC.Show.Show Data.Attoparsec.Args.EscapingMode -- | Accepting arguments to be passed through to a sub-process. module Options.Applicative.Args -- | An argument which accepts a list of arguments e.g. -- --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]) -- | Extensions to Aeson parsing of objects. module Data.Aeson.Extended -- | Like decodeFileStrict' but returns an error message when -- decoding fails. eitherDecodeFileStrict' :: FromJSON a => FilePath -> IO (Either String a) -- | Like decodeStrict' but returns an error message when decoding -- fails. eitherDecodeStrict' :: FromJSON a => ByteString -> Either String a -- | Like decode' but returns an error message when decoding fails. eitherDecode' :: FromJSON a => ByteString -> Either String a -- | Like decodeFileStrict but returns an error message when -- decoding fails. eitherDecodeFileStrict :: FromJSON a => FilePath -> IO (Either String a) -- | Like decodeStrict but returns an error message when decoding -- fails. eitherDecodeStrict :: FromJSON a => ByteString -> Either String a -- | Like decode but returns an error message when decoding fails. eitherDecode :: FromJSON a => ByteString -> Either String a -- | Efficiently deserialize a JSON value from a file. If this fails due to -- incomplete or invalid input, Nothing is returned. -- -- The input file's content must consist solely of a JSON document, with -- no trailing data except for whitespace. -- -- This function parses and performs conversion immediately. See -- json' for details. decodeFileStrict' :: FromJSON a => FilePath -> IO (Maybe a) -- | Efficiently deserialize a JSON value from a strict ByteString. -- If this fails due to incomplete or invalid input, Nothing is -- returned. -- -- The input must consist solely of a JSON document, with no trailing -- data except for whitespace. -- -- This function parses and performs conversion immediately. See -- json' for details. decodeStrict' :: FromJSON a => ByteString -> Maybe a -- | Efficiently deserialize a JSON value from a lazy ByteString. If -- this fails due to incomplete or invalid input, Nothing is -- returned. -- -- The input must consist solely of a JSON document, with no trailing -- data except for whitespace. -- -- This function parses and performs conversion immediately. See -- json' for details. decode' :: FromJSON a => ByteString -> Maybe a -- | Efficiently deserialize a JSON value from a file. If this fails due to -- incomplete or invalid input, Nothing is returned. -- -- The input file's content must consist solely of a JSON document, with -- no trailing data except for whitespace. -- -- This function parses immediately, but defers conversion. See -- json for details. decodeFileStrict :: FromJSON a => FilePath -> IO (Maybe a) -- | Efficiently deserialize a JSON value from a strict ByteString. -- If this fails due to incomplete or invalid input, Nothing is -- returned. -- -- The input must consist solely of a JSON document, with no trailing -- data except for whitespace. -- -- This function parses immediately, but defers conversion. See -- json for details. decodeStrict :: FromJSON a => ByteString -> Maybe a -- | Efficiently deserialize a JSON value from a lazy ByteString. If -- this fails due to incomplete or invalid input, Nothing is -- returned. -- -- The input must consist solely of a JSON document, with no trailing -- data except for whitespace. -- -- This function parses immediately, but defers conversion. See -- json for details. decode :: FromJSON a => ByteString -> Maybe a -- | Efficiently serialize a JSON value as a lazy ByteString and -- write it to a file. encodeFile :: ToJSON a => FilePath -> a -> IO () -- | Efficiently serialize a JSON value as a lazy ByteString. -- -- This is implemented in terms of the ToJSON class's -- toEncoding method. encode :: ToJSON a => a -> ByteString -- | Encode a Foldable as a JSON array. foldable :: (Foldable t, ToJSON a) => t a -> Encoding type GToJSON = GToJSON Value type GToEncoding = GToJSON Encoding -- | Lift the standard toEncoding function through the type -- constructor. toEncoding2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Encoding -- | Lift the standard toJSON function through the type constructor. toJSON2 :: (ToJSON2 f, ToJSON a, ToJSON b) => f a b -> Value -- | Lift the standard toEncoding function through the type -- constructor. toEncoding1 :: (ToJSON1 f, ToJSON a) => f a -> Encoding -- | Lift the standard toJSON function through the type constructor. toJSON1 :: (ToJSON1 f, ToJSON a) => f a -> Value -- | A configurable generic JSON encoder. This function applied to -- defaultOptions is used as the default for liftToEncoding -- when the type is an instance of Generic1. genericLiftToEncoding :: (Generic1 f, GToJSON Encoding One (Rep1 f)) => Options -> (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding -- | A configurable generic JSON encoder. This function applied to -- defaultOptions is used as the default for toEncoding -- when the type is an instance of Generic. genericToEncoding :: (Generic a, GToJSON Encoding Zero (Rep a)) => Options -> a -> Encoding -- | A configurable generic JSON creator. This function applied to -- defaultOptions is used as the default for liftToJSON -- when the type is an instance of Generic1. genericLiftToJSON :: (Generic1 f, GToJSON Value One (Rep1 f)) => Options -> (a -> Value) -> ([a] -> Value) -> f a -> Value -- | A configurable generic JSON creator. This function applied to -- defaultOptions is used as the default for toJSON when -- the type is an instance of Generic. genericToJSON :: (Generic a, GToJSON Value Zero (Rep a)) => Options -> a -> Value -- | A ToArgs value either stores nothing (for ToJSON) or it -- stores the two function arguments that encode occurrences of the type -- parameter (for ToJSON1). data ToArgs res arity a [NoToArgs] :: forall res arity a. () => ToArgs res Zero a [To1Args] :: forall res arity a. () => (a -> res) -> ([a] -> res) -> ToArgs res One a -- | A type that can be converted to JSON. -- -- Instances in general must specify toJSON and -- should (but don't need to) specify toEncoding. -- -- An example type and instance: -- --
--   -- Allow ourselves to write Text literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance ToJSON Coord where
--     toJSON (Coord x y) = object ["x" .= x, "y" .= y]
--   
--     toEncoding (Coord x y) = pairs ("x" .= x <> "y" .= y)
--   
-- -- Instead of manually writing your ToJSON instance, there are two -- options to do it automatically: -- -- -- -- To use the second, simply add a deriving Generic -- clause to your datatype and declare a ToJSON instance. If you -- require nothing other than defaultOptions, it is sufficient to -- write (and this is the only alternative where the default -- toJSON implementation is sufficient): -- --
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving Generic
--   
--   instance ToJSON Coord where
--       toEncoding = genericToEncoding defaultOptions
--   
-- -- If on the other hand you wish to customize the generic decoding, you -- have to implement both methods: -- --
--   customOptions = defaultOptions
--                   { fieldLabelModifier = map toUpper
--                   }
--   
--   instance ToJSON Coord where
--       toJSON     = genericToJSON customOptions
--       toEncoding = genericToEncoding customOptions
--   
-- -- Previous versions of this library only had the toJSON method. -- Adding toEncoding had two reasons: -- --
    --
  1. toEncoding is more efficient for the common case that the output -- of toJSON is directly serialized to a ByteString. -- Further, expressing either method in terms of the other would be -- non-optimal.
  2. --
  3. The choice of defaults allows a smooth transition for existing -- users: Existing instances that do not define toEncoding still -- compile and have the correct semantics. This is ensured by making the -- default implementation of toEncoding use toJSON. This -- produces correct results, but since it performs an intermediate -- conversion to a Value, it will be less efficient than directly -- emitting an Encoding. (this also means that specifying nothing -- more than instance ToJSON Coord would be sufficient as a -- generically decoding instance, but there probably exists no good -- reason to not specify toEncoding in new instances.)
  4. --
class ToJSON a -- | Convert a Haskell value to a JSON-friendly intermediate type. toJSON :: ToJSON a => a -> Value -- | Encode a Haskell value as JSON. -- -- The default implementation of this method creates an intermediate -- Value using toJSON. This provides source-level -- compatibility for people upgrading from older versions of this -- library, but obviously offers no performance advantage. -- -- To benefit from direct encoding, you must provide an -- implementation for this method. The easiest way to do so is by having -- your types implement Generic using the DeriveGeneric -- extension, and then have GHC generate a method body as follows. -- --
--   instance ToJSON Coord where
--       toEncoding = genericToEncoding defaultOptions
--   
toEncoding :: ToJSON a => a -> Encoding toJSONList :: ToJSON a => [a] -> Value toEncodingList :: ToJSON a => [a] -> Encoding -- | A key-value pair for encoding a JSON object. class KeyValue kv (.=) :: (KeyValue kv, ToJSON v) => Text -> v -> kv infixr 8 .= -- | Typeclass for types that can be used as the key of a map-like -- container (like Map or HashMap). For example, since -- Text has a ToJSONKey instance and Char has a -- ToJSON instance, we can encode a value of type Map -- Text Char: -- --
--   >>> LBC8.putStrLn $ encode $ Map.fromList [("foo" :: Text, 'a')]
--   {"foo":"a"}
--   
-- -- Since Int also has a ToJSONKey instance, we can -- similarly write: -- --
--   >>> LBC8.putStrLn $ encode $ Map.fromList [(5 :: Int, 'a')]
--   {"5":"a"}
--   
-- -- JSON documents only accept strings as object keys. For any type from -- base that has a natural textual representation, it can be -- expected that its ToJSONKey instance will choose that -- representation. -- -- For data types that lack a natural textual representation, an -- alternative is provided. The map-like container is represented as a -- JSON array instead of a JSON object. Each value in the array is an -- array with exactly two values. The first is the key and the second is -- the value. -- -- For example, values of type '[Text]' cannot be encoded to a string, so -- a Map with keys of type '[Text]' is encoded as follows: -- --
--   >>> LBC8.putStrLn $ encode $ Map.fromList [(["foo","bar","baz" :: Text], 'a')]
--   [[["foo","bar","baz"],"a"]]
--   
-- -- The default implementation of ToJSONKey chooses this method of -- encoding a key, using the ToJSON instance of the type. -- -- To use your own data type as the key in a map, all that is needed is -- to write a ToJSONKey (and possibly a FromJSONKey) -- instance for it. If the type cannot be trivially converted to and from -- Text, it is recommended that ToJSONKeyValue is used. -- Since the default implementations of the typeclass methods can build -- this from a ToJSON instance, there is nothing that needs to be -- written: -- --
--   data Foo = Foo { fooAge :: Int, fooName :: Text }
--     deriving (Eq,Ord,Generic)
--   instance ToJSON Foo
--   instance ToJSONKey Foo
--   
-- -- That's it. We can now write: -- --
--   >>> let m = Map.fromList [(Foo 4 "bar",'a'),(Foo 6 "arg",'b')]
--   
--   >>> LBC8.putStrLn $ encode m
--   [[{"fooName":"bar","fooAge":4},"a"],[{"fooName":"arg","fooAge":6},"b"]]
--   
-- -- The next case to consider is if we have a type that is a newtype -- wrapper around Text. The recommended approach is to use -- generalized newtype deriving: -- --
--   newtype RecordId = RecordId { getRecordId :: Text}
--     deriving (Eq,Ord,ToJSONKey)
--   
-- -- Then we may write: -- --
--   >>> LBC8.putStrLn $ encode $ Map.fromList [(RecordId "abc",'a')]
--   {"abc":"a"}
--   
-- -- Simple sum types are a final case worth considering. Suppose we have: -- --
--   data Color = Red | Green | Blue
--     deriving (Show,Read,Eq,Ord)
--   
-- -- It is possible to get the ToJSONKey instance for free as we did -- with Foo. However, in this case, we have a natural way to go -- to and from Text that does not require any escape sequences. -- So, in this example, ToJSONKeyText will be used instead of -- ToJSONKeyValue. The Show instance can be used to help -- write ToJSONKey: -- --
--   instance ToJSONKey Color where
--     toJSONKey = ToJSONKeyText f g
--       where f = Text.pack . show
--             g = text . Text.pack . show
--             -- text function is from Data.Aeson.Encoding
--   
-- -- The situation of needing to turning function a -> Text -- into a ToJSONKeyFunction is common enough that a special -- combinator is provided for it. The above instance can be rewritten as: -- --
--   instance ToJSONKey Color where
--     toJSONKey = toJSONKeyText (Text.pack . show)
--   
-- -- The performance of the above instance can be improved by not using -- Value as an intermediate step when converting to Text. -- One option for improving performance would be to use template haskell -- machinery from the text-show package. However, even with the -- approach, the Encoding (a wrapper around a bytestring builder) -- is generated by encoding the Text to a ByteString, an -- intermediate step that could be avoided. The fastest possible -- implementation would be: -- --
--   -- Assuming that OverloadedStrings is enabled
--   instance ToJSONKey Color where
--     toJSONKey = ToJSONKeyText f g
--       where f x = case x of {Red -> "Red";Green ->"Green";Blue -> "Blue"}
--             g x = case x of {Red -> text "Red";Green -> text "Green";Blue -> text "Blue"}
--             -- text function is from Data.Aeson.Encoding
--   
-- -- This works because GHC can lift the encoded values out of the case -- statements, which means that they are only evaluated once. This -- approach should only be used when there is a serious need to maximize -- performance. class ToJSONKey a -- | Strategy for rendering the key for a map-like container. toJSONKey :: ToJSONKey a => ToJSONKeyFunction a -- | This is similar in spirit to the showsList method of -- Show. It makes it possible to give Value keys special -- treatment without using OverlappingInstances. End users -- should always be able to use the default implementation of this -- method. toJSONKeyList :: ToJSONKey a => ToJSONKeyFunction [a] data ToJSONKeyFunction a -- | key is encoded to string, produces object ToJSONKeyText :: !a -> Text -> !a -> Encoding' Text -> ToJSONKeyFunction a -- | key is encoded to value, produces array ToJSONKeyValue :: !a -> Value -> !a -> Encoding -> ToJSONKeyFunction a -- | Lifting of the ToJSON class to unary type constructors. -- -- Instead of manually writing your ToJSON1 instance, there are -- two options to do it automatically: -- -- -- -- To use the second, simply add a deriving Generic1 -- clause to your datatype and declare a ToJSON1 instance for your -- datatype without giving definitions for liftToJSON or -- liftToEncoding. -- -- For example: -- --
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics
--   
--   data Pair = Pair { pairFst :: a, pairSnd :: b } deriving Generic1
--   
--   instance ToJSON a => ToJSON1 (Pair a)
--   
-- -- If the default implementation doesn't give exactly the results you -- want, you can customize the generic encoding with only a tiny amount -- of effort, using genericLiftToJSON and -- genericLiftToEncoding with your preferred Options: -- --
--   customOptions = defaultOptions
--                   { fieldLabelModifier = map toUpper
--                   }
--   
--   instance ToJSON a => ToJSON1 (Pair a) where
--       liftToJSON     = genericLiftToJSON customOptions
--       liftToEncoding = genericLiftToEncoding customOptions
--   
-- -- See also ToJSON. class ToJSON1 (f :: Type -> Type) liftToJSON :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> f a -> Value liftToJSONList :: ToJSON1 f => (a -> Value) -> ([a] -> Value) -> [f a] -> Value liftToEncoding :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> f a -> Encoding liftToEncodingList :: ToJSON1 f => (a -> Encoding) -> ([a] -> Encoding) -> [f a] -> Encoding -- | Lifting of the ToJSON class to binary type constructors. -- -- Instead of manually writing your ToJSON2 instance, -- Data.Aeson.TH provides Template Haskell functions which will -- derive an instance at compile time. -- -- The compiler cannot provide a default generic implementation for -- liftToJSON2, unlike toJSON and liftToJSON. class ToJSON2 (f :: Type -> Type -> Type) liftToJSON2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> f a b -> Value liftToJSONList2 :: ToJSON2 f => (a -> Value) -> ([a] -> Value) -> (b -> Value) -> ([b] -> Value) -> [f a b] -> Value liftToEncoding2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> f a b -> Encoding liftToEncodingList2 :: ToJSON2 f => (a -> Encoding) -> ([a] -> Encoding) -> (b -> Encoding) -> ([b] -> Encoding) -> [f a b] -> Encoding -- | Encode a series of key/value pairs, separated by commas. pairs :: Series -> Encoding -- | Acquire the underlying bytestring builder. fromEncoding :: Encoding' tag -> Builder -- | Often used synonym for Encoding'. type Encoding = Encoding' Value -- | A series of values that, when encoded, should be separated by commas. -- Since 0.11.0.0, the .= operator is overloaded to create -- either (Text, Value) or Series. You can use Series -- when encoding directly to a bytestring builder as in the following -- example: -- --
--   toEncoding (Person name age) = pairs ("name" .= name <> "age" .= age)
--   
data Series -- | Helper for use in combination with .:? to provide default -- values for optional JSON object fields. -- -- This combinator is most useful if the key and value can be absent from -- an object without affecting its validity and we know a default value -- to assign in that case. If the key and value are mandatory, use -- .: instead. -- -- Example usage: -- --
--   v1 <- o .:? "opt_field_with_dfl" .!= "default_val"
--   v2 <- o .:  "mandatory_field"
--   v3 <- o .:? "opt_field2"
--   
(.!=) :: () => Parser (Maybe a) -> a -> Parser a -- | Retrieve the value associated with the given key of an Object. -- The result is Nothing if the key is not present or -- empty if the value cannot be converted to the desired type. -- -- This differs from .:? by attempting to parse Null the -- same as any other JSON value, instead of interpreting it as -- Nothing. (.:!) :: FromJSON a => Object -> Text -> Parser (Maybe a) -- | Convert a value from JSON, failing if the types do not match. fromJSON :: FromJSON a => Value -> Result a -- | Decode a nested JSON-encoded string. withEmbeddedJSON :: () => String -> (Value -> Parser a) -> Value -> Parser a -- | withBool expected f value applies f to the -- Value when value is a Value and fails using -- typeMismatch expected otherwise. withBool :: () => String -> (Bool -> Parser a) -> Value -> Parser a -- | withScientific expected f value applies f to -- the Scientific number when value is a Number -- and fails using typeMismatch expected otherwise. . -- Warning: If you are converting from a scientific to an -- unbounded type such as Integer you may want to add a -- restriction on the size of the exponent (see -- withBoundedScientific) to prevent malicious input from filling -- up the memory of the target system. withScientific :: () => String -> (Scientific -> Parser a) -> Value -> Parser a -- | withArray expected f value applies f to the -- Array when value is an Array and fails using -- typeMismatch expected otherwise. withArray :: () => String -> (Array -> Parser a) -> Value -> Parser a -- | withText expected f value applies f to the -- Text when value is a Value and fails using -- typeMismatch expected otherwise. withText :: () => String -> (Text -> Parser a) -> Value -> Parser a -- | withObject expected f value applies f to the -- Object when value is an Object and fails using -- typeMismatch expected otherwise. withObject :: () => String -> (Object -> Parser a) -> Value -> Parser a -- | Lift the standard parseJSON function through the type -- constructor. parseJSON2 :: (FromJSON2 f, FromJSON a, FromJSON b) => Value -> Parser (f a b) -- | Lift the standard parseJSON function through the type -- constructor. parseJSON1 :: (FromJSON1 f, FromJSON a) => Value -> Parser (f a) -- | A configurable generic JSON decoder. This function applied to -- defaultOptions is used as the default for liftParseJSON -- when the type is an instance of Generic1. genericLiftParseJSON :: (Generic1 f, GFromJSON One (Rep1 f)) => Options -> (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) -- | A configurable generic JSON decoder. This function applied to -- defaultOptions is used as the default for parseJSON when -- the type is an instance of Generic. genericParseJSON :: (Generic a, GFromJSON Zero (Rep a)) => Options -> Value -> Parser a -- | Class of generic representation types that can be converted from JSON. class GFromJSON arity (f :: Type -> Type) -- | This method (applied to defaultOptions) is used as the default -- generic implementation of parseJSON (if the arity is -- Zero) or liftParseJSON (if the arity is -- One). gParseJSON :: GFromJSON arity f => Options -> FromArgs arity a -> Value -> Parser (f a) -- | A FromArgs value either stores nothing (for FromJSON) or -- it stores the two function arguments that decode occurrences of the -- type parameter (for FromJSON1). data FromArgs arity a [NoFromArgs] :: forall arity a. () => FromArgs Zero a [From1Args] :: forall arity a. () => (Value -> Parser a) -> (Value -> Parser [a]) -> FromArgs One a -- | A type that can be converted from JSON, with the possibility of -- failure. -- -- In many cases, you can get the compiler to generate parsing code for -- you (see below). To begin, let's cover writing an instance by hand. -- -- There are various reasons a conversion could fail. For example, an -- Object could be missing a required key, an Array could -- be of the wrong size, or a value could be of an incompatible type. -- -- The basic ways to signal a failed conversion are as follows: -- -- -- -- An example type and instance using typeMismatch: -- --
--   -- Allow ourselves to write Text literals.
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   data Coord = Coord { x :: Double, y :: Double }
--   
--   instance FromJSON Coord where
--       parseJSON (Object v) = Coord
--           <$> v .: "x"
--           <*> v .: "y"
--   
--       -- We do not expect a non-Object value here.
--       -- We could use mzero to fail, but typeMismatch
--       -- gives a much more informative error message.
--       parseJSON invalid    = typeMismatch "Coord" invalid
--   
-- -- For this common case of only being concerned with a single type of -- JSON value, the functions withObject, withNumber, etc. -- are provided. Their use is to be preferred when possible, since they -- are more terse. Using withObject, we can rewrite the above -- instance (assuming the same language extension and data type) as: -- --
--   instance FromJSON Coord where
--       parseJSON = withObject "Coord" $ \v -> Coord
--           <$> v .: "x"
--           <*> v .: "y"
--   
-- -- Instead of manually writing your FromJSON instance, there are -- two options to do it automatically: -- -- -- -- To use the second, simply add a deriving Generic -- clause to your datatype and declare a FromJSON instance for -- your datatype without giving a definition for parseJSON. -- -- For example, the previous example can be simplified to just: -- --
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics
--   
--   data Coord = Coord { x :: Double, y :: Double } deriving Generic
--   
--   instance FromJSON Coord
--   
-- -- The default implementation will be equivalent to parseJSON = -- genericParseJSON defaultOptions; If you need -- different options, you can customize the generic decoding by defining: -- --
--   customOptions = defaultOptions
--                   { fieldLabelModifier = map toUpper
--                   }
--   
--   instance FromJSON Coord where
--       parseJSON = genericParseJSON customOptions
--   
class FromJSON a parseJSON :: FromJSON a => Value -> Parser a parseJSONList :: FromJSON a => Value -> Parser [a] -- | Read the docs for ToJSONKey first. This class is a conversion -- in the opposite direction. If you have a newtype wrapper around -- Text, the recommended way to define instances is with -- generalized newtype deriving: -- --
--   newtype SomeId = SomeId { getSomeId :: Text }
--     deriving (Eq,Ord,Hashable,FromJSONKey)
--   
class FromJSONKey a -- | Strategy for parsing the key of a map-like container. fromJSONKey :: FromJSONKey a => FromJSONKeyFunction a -- | This is similar in spirit to the readList method of -- Read. It makes it possible to give Value keys special -- treatment without using OverlappingInstances. End users -- should always be able to use the default implementation of this -- method. fromJSONKeyList :: FromJSONKey a => FromJSONKeyFunction [a] -- | This type is related to ToJSONKeyFunction. If -- FromJSONKeyValue is used in the FromJSONKey instance, -- then ToJSONKeyValue should be used in the ToJSONKey -- instance. The other three data constructors for this type all -- correspond to ToJSONKeyText. Strictly speaking, -- FromJSONKeyTextParser is more powerful than -- FromJSONKeyText, which is in turn more powerful than -- FromJSONKeyCoerce. For performance reasons, these exist as -- three options instead of one. data FromJSONKeyFunction a -- | uses coerce (unsafeCoerce in older GHCs) FromJSONKeyCoerce :: !CoerceText a -> FromJSONKeyFunction a -- | conversion from Text that always succeeds FromJSONKeyText :: !Text -> a -> FromJSONKeyFunction a -- | conversion from Text that may fail FromJSONKeyTextParser :: !Text -> Parser a -> FromJSONKeyFunction a -- | conversion for non-textual keys FromJSONKeyValue :: !Value -> Parser a -> FromJSONKeyFunction a -- | Lifting of the FromJSON class to unary type constructors. -- -- Instead of manually writing your FromJSON1 instance, there are -- two options to do it automatically: -- -- -- -- To use the second, simply add a deriving Generic1 -- clause to your datatype and declare a FromJSON1 instance for -- your datatype without giving a definition for liftParseJSON. -- -- For example: -- --
--   {-# LANGUAGE DeriveGeneric #-}
--   
--   import GHC.Generics
--   
--   data Pair a b = Pair { pairFst :: a, pairSnd :: b } deriving Generic1
--   
--   instance FromJSON a => FromJSON1 (Pair a)
--   
-- -- If the default implementation doesn't give exactly the results you -- want, you can customize the generic decoding with only a tiny amount -- of effort, using genericLiftParseJSON with your preferred -- Options: -- --
--   customOptions = defaultOptions
--                   { fieldLabelModifier = map toUpper
--                   }
--   
--   instance FromJSON a => FromJSON1 (Pair a) where
--       liftParseJSON = genericLiftParseJSON customOptions
--   
class FromJSON1 (f :: Type -> Type) liftParseJSON :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (f a) liftParseJSONList :: FromJSON1 f => (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [f a] -- | Lifting of the FromJSON class to binary type constructors. -- -- Instead of manually writing your FromJSON2 instance, -- Data.Aeson.TH provides Template Haskell functions which will -- derive an instance at compile time. class FromJSON2 (f :: Type -> Type -> Type) liftParseJSON2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser (f a b) liftParseJSONList2 :: FromJSON2 f => (Value -> Parser a) -> (Value -> Parser [a]) -> (Value -> Parser b) -> (Value -> Parser [b]) -> Value -> Parser [f a b] -- | Parse a top-level JSON value. -- -- This is a strict version of json which avoids building up -- thunks during parsing; it performs all conversions immediately. Prefer -- this version if most of the JSON data needs to be accessed. -- -- This function is an alias for value'. In aeson 0.8 and earlier, -- it parsed only object or array types, in conformance with the -- now-obsolete RFC 4627. json' :: Parser Value -- | Parse a top-level JSON value. -- -- The conversion of a parsed value to a Haskell value is deferred until -- the Haskell value is needed. This may improve performance if only a -- subset of the results of conversions are needed, but at a cost in -- thunk allocation. -- -- This function is an alias for value. In aeson 0.8 and earlier, -- it parsed only object or array types, in conformance with the -- now-obsolete RFC 4627. json :: Parser Value -- | Better version of camelTo. Example where it works better: -- --
--   camelTo '_' 'CamelAPICase' == "camel_apicase"
--   camelTo2 '_' 'CamelAPICase' == "camel_api_case"
--   
camelTo2 :: Char -> String -> String -- | Default TaggedObject SumEncoding options: -- --
--   defaultTaggedObject = TaggedObject
--                         { tagFieldName      = "tag"
--                         , contentsFieldName = "contents"
--                         }
--   
defaultTaggedObject :: SumEncoding -- | Default encoding Options: -- --
--   Options
--   { fieldLabelModifier      = id
--   , constructorTagModifier  = id
--   , allNullaryToStringTag   = True
--   , omitNothingFields       = False
--   , sumEncoding             = defaultTaggedObject
--   , unwrapUnaryRecords      = False
--   , tagSingleConstructors   = False
--   }
--   
defaultOptions :: Options -- | Create a Value from a list of name/value Pairs. If -- duplicate keys arise, earlier keys and their associated values win. object :: [Pair] -> Value -- | The result of running a Parser. data Result a Error :: String -> Result a Success :: a -> Result a -- | A JSON "object" (key/value map). type Object = HashMap Text Value -- | A JSON "array" (sequence). type Array = Vector Value -- | A JSON value represented as a Haskell value. data Value Object :: !Object -> Value Array :: !Array -> Value String :: !Text -> Value Number :: !Scientific -> Value Bool :: !Bool -> Value Null :: Value -- | A newtype wrapper for UTCTime that uses the same non-standard -- serialization format as Microsoft .NET, whose System.DateTime -- type is by default serialized to JSON as in the following example: -- --
--   /Date(1302547608878)/
--   
-- -- The number represents milliseconds since the Unix epoch. newtype DotNetTime DotNetTime :: UTCTime -> DotNetTime -- | Acquire the underlying value. [fromDotNetTime] :: DotNetTime -> UTCTime -- | Options that specify how to encode/decode your datatype to/from JSON. -- -- Options can be set using record syntax on defaultOptions with -- the fields below. data Options -- | Specifies how to encode constructors of a sum datatype. data SumEncoding -- | A constructor will be encoded to an object with a field -- tagFieldName which specifies the constructor tag (modified by -- the constructorTagModifier). If the constructor is a record the -- encoded record fields will be unpacked into this object. So make sure -- that your record doesn't have a field with the same label as the -- tagFieldName. Otherwise the tag gets overwritten by the encoded -- value of that field! If the constructor is not a record the encoded -- constructor contents will be stored under the contentsFieldName -- field. TaggedObject :: String -> String -> SumEncoding [tagFieldName] :: SumEncoding -> String [contentsFieldName] :: SumEncoding -> String -- | Constructor names won't be encoded. Instead only the contents of the -- constructor will be encoded as if the type had a single constructor. -- JSON encodings have to be disjoint for decoding to work properly. -- -- When decoding, constructors are tried in the order of definition. If -- some encodings overlap, the first one defined will succeed. -- -- Note: Nullary constructors are encoded as strings (using -- constructorTagModifier). Having a nullary constructor alongside -- a single field constructor that encodes to a string leads to -- ambiguity. -- -- Note: Only the last error is kept when decoding, so in the case -- of malformed JSON, only an error for the last constructor will be -- reported. UntaggedValue :: SumEncoding -- | A constructor will be encoded to an object with a single field named -- after the constructor tag (modified by the -- constructorTagModifier) which maps to the encoded contents of -- the constructor. ObjectWithSingleField :: SumEncoding -- | A constructor will be encoded to a 2-element array where the first -- element is the tag of the constructor (modified by the -- constructorTagModifier) and the second element the encoded -- contents of the constructor. TwoElemArray :: SumEncoding -- | A type-level indicator that ToJSON or FromJSON is -- being derived generically. data Zero -- | A type-level indicator that ToJSON1 or FromJSON1 is -- being derived generically. data One -- | Extends .: warning to include field name. (.:) :: FromJSON a => Object -> Text -> Parser a -- | Extends .:? warning to include field name. (.:?) :: FromJSON a => Object -> Text -> Parser (Maybe a) -- | Warning output from WarningParser. data JSONWarning JSONUnrecognizedFields :: String -> [Text] -> JSONWarning JSONGeneralWarning :: !Text -> JSONWarning -- | JSON parser that warns about unexpected fields in objects. type WarningParser a = WriterT WarningParserMonoid Parser a data WithJSONWarnings a WithJSONWarnings :: a -> [JSONWarning] -> WithJSONWarnings a -- | WarningParser version of withObject. withObjectWarnings :: String -> (Object -> WarningParser a) -> Value -> Parser (WithJSONWarnings a) -- | Handle warnings in a sub-object. jsonSubWarnings :: WarningParser (WithJSONWarnings a) -> WarningParser a -- | Handle warnings in a Traversable of sub-objects. jsonSubWarningsT :: Traversable t => WarningParser (t (WithJSONWarnings a)) -> WarningParser (t a) -- | Handle warnings in a Maybe Traversable of sub-objects. jsonSubWarningsTT :: (Traversable t, Traversable u) => WarningParser (u (t (WithJSONWarnings a))) -> WarningParser (u (t a)) -- | Log JSON warnings. logJSONWarnings :: (MonadReader env m, HasLogFunc env, HasCallStack, MonadIO m) => FilePath -> [JSONWarning] -> m () noJSONWarnings :: a -> WithJSONWarnings a -- | Tell warning parser about an expected field, so it doesn't warn about -- it. tellJSONField :: Text -> WarningParser () -- | Convert a WarningParser to a Parser. unWarningParser :: WarningParser a -> Parser a -- | WarningParser version of .:. (..:) :: FromJSON a => Object -> Text -> WarningParser a -- | WarningParser version of .:?. (..:?) :: FromJSON a => Object -> Text -> WarningParser (Maybe a) -- | WarningParser version of .!=. (..!=) :: WarningParser (Maybe a) -> a -> WarningParser a instance GHC.Generics.Generic Data.Aeson.Extended.WarningParserMonoid instance GHC.Show.Show a => GHC.Show.Show (Data.Aeson.Extended.WithJSONWarnings a) instance GHC.Generics.Generic (Data.Aeson.Extended.WithJSONWarnings a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Aeson.Extended.WithJSONWarnings a) instance GHC.Classes.Eq Data.Aeson.Extended.JSONWarning instance GHC.Base.Semigroup Data.Aeson.Extended.WarningParserMonoid instance GHC.Base.Monoid Data.Aeson.Extended.WarningParserMonoid instance Data.String.IsString Data.Aeson.Extended.WarningParserMonoid instance GHC.Base.Functor Data.Aeson.Extended.WithJSONWarnings instance GHC.Base.Monoid a => GHC.Base.Semigroup (Data.Aeson.Extended.WithJSONWarnings a) instance GHC.Base.Monoid a => GHC.Base.Monoid (Data.Aeson.Extended.WithJSONWarnings a) instance GHC.Show.Show Data.Aeson.Extended.JSONWarning instance Data.String.IsString Data.Aeson.Extended.JSONWarning module Stack.StaticBytes data Bytes8 data Bytes16 data Bytes32 data Bytes64 data Bytes128 class DynamicBytes dbytes class StaticBytes sbytes data StaticBytesException NotEnoughBytes :: StaticBytesException TooManyBytes :: StaticBytesException toStaticExact :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> Either StaticBytesException sbytes toStaticPad :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> Either StaticBytesException sbytes toStaticTruncate :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> Either StaticBytesException sbytes toStaticPadTruncate :: (DynamicBytes dbytes, StaticBytes sbytes) => dbytes -> sbytes fromStatic :: forall dbytes sbytes. (DynamicBytes dbytes, StaticBytes sbytes) => sbytes -> dbytes instance GHC.Classes.Eq Stack.StaticBytes.StaticBytesException instance GHC.Show.Show Stack.StaticBytes.StaticBytesException instance Data.Store.Impl.Store Stack.StaticBytes.Bytes128 instance Data.Data.Data Stack.StaticBytes.Bytes128 instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes128 instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes128 instance GHC.Generics.Generic Stack.StaticBytes.Bytes128 instance GHC.Classes.Ord Stack.StaticBytes.Bytes128 instance GHC.Classes.Eq Stack.StaticBytes.Bytes128 instance GHC.Show.Show Stack.StaticBytes.Bytes128 instance Data.Store.Impl.Store Stack.StaticBytes.Bytes64 instance Data.Data.Data Stack.StaticBytes.Bytes64 instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes64 instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes64 instance GHC.Generics.Generic Stack.StaticBytes.Bytes64 instance GHC.Classes.Ord Stack.StaticBytes.Bytes64 instance GHC.Classes.Eq Stack.StaticBytes.Bytes64 instance GHC.Show.Show Stack.StaticBytes.Bytes64 instance Data.Store.Impl.Store Stack.StaticBytes.Bytes32 instance Data.Data.Data Stack.StaticBytes.Bytes32 instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes32 instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes32 instance GHC.Generics.Generic Stack.StaticBytes.Bytes32 instance GHC.Classes.Ord Stack.StaticBytes.Bytes32 instance GHC.Classes.Eq Stack.StaticBytes.Bytes32 instance GHC.Show.Show Stack.StaticBytes.Bytes32 instance Data.Store.Impl.Store Stack.StaticBytes.Bytes16 instance Data.Data.Data Stack.StaticBytes.Bytes16 instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes16 instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes16 instance GHC.Generics.Generic Stack.StaticBytes.Bytes16 instance GHC.Classes.Ord Stack.StaticBytes.Bytes16 instance GHC.Classes.Eq Stack.StaticBytes.Bytes16 instance GHC.Show.Show Stack.StaticBytes.Bytes16 instance Data.Store.Impl.Store Stack.StaticBytes.Bytes8 instance Data.Data.Data Stack.StaticBytes.Bytes8 instance Data.Hashable.Class.Hashable Stack.StaticBytes.Bytes8 instance Control.DeepSeq.NFData Stack.StaticBytes.Bytes8 instance GHC.Generics.Generic Stack.StaticBytes.Bytes8 instance GHC.Classes.Ord Stack.StaticBytes.Bytes8 instance GHC.Classes.Eq Stack.StaticBytes.Bytes8 instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes8 instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes16 instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes32 instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes64 instance Stack.StaticBytes.StaticBytes Stack.StaticBytes.Bytes128 instance GHC.Show.Show Stack.StaticBytes.Bytes8 instance Stack.StaticBytes.DynamicBytes Data.ByteString.Internal.ByteString instance (word8 Data.Type.Equality.~ GHC.Word.Word8) => Stack.StaticBytes.DynamicBytes (Data.Vector.Storable.Vector word8) instance (word8 Data.Type.Equality.~ GHC.Word.Word8) => Stack.StaticBytes.DynamicBytes (Data.Vector.Primitive.Vector word8) instance (word8 Data.Type.Equality.~ GHC.Word.Word8) => Stack.StaticBytes.DynamicBytes (Data.Vector.Unboxed.Base.Vector word8) instance GHC.Exception.Type.Exception Stack.StaticBytes.StaticBytesException instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes128 instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes64 instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes32 instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes16 instance Data.ByteArray.Types.ByteArrayAccess Stack.StaticBytes.Bytes8 module Stack.Types.CompilerBuild data CompilerBuild CompilerBuildStandard :: CompilerBuild CompilerBuildSpecialized :: String -> CompilerBuild -- | Descriptive name for compiler build compilerBuildName :: CompilerBuild -> String -- | Suffix to use for filenames/directories constructed with compiler -- build compilerBuildSuffix :: CompilerBuild -> String -- | Parse compiler build from a String. parseCompilerBuild :: MonadThrow m => String -> m CompilerBuild instance GHC.Show.Show Stack.Types.CompilerBuild.CompilerBuild instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.CompilerBuild.CompilerBuild module Stack.Options.GhcBuildParser -- | GHC build parser ghcBuildParser :: Bool -> Parser CompilerBuild -- | Names for flags. module Stack.Types.FlagName -- | A flag name. data FlagName -- | A parse fail. newtype FlagNameParseFail FlagNameParseFail :: Text -> FlagNameParseFail -- | Attoparsec parser for a flag name flagNameParser :: Parser FlagName -- | Convenient way to parse a flag name from a Text. parseFlagName :: MonadThrow m => Text -> m FlagName -- | Convenience function for parsing from a Value parseFlagNameFromString :: MonadThrow m => String -> m FlagName -- | Produce a string representation of a flag name. flagNameString :: FlagName -> String -- | Produce a string representation of a flag name. flagNameText :: FlagName -> Text -- | Convert from a Cabal flag name. fromCabalFlagName :: FlagName -> FlagName -- | Convert to a Cabal flag name. toCabalFlagName :: FlagName -> FlagName -- | Make a flag name. mkFlagName :: String -> Q Exp instance Data.Aeson.Types.ToJSON.ToJSONKey Stack.Types.FlagName.FlagName instance Control.DeepSeq.NFData Stack.Types.FlagName.FlagName instance Data.Store.Impl.Store Stack.Types.FlagName.FlagName instance Data.Hashable.Class.Hashable Stack.Types.FlagName.FlagName instance GHC.Generics.Generic Stack.Types.FlagName.FlagName instance Data.Data.Data Stack.Types.FlagName.FlagName instance GHC.Classes.Eq Stack.Types.FlagName.FlagName instance GHC.Classes.Ord Stack.Types.FlagName.FlagName instance Language.Haskell.TH.Syntax.Lift Stack.Types.FlagName.FlagName instance GHC.Show.Show Stack.Types.FlagName.FlagName instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.FlagName.FlagName instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.FlagName.FlagName instance GHC.Exception.Type.Exception Stack.Types.FlagName.FlagNameParseFail instance GHC.Show.Show Stack.Types.FlagName.FlagNameParseFail -- | A ghc-pkg id. module Stack.Types.GhcPkgId -- | A ghc-pkg package identifier. data GhcPkgId -- | A parser for a package-version-hash pair. ghcPkgIdParser :: Parser GhcPkgId -- | Convenient way to parse a package name from a Text. parseGhcPkgId :: MonadThrow m => Text -> m GhcPkgId -- | Get a string representation of GHC package id. ghcPkgIdString :: GhcPkgId -> String instance GHC.Generics.Generic Stack.Types.GhcPkgId.GhcPkgId instance Data.Data.Data Stack.Types.GhcPkgId.GhcPkgId instance GHC.Classes.Ord Stack.Types.GhcPkgId.GhcPkgId instance GHC.Classes.Eq Stack.Types.GhcPkgId.GhcPkgId instance Data.Hashable.Class.Hashable Stack.Types.GhcPkgId.GhcPkgId instance Control.DeepSeq.NFData Stack.Types.GhcPkgId.GhcPkgId instance Data.Store.Impl.Store Stack.Types.GhcPkgId.GhcPkgId instance GHC.Show.Show Stack.Types.GhcPkgId.GhcPkgId instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.GhcPkgId.GhcPkgId instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.GhcPkgId.GhcPkgId instance GHC.Show.Show Stack.Types.GhcPkgId.GhcPkgIdParseFail instance GHC.Exception.Type.Exception Stack.Types.GhcPkgId.GhcPkgIdParseFail module Stack.Types.Image -- | Image options. Currently only Docker image options. newtype ImageOpts ImageOpts :: [ImageDockerOpts] -> ImageOpts -- | One or more stanzas for docker image settings. [imgDockers] :: ImageOpts -> [ImageDockerOpts] data ImageDockerOpts ImageDockerOpts :: !Maybe String -> !Maybe [String] -> !Map FilePath (Path Abs Dir) -> !Maybe String -> !Maybe [Path Rel File] -> ImageDockerOpts -- | Maybe have a docker base image name. (Although we will not be able to -- create any Docker images without this.) [imgDockerBase] :: ImageDockerOpts -> !Maybe String -- | Maybe have a specific ENTRYPOINT list that will be used to create -- images. [imgDockerEntrypoints] :: ImageDockerOpts -> !Maybe [String] -- | Maybe have some static project content to include in a specific -- directory in all the images. [imgDockerAdd] :: ImageDockerOpts -> !Map FilePath (Path Abs Dir) -- | Maybe have a name for the image we are creating [imgDockerImageName] :: ImageDockerOpts -> !Maybe String -- | Filenames of executables to add (if Nothing, add them all) [imgDockerExecutables] :: ImageDockerOpts -> !Maybe [Path Rel File] newtype ImageOptsMonoid ImageOptsMonoid :: [ImageDockerOpts] -> ImageOptsMonoid [imgMonoidDockers] :: ImageOptsMonoid -> [ImageDockerOpts] imgArgName :: Text imgDockerOldArgName :: Text imgDockersArgName :: Text imgDockerBaseArgName :: Text imgDockerAddArgName :: Text imgDockerEntrypointsArgName :: Text imgDockerImageNameArgName :: Text imgDockerExecutablesArgName :: Text instance GHC.Generics.Generic Stack.Types.Image.ImageOptsMonoid instance GHC.Show.Show Stack.Types.Image.ImageOptsMonoid instance GHC.Show.Show Stack.Types.Image.ImageOpts instance GHC.Show.Show Stack.Types.Image.ImageDockerOpts instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Image.ImageOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Image.ImageOptsMonoid instance GHC.Base.Monoid Stack.Types.Image.ImageOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Image.ImageDockerOpts) -- | Nix types. module Stack.Types.Nix -- | Nix configuration. Parameterize by resolver type to avoid cyclic -- dependency. data NixOpts NixOpts :: !Bool -> !Bool -> ![Text] -> !Maybe FilePath -> ![Text] -> !Bool -> NixOpts [nixEnable] :: NixOpts -> !Bool [nixPureShell] :: NixOpts -> !Bool -- | The system packages to be installed in the environment before it runs [nixPackages] :: NixOpts -> ![Text] -- | The path of a file containing preconfiguration of the environment (e.g -- shell.nix) [nixInitFile] :: NixOpts -> !Maybe FilePath -- | Options to be given to the nix-shell command line [nixShellOptions] :: NixOpts -> ![Text] -- | Should we register gc roots so running nix-collect-garbage doesn't -- remove nix dependencies [nixAddGCRoots] :: NixOpts -> !Bool -- | An uninterpreted representation of nix options. Configurations may be -- "cascaded" using mappend (left-biased). data NixOptsMonoid NixOptsMonoid :: !First Bool -> !First Bool -> !First [Text] -> !First FilePath -> !First [Text] -> !First [Text] -> !First Bool -> NixOptsMonoid -- | Is using nix-shell enabled? [nixMonoidEnable] :: NixOptsMonoid -> !First Bool -- | Should the nix-shell be pure [nixMonoidPureShell] :: NixOptsMonoid -> !First Bool -- | System packages to use (given to nix-shell) [nixMonoidPackages] :: NixOptsMonoid -> !First [Text] -- | The path of a file containing preconfiguration of the environment (e.g -- shell.nix) [nixMonoidInitFile] :: NixOptsMonoid -> !First FilePath -- | Options to be given to the nix-shell command line [nixMonoidShellOptions] :: NixOptsMonoid -> !First [Text] -- | Override parts of NIX_PATH (notably nixpkgs) [nixMonoidPath] :: NixOptsMonoid -> !First [Text] -- | Should we register gc roots so running nix-collect-garbage doesn't -- remove nix dependencies [nixMonoidAddGCRoots] :: NixOptsMonoid -> !First Bool -- | Nix enable argument name. nixEnableArgName :: Text -- | Nix run in pure shell argument name. nixPureShellArgName :: Text -- | Nix packages (build inputs) argument name. nixPackagesArgName :: Text -- | shell.nix file path argument name. nixInitFileArgName :: Text -- | Extra options for the nix-shell command argument name. nixShellOptsArgName :: Text -- | NIX_PATH override argument name nixPathArgName :: Text -- | Add GC roots arg name nixAddGCRootsArgName :: Text instance GHC.Generics.Generic Stack.Types.Nix.NixOptsMonoid instance GHC.Show.Show Stack.Types.Nix.NixOptsMonoid instance GHC.Classes.Eq Stack.Types.Nix.NixOptsMonoid instance GHC.Show.Show Stack.Types.Nix.NixOpts instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Nix.NixOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Nix.NixOptsMonoid instance GHC.Base.Monoid Stack.Types.Nix.NixOptsMonoid -- | Names for packages. module Stack.Types.PackageName -- | A package name. data PackageName -- | A parse fail. data PackageNameParseFail PackageNameParseFail :: Text -> PackageNameParseFail CabalFileNameParseFail :: FilePath -> PackageNameParseFail CabalFileNameInvalidPackageName :: FilePath -> PackageNameParseFail -- | Attoparsec parser for a package name packageNameParser :: Parser PackageName -- | Parse a package name from a Text. parsePackageName :: MonadThrow m => Text -> m PackageName -- | Parse a package name from a Value. parsePackageNameFromString :: MonadThrow m => String -> m PackageName -- | Produce a string representation of a package name. packageNameString :: PackageName -> String -- | Produce a string representation of a package name. packageNameText :: PackageName -> Text -- | Convert from a Cabal package name. fromCabalPackageName :: PackageName -> PackageName -- | Convert to a Cabal package name. toCabalPackageName :: PackageName -> PackageName -- | Parse a package name from a file path. parsePackageNameFromFilePath :: MonadThrow m => Path a File -> m PackageName -- | Make a package name. mkPackageName :: String -> Q Exp -- | An argument which accepts a template name of the format -- foo.hsfiles. packageNameArgument :: Mod ArgumentFields PackageName -> Parser PackageName instance Data.Aeson.Types.ToJSON.ToJSONKey Stack.Types.PackageName.PackageName instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageName.PackageName instance Data.Store.Impl.Store Stack.Types.PackageName.PackageName instance Control.DeepSeq.NFData Stack.Types.PackageName.PackageName instance Data.Hashable.Class.Hashable Stack.Types.PackageName.PackageName instance GHC.Generics.Generic Stack.Types.PackageName.PackageName instance Data.Data.Data Stack.Types.PackageName.PackageName instance GHC.Classes.Ord Stack.Types.PackageName.PackageName instance GHC.Classes.Eq Stack.Types.PackageName.PackageName instance Language.Haskell.TH.Syntax.Lift Stack.Types.PackageName.PackageName instance GHC.Show.Show Stack.Types.PackageName.PackageName instance RIO.Prelude.Display.Display Stack.Types.PackageName.PackageName instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageName.PackageName instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.PackageName.PackageName instance GHC.Exception.Type.Exception Stack.Types.PackageName.PackageNameParseFail instance GHC.Show.Show Stack.Types.PackageName.PackageNameParseFail module Stack.Types.NamedComponent -- | A single, fully resolved component of a package data NamedComponent CLib :: NamedComponent CInternalLib :: !Text -> NamedComponent CExe :: !Text -> NamedComponent CTest :: !Text -> NamedComponent CBench :: !Text -> NamedComponent renderComponent :: NamedComponent -> Text renderPkgComponents :: [(PackageName, NamedComponent)] -> Text renderPkgComponent :: (PackageName, NamedComponent) -> Text exeComponents :: Set NamedComponent -> Set Text testComponents :: Set NamedComponent -> Set Text benchComponents :: Set NamedComponent -> Set Text internalLibComponents :: Set NamedComponent -> Set Text isCLib :: NamedComponent -> Bool isCInternalLib :: NamedComponent -> Bool isCExe :: NamedComponent -> Bool isCTest :: NamedComponent -> Bool isCBench :: NamedComponent -> Bool instance GHC.Classes.Ord Stack.Types.NamedComponent.NamedComponent instance GHC.Classes.Eq Stack.Types.NamedComponent.NamedComponent instance GHC.Show.Show Stack.Types.NamedComponent.NamedComponent -- | Configuration options for building. module Stack.Types.Config.Build -- | Build options that is interpreted by the build command. This is built -- up from BuildOptsCLI and BuildOptsMonoid data BuildOpts BuildOpts :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !HaddockOpts -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe Bool -> !Maybe Bool -> !Bool -> !Bool -> !TestOpts -> !Bool -> !BenchmarkOpts -> !Bool -> !Bool -> !Bool -> ![Text] -> !Bool -> BuildOpts [boptsLibProfile] :: BuildOpts -> !Bool [boptsExeProfile] :: BuildOpts -> !Bool [boptsLibStrip] :: BuildOpts -> !Bool [boptsExeStrip] :: BuildOpts -> !Bool -- | Build haddocks? [boptsHaddock] :: BuildOpts -> !Bool -- | Options to pass to haddock [boptsHaddockOpts] :: BuildOpts -> !HaddockOpts -- | Open haddocks in the browser? [boptsOpenHaddocks] :: BuildOpts -> !Bool -- | Build haddocks for dependencies? [boptsHaddockDeps] :: BuildOpts -> !Maybe Bool -- | Build haddocks for all symbols and packages, like cabal haddock -- --internal [boptsHaddockInternal] :: BuildOpts -> !Bool -- | Build hyperlinked source if possible. Fallback to hscolour. -- Disable for no sources. [boptsHaddockHyperlinkSource] :: BuildOpts -> !Bool -- | Install executables to user path after building? [boptsInstallExes] :: BuildOpts -> !Bool -- | Install executables to compiler tools path after building? [boptsInstallCompilerTool] :: BuildOpts -> !Bool -- | Fetch all packages immediately ^ Watch files for changes and -- automatically rebuild [boptsPreFetch] :: BuildOpts -> !Bool -- | Keep building/running after failure [boptsKeepGoing] :: BuildOpts -> !Maybe Bool -- | Keep intermediate files and build directories [boptsKeepTmpFiles] :: BuildOpts -> !Maybe Bool -- | Force treating all local packages as having dirty files [boptsForceDirty] :: BuildOpts -> !Bool -- | Turn on tests for local targets [boptsTests] :: BuildOpts -> !Bool -- | Additional test arguments [boptsTestOpts] :: BuildOpts -> !TestOpts -- | Turn on benchmarks for local targets [boptsBenchmarks] :: BuildOpts -> !Bool -- | Additional test arguments ^ Commands (with arguments) to run after a -- successful build ^ Only perform the configure step when building [boptsBenchmarkOpts] :: BuildOpts -> !BenchmarkOpts -- | Perform the configure step even if already configured [boptsReconfigure] :: BuildOpts -> !Bool -- | Ask Cabal to be verbose in its builds [boptsCabalVerbose] :: BuildOpts -> !Bool -- | Whether to enable split-objs. [boptsSplitObjs] :: BuildOpts -> !Bool -- | Which components to skip when building [boptsSkipComponents] :: BuildOpts -> ![Text] -- | Should we use the interleaved GHC output when building multiple -- packages? [boptsInterleavedOutput] :: BuildOpts -> !Bool -- | Command sum type for conditional arguments. data BuildCommand Build :: BuildCommand Test :: BuildCommand Haddock :: BuildCommand Bench :: BuildCommand Install :: BuildCommand defaultBuildOpts :: BuildOpts defaultBuildOptsCLI :: BuildOptsCLI -- | Build options that may only be specified from the CLI data BuildOptsCLI BuildOptsCLI :: ![Text] -> !Bool -> ![Text] -> !Map (Maybe PackageName) (Map FlagName Bool) -> !BuildSubset -> !FileWatchOpts -> ![(String, [String])] -> !Bool -> !BuildCommand -> !Bool -> BuildOptsCLI [boptsCLITargets] :: BuildOptsCLI -> ![Text] [boptsCLIDryrun] :: BuildOptsCLI -> !Bool [boptsCLIGhcOptions] :: BuildOptsCLI -> ![Text] [boptsCLIFlags] :: BuildOptsCLI -> !Map (Maybe PackageName) (Map FlagName Bool) [boptsCLIBuildSubset] :: BuildOptsCLI -> !BuildSubset [boptsCLIFileWatch] :: BuildOptsCLI -> !FileWatchOpts [boptsCLIExec] :: BuildOptsCLI -> ![(String, [String])] [boptsCLIOnlyConfigure] :: BuildOptsCLI -> !Bool [boptsCLICommand] :: BuildOptsCLI -> !BuildCommand [boptsCLIInitialBuildSteps] :: BuildOptsCLI -> !Bool -- | Build options that may be specified in the stack.yaml or from the CLI data BuildOptsMonoid BuildOptsMonoid :: !Any -> !Any -> !Any -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !HaddockOptsMonoid -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !TestOptsMonoid -> !First Bool -> !BenchmarkOptsMonoid -> !First Bool -> !First Bool -> !First Bool -> ![Text] -> !First Bool -> BuildOptsMonoid [buildMonoidTrace] :: BuildOptsMonoid -> !Any [buildMonoidProfile] :: BuildOptsMonoid -> !Any [buildMonoidNoStrip] :: BuildOptsMonoid -> !Any [buildMonoidLibProfile] :: BuildOptsMonoid -> !First Bool [buildMonoidExeProfile] :: BuildOptsMonoid -> !First Bool [buildMonoidLibStrip] :: BuildOptsMonoid -> !First Bool [buildMonoidExeStrip] :: BuildOptsMonoid -> !First Bool [buildMonoidHaddock] :: BuildOptsMonoid -> !First Bool [buildMonoidHaddockOpts] :: BuildOptsMonoid -> !HaddockOptsMonoid [buildMonoidOpenHaddocks] :: BuildOptsMonoid -> !First Bool [buildMonoidHaddockDeps] :: BuildOptsMonoid -> !First Bool [buildMonoidHaddockInternal] :: BuildOptsMonoid -> !First Bool [buildMonoidHaddockHyperlinkSource] :: BuildOptsMonoid -> !First Bool [buildMonoidInstallExes] :: BuildOptsMonoid -> !First Bool [buildMonoidInstallCompilerTool] :: BuildOptsMonoid -> !First Bool [buildMonoidPreFetch] :: BuildOptsMonoid -> !First Bool [buildMonoidKeepGoing] :: BuildOptsMonoid -> !First Bool [buildMonoidKeepTmpFiles] :: BuildOptsMonoid -> !First Bool [buildMonoidForceDirty] :: BuildOptsMonoid -> !First Bool [buildMonoidTests] :: BuildOptsMonoid -> !First Bool [buildMonoidTestOpts] :: BuildOptsMonoid -> !TestOptsMonoid [buildMonoidBenchmarks] :: BuildOptsMonoid -> !First Bool [buildMonoidBenchmarkOpts] :: BuildOptsMonoid -> !BenchmarkOptsMonoid [buildMonoidReconfigure] :: BuildOptsMonoid -> !First Bool [buildMonoidCabalVerbose] :: BuildOptsMonoid -> !First Bool [buildMonoidSplitObjs] :: BuildOptsMonoid -> !First Bool [buildMonoidSkipComponents] :: BuildOptsMonoid -> ![Text] [buildMonoidInterleavedOutput] :: BuildOptsMonoid -> !First Bool -- | Options for the FinalAction DoTests data TestOpts TestOpts :: !Bool -> ![String] -> !Bool -> !Bool -> TestOpts -- | Whether successful tests will be run gain [toRerunTests] :: TestOpts -> !Bool -- | Arguments passed to the test program [toAdditionalArgs] :: TestOpts -> ![String] -- | Generate a code coverage report [toCoverage] :: TestOpts -> !Bool -- | Disable running of tests [toDisableRun] :: TestOpts -> !Bool defaultTestOpts :: TestOpts data TestOptsMonoid TestOptsMonoid :: !First Bool -> ![String] -> !First Bool -> !First Bool -> TestOptsMonoid [toMonoidRerunTests] :: TestOptsMonoid -> !First Bool [toMonoidAdditionalArgs] :: TestOptsMonoid -> ![String] [toMonoidCoverage] :: TestOptsMonoid -> !First Bool [toMonoidDisableRun] :: TestOptsMonoid -> !First Bool -- | Haddock Options newtype HaddockOpts HaddockOpts :: [String] -> HaddockOpts -- | Arguments passed to haddock program [hoAdditionalArgs] :: HaddockOpts -> [String] defaultHaddockOpts :: HaddockOpts newtype HaddockOptsMonoid HaddockOptsMonoid :: [String] -> HaddockOptsMonoid [hoMonoidAdditionalArgs] :: HaddockOptsMonoid -> [String] -- | Options for the FinalAction DoBenchmarks data BenchmarkOpts BenchmarkOpts :: !Maybe String -> !Bool -> BenchmarkOpts -- | Arguments passed to the benchmark program [beoAdditionalArgs] :: BenchmarkOpts -> !Maybe String -- | Disable running of benchmarks [beoDisableRun] :: BenchmarkOpts -> !Bool defaultBenchmarkOpts :: BenchmarkOpts data BenchmarkOptsMonoid BenchmarkOptsMonoid :: !First String -> !First Bool -> BenchmarkOptsMonoid [beoMonoidAdditionalArgs] :: BenchmarkOptsMonoid -> !First String [beoMonoidDisableRun] :: BenchmarkOptsMonoid -> !First Bool data FileWatchOpts NoFileWatch :: FileWatchOpts FileWatch :: FileWatchOpts FileWatchPoll :: FileWatchOpts -- | Which subset of packages to build data BuildSubset BSAll :: BuildSubset -- | Only install packages in the snapshot database, skipping packages -- intended for the local database. BSOnlySnapshot :: BuildSubset BSOnlyDependencies :: BuildSubset instance GHC.Show.Show Stack.Types.Config.Build.BuildOptsCLI instance GHC.Classes.Eq Stack.Types.Config.Build.FileWatchOpts instance GHC.Show.Show Stack.Types.Config.Build.FileWatchOpts instance GHC.Generics.Generic Stack.Types.Config.Build.BuildOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.BuildOptsMonoid instance GHC.Generics.Generic Stack.Types.Config.Build.BenchmarkOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.BenchmarkOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.BuildOpts instance GHC.Show.Show Stack.Types.Config.Build.BenchmarkOpts instance GHC.Classes.Eq Stack.Types.Config.Build.BenchmarkOpts instance GHC.Generics.Generic Stack.Types.Config.Build.HaddockOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.HaddockOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.HaddockOpts instance GHC.Classes.Eq Stack.Types.Config.Build.HaddockOpts instance GHC.Generics.Generic Stack.Types.Config.Build.TestOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.TestOptsMonoid instance GHC.Show.Show Stack.Types.Config.Build.TestOpts instance GHC.Classes.Eq Stack.Types.Config.Build.TestOpts instance GHC.Classes.Eq Stack.Types.Config.Build.BuildSubset instance GHC.Show.Show Stack.Types.Config.Build.BuildSubset instance GHC.Show.Show Stack.Types.Config.Build.BuildCommand instance GHC.Classes.Eq Stack.Types.Config.Build.BuildCommand instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.BuildOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Config.Build.BuildOptsMonoid instance GHC.Base.Monoid Stack.Types.Config.Build.BuildOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.BenchmarkOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Config.Build.BenchmarkOptsMonoid instance GHC.Base.Monoid Stack.Types.Config.Build.BenchmarkOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.HaddockOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Config.Build.HaddockOptsMonoid instance GHC.Base.Monoid Stack.Types.Config.Build.HaddockOptsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.Build.TestOptsMonoid) instance GHC.Base.Semigroup Stack.Types.Config.Build.TestOptsMonoid instance GHC.Base.Monoid Stack.Types.Config.Build.TestOptsMonoid module Stack.Options.PackageParser -- | Parser for package:[-]flag readFlag :: ReadM (Map (Maybe PackageName) (Map FlagName Bool)) module Stack.Types.Sig -- | A GPG signature. newtype Signature Signature :: ByteString -> Signature -- | The GPG fingerprint. data Fingerprint mkFingerprint :: Text -> Fingerprint -- | Exceptions data SigException GPGFingerprintException :: String -> SigException GPGNotFoundException :: SigException GPGSignException :: String -> SigException GPGVerifyException :: String -> SigException SigInvalidSDistTarBall :: SigException SigNoProjectRootException :: SigException SigServiceException :: String -> SigException instance GHC.Classes.Eq a => GHC.Classes.Eq (Stack.Types.Sig.Aeson a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Stack.Types.Sig.Aeson a) instance GHC.Classes.Ord Stack.Types.Sig.Fingerprint instance GHC.Classes.Eq Stack.Types.Sig.Fingerprint instance GHC.Classes.Eq Stack.Types.Sig.Signature instance GHC.Classes.Ord Stack.Types.Sig.Signature instance GHC.Exception.Type.Exception Stack.Types.Sig.SigException instance GHC.Show.Show Stack.Types.Sig.SigException instance Data.Aeson.Types.FromJSON.FromJSON (Stack.Types.Sig.Aeson Stack.Types.PackageName.PackageName) instance GHC.Show.Show Stack.Types.Sig.Fingerprint instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Sig.Fingerprint instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Sig.Fingerprint instance Data.String.IsString Stack.Types.Sig.Fingerprint instance GHC.Show.Show Stack.Types.Sig.Signature module Stack.Sig.GPG -- | Sign a file path with GPG, returning the Signature. gpgSign :: HasLogFunc env => Path Abs File -> RIO env Signature -- | Verify the Signature of a file path returning the -- Fingerprint. gpgVerify :: (MonadIO m, MonadThrow m) => Signature -> Path Abs File -> m Fingerprint -- | Template name handling. module Stack.Types.TemplateName -- | A template name. data TemplateName -- | Details for how to access a template from a remote repo. data RepoTemplatePath RepoTemplatePath :: RepoService -> Text -> Text -> RepoTemplatePath [rtpService] :: RepoTemplatePath -> RepoService [rtpUser] :: RepoTemplatePath -> Text [rtpTemplate] :: RepoTemplatePath -> Text -- | Services from which templates can be retrieved from a repository. data RepoService Github :: RepoService Gitlab :: RepoService Bitbucket :: RepoService data TemplatePath -- | an absolute path on the filesystem AbsPath :: Path Abs File -> TemplatePath -- | a relative path on the filesystem, or relative to the template -- repository RelPath :: Path Rel File -> TemplatePath -- | a full URL UrlPath :: String -> TemplatePath RepoPath :: RepoTemplatePath -> TemplatePath -- | Make a template name. mkTemplateName :: String -> Q Exp -- | Get a text representation of the template name. templateName :: TemplateName -> Text -- | Get the path of the template. templatePath :: TemplateName -> TemplatePath -- | Parse a template name from a string. parseTemplateNameFromString :: String -> Either String TemplateName -- | Parses a template path of the form 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) instance GHC.Show.Show Stack.Types.TemplateName.TemplateName instance GHC.Classes.Eq Stack.Types.TemplateName.TemplateName instance GHC.Classes.Ord Stack.Types.TemplateName.TemplateName instance GHC.Show.Show Stack.Types.TemplateName.TemplatePath instance GHC.Classes.Ord Stack.Types.TemplateName.TemplatePath instance GHC.Classes.Eq Stack.Types.TemplateName.TemplatePath instance GHC.Show.Show Stack.Types.TemplateName.RepoTemplatePath instance GHC.Classes.Ord Stack.Types.TemplateName.RepoTemplatePath instance GHC.Classes.Eq Stack.Types.TemplateName.RepoTemplatePath instance GHC.Show.Show Stack.Types.TemplateName.RepoService instance GHC.Classes.Ord Stack.Types.TemplateName.RepoService instance GHC.Classes.Eq Stack.Types.TemplateName.RepoService instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.TemplateName.TemplateName module Stack.Types.Urls data Urls Urls :: !Text -> !Text -> !Text -> Urls [urlsLatestSnapshot] :: Urls -> !Text [urlsLtsBuildPlans] :: Urls -> !Text [urlsNightlyBuildPlans] :: Urls -> !Text data UrlsMonoid UrlsMonoid :: !First Text -> !First Text -> !First Text -> UrlsMonoid [urlsMonoidLatestSnapshot] :: UrlsMonoid -> !First Text [urlsMonoidLtsBuildPlans] :: UrlsMonoid -> !First Text [urlsMonoidNightlyBuildPlans] :: UrlsMonoid -> !First Text instance GHC.Generics.Generic Stack.Types.Urls.UrlsMonoid instance GHC.Show.Show Stack.Types.Urls.UrlsMonoid instance GHC.Show.Show Stack.Types.Urls.Urls instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Urls.UrlsMonoid) instance GHC.Base.Semigroup Stack.Types.Urls.UrlsMonoid instance GHC.Base.Monoid Stack.Types.Urls.UrlsMonoid instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Urls.Urls) module Stack.Config.Urls urlsFromMonoid :: UrlsMonoid -> Urls -- | Versions for packages. module Stack.Types.Version -- | A package version. data Version data VersionRange newtype IntersectingVersionRange IntersectingVersionRange :: VersionRange -> IntersectingVersionRange [getIntersectingVersionRange] :: IntersectingVersionRange -> VersionRange data VersionCheck MatchMinor :: VersionCheck MatchExact :: VersionCheck NewerMinor :: VersionCheck -- | Attoparsec parser for a package version. versionParser :: Parser Version -- | Convenient way to parse a package version from a Text. parseVersion :: MonadThrow m => Text -> m Version -- | Migration function. parseVersionFromString :: MonadThrow m => String -> m Version -- | Get a string representation of a package version. versionString :: Version -> String -- | Get a string representation of a package version. versionText :: Version -> Text -- | Convert to a Cabal version. toCabalVersion :: Version -> Version -- | Convert from a Cabal version. fromCabalVersion :: Version -> Version -- | Make a package version. mkVersion :: String -> Q Exp -- | Display a version range versionRangeText :: VersionRange -> Text -- | Check if a version is within a version range. withinRange :: Version -> VersionRange -> Bool -- | A modified intersection which also simplifies, for better display. intersectVersionRanges :: VersionRange -> VersionRange -> VersionRange -- | Returns the first two components, defaulting to 0 if not present toMajorVersion :: Version -> Version -- | Given a version range and a set of versions, find the latest version -- from the set that is within the range. latestApplicableVersion :: VersionRange -> Set Version -> Maybe Version checkVersion :: VersionCheck -> Version -> Version -> Bool -- | Get the next major version number for the given version nextMajorVersion :: Version -> Version -- | A Package upgrade; Latest or a specific version. data UpgradeTo Specific :: Version -> UpgradeTo Latest :: UpgradeTo -- | Get minor version (excludes any patchlevel) minorVersion :: Version -> Version -- | Current Stack version stackVersion :: Version -- | Current Stack minor version (excludes patchlevel) stackMinorVersion :: Version instance GHC.Classes.Ord Stack.Types.Version.VersionCheck instance GHC.Classes.Eq Stack.Types.Version.VersionCheck instance GHC.Show.Show Stack.Types.Version.VersionCheck instance GHC.Show.Show Stack.Types.Version.IntersectingVersionRange instance GHC.Show.Show Stack.Types.Version.UpgradeTo instance Control.DeepSeq.NFData Stack.Types.Version.Version instance Data.Store.Impl.Store Stack.Types.Version.Version instance GHC.Generics.Generic Stack.Types.Version.Version instance Data.Data.Data Stack.Types.Version.Version instance GHC.Classes.Ord Stack.Types.Version.Version instance GHC.Classes.Eq Stack.Types.Version.Version instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Version.VersionCheck instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Version.VersionCheck instance GHC.Base.Semigroup Stack.Types.Version.IntersectingVersionRange instance GHC.Base.Monoid Stack.Types.Version.IntersectingVersionRange instance Data.Hashable.Class.Hashable Stack.Types.Version.Version instance Language.Haskell.TH.Syntax.Lift Stack.Types.Version.Version instance GHC.Show.Show Stack.Types.Version.Version instance RIO.Prelude.Display.Display Stack.Types.Version.Version instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Version.Version instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Version.Version instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.Version.Version instance GHC.Exception.Type.Exception Stack.Types.Version.VersionParseFail instance GHC.Show.Show Stack.Types.Version.VersionParseFail -- | Package identifier (name-version). module Stack.Types.PackageIdentifier -- | A pkg-ver combination. data PackageIdentifier PackageIdentifier :: !PackageName -> !Version -> PackageIdentifier -- | Get the name part of the identifier. [packageIdentifierName] :: PackageIdentifier -> !PackageName -- | Get the version part of the identifier. [packageIdentifierVersion] :: PackageIdentifier -> !Version -- | A PackageIdentifier combined with optionally specified Hackage -- cabal file revision. data PackageIdentifierRevision PackageIdentifierRevision :: !PackageIdentifier -> !CabalFileInfo -> PackageIdentifierRevision [pirIdent] :: PackageIdentifierRevision -> !PackageIdentifier [pirRevision] :: PackageIdentifierRevision -> !CabalFileInfo -- | A cryptographic hash of a Cabal file. data CabalHash -- | Generate a CabalHash value from a base16-encoded SHA256 hash. mkCabalHashFromSHA256 :: Text -> Either SomeException CabalHash -- | Compute a CabalHash value from a cabal file's contents. computeCabalHash :: ByteString -> CabalHash showCabalHash :: CabalHash -> Text -- | Information on the contents of a cabal file data CabalFileInfo -- | Take the latest revision of the cabal file available. This isn't -- reproducible at all, but the running assumption (not necessarily true) -- is that cabal file revisions do not change semantics of the build. CFILatest :: CabalFileInfo -- | Identify by contents of the cabal file itself CFIHash :: !Maybe Int -> !CabalHash -> CabalFileInfo -- | Identify by revision number, with 0 being the original and counting -- upward. CFIRevision :: !Word -> CabalFileInfo -- | Convert from a package identifier to a tuple. toTuple :: PackageIdentifier -> (PackageName, Version) -- | Convert from a tuple to a package identifier. fromTuple :: (PackageName, Version) -> PackageIdentifier -- | Convenient way to parse a package identifier from a Text. parsePackageIdentifier :: MonadThrow m => Text -> m PackageIdentifier -- | Convenience function for parsing from a Value. parsePackageIdentifierFromString :: MonadThrow m => String -> m PackageIdentifier -- | Parse a PackageIdentifierRevision parsePackageIdentifierRevision :: MonadThrow m => Text -> m PackageIdentifierRevision -- | A parser for a package-version pair. packageIdentifierParser :: Parser PackageIdentifier -- | Get a string representation of the package identifier; name-ver. packageIdentifierString :: PackageIdentifier -> String -- | Get a string representation of the package identifier with revision; -- name-ver[@hashtype:hash[,size]]. packageIdentifierRevisionString :: PackageIdentifierRevision -> String -- | Get a Text representation of the package identifier; name-ver. packageIdentifierText :: PackageIdentifier -> Text toCabalPackageIdentifier :: PackageIdentifier -> PackageIdentifier fromCabalPackageIdentifier :: PackageIdentifier -> PackageIdentifier -- | A SHA256 hash, stored in a static size for more efficient -- serialization with store. data StaticSHA256 -- | Generate a StaticSHA256 value from a base16-encoded SHA256 -- hash. mkStaticSHA256FromText :: Text -> Either SomeException StaticSHA256 -- | Generate a StaticSHA256 value from the contents of a file. mkStaticSHA256FromFile :: MonadIO m => Path Abs File -> m StaticSHA256 mkStaticSHA256FromDigest :: Digest SHA256 -> StaticSHA256 -- | Convert a StaticSHA256 into a base16-encoded SHA256 hash. staticSHA256ToText :: StaticSHA256 -> Text -- | Convert a StaticSHA256 into a base16-encoded SHA256 hash. staticSHA256ToBase16 :: StaticSHA256 -> ByteString staticSHA256ToRaw :: StaticSHA256 -> ByteString instance Data.Data.Data Stack.Types.PackageIdentifier.PackageIdentifierRevision instance GHC.Generics.Generic Stack.Types.PackageIdentifier.PackageIdentifierRevision instance GHC.Classes.Ord Stack.Types.PackageIdentifier.PackageIdentifierRevision instance GHC.Classes.Eq Stack.Types.PackageIdentifier.PackageIdentifierRevision instance Data.Data.Data Stack.Types.PackageIdentifier.CabalFileInfo instance GHC.Classes.Ord Stack.Types.PackageIdentifier.CabalFileInfo instance GHC.Classes.Eq Stack.Types.PackageIdentifier.CabalFileInfo instance GHC.Show.Show Stack.Types.PackageIdentifier.CabalFileInfo instance GHC.Generics.Generic Stack.Types.PackageIdentifier.CabalFileInfo instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.CabalHash instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.CabalHash instance GHC.Classes.Ord Stack.Types.PackageIdentifier.CabalHash instance Data.Data.Data Stack.Types.PackageIdentifier.CabalHash instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.CabalHash instance GHC.Classes.Eq Stack.Types.PackageIdentifier.CabalHash instance GHC.Show.Show Stack.Types.PackageIdentifier.CabalHash instance GHC.Generics.Generic Stack.Types.PackageIdentifier.CabalHash instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.StaticSHA256 instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.StaticSHA256 instance GHC.Classes.Ord Stack.Types.PackageIdentifier.StaticSHA256 instance Data.Data.Data Stack.Types.PackageIdentifier.StaticSHA256 instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.StaticSHA256 instance GHC.Classes.Eq Stack.Types.PackageIdentifier.StaticSHA256 instance GHC.Show.Show Stack.Types.PackageIdentifier.StaticSHA256 instance GHC.Generics.Generic Stack.Types.PackageIdentifier.StaticSHA256 instance Data.Data.Data Stack.Types.PackageIdentifier.PackageIdentifier instance GHC.Generics.Generic Stack.Types.PackageIdentifier.PackageIdentifier instance GHC.Classes.Ord Stack.Types.PackageIdentifier.PackageIdentifier instance GHC.Classes.Eq Stack.Types.PackageIdentifier.PackageIdentifier instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.PackageIdentifierRevision instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.PackageIdentifierRevision instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.PackageIdentifierRevision instance GHC.Show.Show Stack.Types.PackageIdentifier.PackageIdentifierRevision instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageIdentifier.PackageIdentifierRevision instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIdentifier.PackageIdentifierRevision instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.CabalFileInfo instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.CabalFileInfo instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.CabalFileInfo instance Control.DeepSeq.NFData Stack.Types.PackageIdentifier.PackageIdentifier instance Data.Hashable.Class.Hashable Stack.Types.PackageIdentifier.PackageIdentifier instance Data.Store.Impl.Store Stack.Types.PackageIdentifier.PackageIdentifier instance GHC.Show.Show Stack.Types.PackageIdentifier.PackageIdentifier instance RIO.Prelude.Display.Display Stack.Types.PackageIdentifier.PackageIdentifier instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageIdentifier.PackageIdentifier instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIdentifier.PackageIdentifier instance GHC.Show.Show Stack.Types.PackageIdentifier.PackageIdentifierParseFail instance GHC.Exception.Type.Exception Stack.Types.PackageIdentifier.PackageIdentifierParseFail module Stack.Types.PackageIndex data PackageDownload PackageDownload :: !StaticSHA256 -> !ByteString -> !Word64 -> PackageDownload [pdSHA256] :: PackageDownload -> !StaticSHA256 [pdUrl] :: PackageDownload -> !ByteString [pdSize] :: PackageDownload -> !Word64 -- | Hackage Security provides a different JSON format, we'll have our own -- JSON parser for it. newtype HSPackageDownload HSPackageDownload :: PackageDownload -> HSPackageDownload [unHSPackageDownload] :: HSPackageDownload -> PackageDownload -- | Cached information about packages in an index. We have a mapping from -- package name to a version map. Within the version map, we map from the -- version to information on an individual version. Each version has -- optional download information (about the package's tarball itself), -- and cabal file information. The cabal file information is a non-empty -- list of all cabal file revisions. Each file revision indicates the -- hash of the contents of the cabal file, and the offset into the index -- tarball. -- -- The reason for each Version mapping to a two element list of -- CabalHashes is because some older Stackage snapshots have CRs -- in their cabal files. For compatibility with these older snapshots, -- both hashes are stored: the first element of the two element list -- being the original hash, and the (potential) second element with the -- CRs stripped. [Note: This is was initially stored as a two element -- list, and cannot be easily packed into more explict ADT or newtype -- because of some template-haskell that would need to be modified as -- well: the versionedDecodeOrLoad function call found in the -- getPackageCaches function in PackageIndex.] -- -- It's assumed that cabal files appear in the index tarball in the -- correct revision order. newtype PackageCache index PackageCache :: HashMap PackageName (HashMap Version (index, Maybe PackageDownload, NonEmpty ([CabalHash], OffsetSize))) -> PackageCache index -- | offset in bytes into the 01-index.tar file for the .cabal file -- contents, and size in bytes of the .cabal file data OffsetSize OffsetSize :: !Int64 -> !Int64 -> OffsetSize -- | Information on a single package index data PackageIndex PackageIndex :: !IndexName -> !Text -> !IndexType -> !Text -> !Bool -> PackageIndex [indexName] :: PackageIndex -> !IndexName -- | URL for the tarball or, in the case of Hackage Security, the root of -- the directory [indexLocation] :: PackageIndex -> !Text [indexType] :: PackageIndex -> !IndexType -- | URL prefix for downloading packages [indexDownloadPrefix] :: PackageIndex -> !Text -- | Require that hashes and package size information be available for -- packages in this index [indexRequireHashes] :: PackageIndex -> !Bool -- | Unique name for a package index newtype IndexName IndexName :: ByteString -> IndexName [unIndexName] :: IndexName -> ByteString indexNameText :: IndexName -> Text data IndexType ITHackageSecurity :: !HackageSecurity -> IndexType ITVanilla :: IndexType data HackageSecurity HackageSecurity :: ![Text] -> !Int -> HackageSecurity [hsKeyIds] :: HackageSecurity -> ![Text] [hsKeyThreshold] :: HackageSecurity -> !Int instance GHC.Show.Show Stack.Types.PackageIndex.PackageIndex instance GHC.Classes.Ord Stack.Types.PackageIndex.IndexType instance GHC.Classes.Eq Stack.Types.PackageIndex.IndexType instance GHC.Show.Show Stack.Types.PackageIndex.IndexType instance GHC.Classes.Ord Stack.Types.PackageIndex.HackageSecurity instance GHC.Classes.Eq Stack.Types.PackageIndex.HackageSecurity instance GHC.Show.Show Stack.Types.PackageIndex.HackageSecurity instance Data.Store.Impl.Store Stack.Types.PackageIndex.IndexName instance Data.Hashable.Class.Hashable Stack.Types.PackageIndex.IndexName instance GHC.Classes.Ord Stack.Types.PackageIndex.IndexName instance GHC.Classes.Eq Stack.Types.PackageIndex.IndexName instance GHC.Show.Show Stack.Types.PackageIndex.IndexName instance Control.DeepSeq.NFData index => Control.DeepSeq.NFData (Stack.Types.PackageIndex.PackageCache index) instance Data.Store.Impl.Store index => Data.Store.Impl.Store (Stack.Types.PackageIndex.PackageCache index) instance Data.Data.Data index => Data.Data.Data (Stack.Types.PackageIndex.PackageCache index) instance GHC.Show.Show index => GHC.Show.Show (Stack.Types.PackageIndex.PackageCache index) instance GHC.Classes.Eq index => GHC.Classes.Eq (Stack.Types.PackageIndex.PackageCache index) instance GHC.Generics.Generic (Stack.Types.PackageIndex.PackageCache index) instance Data.Data.Data Stack.Types.PackageIndex.PackageDownload instance GHC.Classes.Eq Stack.Types.PackageIndex.PackageDownload instance GHC.Generics.Generic Stack.Types.PackageIndex.PackageDownload instance GHC.Show.Show Stack.Types.PackageIndex.PackageDownload instance Data.Data.Data Stack.Types.PackageIndex.OffsetSize instance GHC.Show.Show Stack.Types.PackageIndex.OffsetSize instance GHC.Classes.Eq Stack.Types.PackageIndex.OffsetSize instance GHC.Generics.Generic Stack.Types.PackageIndex.OffsetSize instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.PackageIndex.PackageIndex) instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.HackageSecurity instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.PackageIndex.IndexName instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.IndexName instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.HSPackageDownload instance GHC.Base.Semigroup (Stack.Types.PackageIndex.PackageCache index) instance GHC.Base.Monoid (Stack.Types.PackageIndex.PackageCache index) instance Data.Store.Impl.Store Stack.Types.PackageIndex.PackageDownload instance Control.DeepSeq.NFData Stack.Types.PackageIndex.PackageDownload instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.PackageIndex.PackageDownload instance Data.Store.Impl.Store Stack.Types.PackageIndex.OffsetSize instance Control.DeepSeq.NFData Stack.Types.PackageIndex.OffsetSize module Stack.Types.PackageDump -- | Cached information on whether package have profiling libraries and -- haddocks. newtype InstalledCache InstalledCache :: IORef InstalledCacheInner -> InstalledCache newtype InstalledCacheInner InstalledCacheInner :: Map GhcPkgId InstalledCacheEntry -> InstalledCacheInner -- | Cached information on whether a package has profiling libraries and -- haddocks. data InstalledCacheEntry InstalledCacheEntry :: !Bool -> !Bool -> !Bool -> !PackageIdentifier -> InstalledCacheEntry [installedCacheProfiling] :: InstalledCacheEntry -> !Bool [installedCacheHaddock] :: InstalledCacheEntry -> !Bool [installedCacheSymbols] :: InstalledCacheEntry -> !Bool [installedCacheIdent] :: InstalledCacheEntry -> !PackageIdentifier installedCacheVC :: VersionConfig InstalledCacheInner instance Data.Data.Data Stack.Types.PackageDump.InstalledCacheInner instance GHC.Show.Show Stack.Types.PackageDump.InstalledCacheInner instance GHC.Classes.Eq Stack.Types.PackageDump.InstalledCacheInner instance GHC.Generics.Generic Stack.Types.PackageDump.InstalledCacheInner instance Data.Store.Impl.Store Stack.Types.PackageDump.InstalledCacheInner instance Data.Data.Data Stack.Types.PackageDump.InstalledCacheEntry instance GHC.Show.Show Stack.Types.PackageDump.InstalledCacheEntry instance GHC.Generics.Generic Stack.Types.PackageDump.InstalledCacheEntry instance GHC.Classes.Eq Stack.Types.PackageDump.InstalledCacheEntry instance Data.Store.Impl.Store Stack.Types.PackageDump.InstalledCacheEntry module Control.Concurrent.Execute data ActionType -- | Action for building a package's library and executables. If -- taskAllInOne is True, then this will also build -- benchmarks and tests. It is False when then library's -- benchmarks or test-suites have cyclic dependencies. ATBuild :: ActionType -- | Task for building the package's benchmarks and test-suites. Requires -- that the library was already built. ATBuildFinal :: ActionType -- | Task for running the package's test-suites. ATRunTests :: ActionType -- | Task for running the package's benchmarks. ATRunBenchmarks :: ActionType data ActionId ActionId :: !PackageIdentifier -> !ActionType -> ActionId data ActionContext ActionContext :: !Set ActionId -> [Action] -> !Concurrency -> ActionContext -- | Does not include the current action [acRemaining] :: ActionContext -> !Set ActionId -- | Actions which depend on the current action [acDownstream] :: ActionContext -> [Action] -- | Whether this action may be run concurrently with others [acConcurrency] :: ActionContext -> !Concurrency data Action Action :: !ActionId -> !Set ActionId -> !ActionContext -> IO () -> !Concurrency -> Action [actionId] :: Action -> !ActionId [actionDeps] :: Action -> !Set ActionId [actionDo] :: Action -> !ActionContext -> IO () [actionConcurrency] :: Action -> !Concurrency data Concurrency ConcurrencyAllowed :: Concurrency ConcurrencyDisallowed :: Concurrency runActions :: Int -> Bool -> [Action] -> (TVar Int -> TVar (Set ActionId) -> IO ()) -> IO [SomeException] instance GHC.Classes.Eq Control.Concurrent.Execute.Concurrency instance GHC.Classes.Ord Control.Concurrent.Execute.ActionId instance GHC.Classes.Eq Control.Concurrent.Execute.ActionId instance GHC.Show.Show Control.Concurrent.Execute.ActionId instance GHC.Classes.Ord Control.Concurrent.Execute.ActionType instance GHC.Classes.Eq Control.Concurrent.Execute.ActionType instance GHC.Show.Show Control.Concurrent.Execute.ActionType instance GHC.Exception.Type.Exception Control.Concurrent.Execute.ExecuteException instance GHC.Show.Show Control.Concurrent.Execute.ExecuteException module Stack.Types.Compiler -- | Variety of compiler to use. data WhichCompiler Ghc :: WhichCompiler Ghcjs :: WhichCompiler -- | Whether the compiler version given is the wanted version (what the -- stack.yaml file, snapshot file, or --resolver argument request), or -- the actual installed GHC. Depending on the matching requirements, -- these values could be different. data CVType CVWanted :: CVType CVActual :: CVType -- | Specifies a compiler and its version number(s). -- -- Note that despite having this datatype, stack isn't in a hurry to -- support compilers other than GHC. data CompilerVersion (cvType :: CVType) GhcVersion :: {-# UNPACK #-} !Version -> CompilerVersion GhcjsVersion :: {-# UNPACK #-} !Version -> {-# UNPACK #-} !Version -> CompilerVersion actualToWanted :: CompilerVersion 'CVActual -> CompilerVersion 'CVWanted wantedToActual :: CompilerVersion 'CVWanted -> CompilerVersion 'CVActual parseCompilerVersion :: Text -> Maybe (CompilerVersion a) compilerVersionText :: CompilerVersion a -> Text compilerVersionString :: CompilerVersion a -> String whichCompiler :: CompilerVersion a -> WhichCompiler isWantedCompiler :: VersionCheck -> CompilerVersion 'CVWanted -> CompilerVersion 'CVActual -> Bool getGhcVersion :: CompilerVersion a -> Version compilerExeName :: WhichCompiler -> String haddockExeName :: WhichCompiler -> String instance Data.Typeable.Internal.Typeable cvType => Data.Data.Data (Stack.Types.Compiler.CompilerVersion cvType) instance GHC.Classes.Ord (Stack.Types.Compiler.CompilerVersion cvType) instance GHC.Classes.Eq (Stack.Types.Compiler.CompilerVersion cvType) instance GHC.Show.Show (Stack.Types.Compiler.CompilerVersion cvType) instance GHC.Generics.Generic (Stack.Types.Compiler.CompilerVersion cvType) instance GHC.Classes.Ord Stack.Types.Compiler.WhichCompiler instance GHC.Classes.Eq Stack.Types.Compiler.WhichCompiler instance GHC.Show.Show Stack.Types.Compiler.WhichCompiler instance Data.Store.Impl.Store (Stack.Types.Compiler.CompilerVersion a) instance Control.DeepSeq.NFData (Stack.Types.Compiler.CompilerVersion a) instance RIO.Prelude.Display.Display (Stack.Types.Compiler.CompilerVersion a) instance Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.Compiler.CompilerVersion a) instance Data.Aeson.Types.FromJSON.FromJSON (Stack.Types.Compiler.CompilerVersion a) instance Data.Aeson.Types.FromJSON.FromJSONKey (Stack.Types.Compiler.CompilerVersion a) module Stack.Types.Resolver type Resolver = ResolverWith (Either Request FilePath) data IsLoaded Loaded :: IsLoaded NotLoaded :: IsLoaded type LoadedResolver = ResolverWith SnapshotHash -- | How we resolve which dependencies to install given a set of packages. data ResolverWith customContents -- | Use an official snapshot from the Stackage project, either an LTS -- Haskell or Stackage Nightly. ResolverStackage :: !SnapName -> ResolverWith customContents -- | Require a specific compiler version, but otherwise provide no build -- plan. Intended for use cases where end user wishes to specify all -- upstream dependencies manually, such as using a dependency solver. ResolverCompiler :: !CompilerVersion 'CVWanted -> ResolverWith customContents -- | A custom resolver based on the given location (as a raw URL or -- filepath). If customContents is a Either Request -- FilePath, it represents the parsed location value (with filepaths -- resolved relative to the directory containing the file referring to -- the custom snapshot). Once it has been loaded from disk, it will be -- replaced with a SnapshotHash value, which is used to store -- cached files. ResolverCustom :: !Text -> !customContents -> ResolverWith customContents -- | Parse a Resolver from a Text parseResolverText :: Text -> ResolverWith () -- | Either an actual resolver value, or an abstract description of one -- (e.g., latest nightly). data AbstractResolver ARLatestNightly :: AbstractResolver ARLatestLTS :: AbstractResolver ARLatestLTSMajor :: !Int -> AbstractResolver ARResolver :: !ResolverWith () -> AbstractResolver ARGlobal :: AbstractResolver readAbstractResolver :: ReadM AbstractResolver -- | Convert a Resolver into its Text representation for human -- presentation. When possible, you should prefer -- sdResolverName, as it will handle the human-friendly name -- inside a custom snapshot. resolverRawName :: ResolverWith a -> Text -- | The name of an LTS Haskell or Stackage Nightly snapshot. data SnapName LTS :: !Int -> !Int -> SnapName Nightly :: !Day -> SnapName -- | Most recent Nightly and newest LTS version per major release. data Snapshots Snapshots :: !Day -> !IntMap Int -> Snapshots [snapshotsNightly] :: Snapshots -> !Day [snapshotsLts] :: Snapshots -> !IntMap Int -- | Convert a SnapName into its short representation, e.g. -- lts-2.8, nightly-2015-03-05. renderSnapName :: SnapName -> Text -- | Parse the short representation of a SnapName. parseSnapName :: MonadThrow m => Text -> m SnapName data SnapshotHash -- | Return the first 12 characters of the hash as a B64URL-encoded string. trimmedSnapshotHash :: SnapshotHash -> Text -- | Return the raw bytes in the hash snapshotHashToBS :: SnapshotHash -> ByteString -- | Create a new SnapshotHash by SHA256 hashing the given contents snapshotHashFromBS :: ByteString -> SnapshotHash -- | Create a new SnapshotHash from the given digest snapshotHashFromDigest :: Digest SHA256 -> SnapshotHash parseCustomLocation :: MonadThrow m => Maybe (Path Abs Dir) -> ResolverWith () -> m Resolver instance GHC.Classes.Eq Stack.Types.Resolver.SnapshotHash instance Data.Data.Data Stack.Types.Resolver.SnapshotHash instance GHC.Show.Show Stack.Types.Resolver.SnapshotHash instance GHC.Generics.Generic Stack.Types.Resolver.SnapshotHash instance GHC.Show.Show Stack.Types.Resolver.Snapshots instance GHC.Show.Show Stack.Types.Resolver.AbstractResolver instance Data.Traversable.Traversable Stack.Types.Resolver.ResolverWith instance Data.Foldable.Foldable Stack.Types.Resolver.ResolverWith instance GHC.Base.Functor Stack.Types.Resolver.ResolverWith instance GHC.Classes.Eq customContents => GHC.Classes.Eq (Stack.Types.Resolver.ResolverWith customContents) instance Data.Data.Data customContents => Data.Data.Data (Stack.Types.Resolver.ResolverWith customContents) instance GHC.Show.Show customContents => GHC.Show.Show (Stack.Types.Resolver.ResolverWith customContents) instance GHC.Generics.Generic (Stack.Types.Resolver.ResolverWith customContents) instance GHC.Classes.Eq Stack.Types.Resolver.SnapName instance Data.Data.Data Stack.Types.Resolver.SnapName instance GHC.Show.Show Stack.Types.Resolver.SnapName instance GHC.Generics.Generic Stack.Types.Resolver.SnapName instance Data.Store.Impl.Store Stack.Types.Resolver.LoadedResolver instance Control.DeepSeq.NFData Stack.Types.Resolver.LoadedResolver instance Data.Store.Impl.Store Stack.Types.Resolver.SnapshotHash instance Control.DeepSeq.NFData Stack.Types.Resolver.SnapshotHash instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Resolver.Snapshots instance GHC.Exception.Type.Exception Stack.Types.Resolver.BuildPlanTypesException instance GHC.Show.Show Stack.Types.Resolver.BuildPlanTypesException instance Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.Resolver.ResolverWith a) instance (a Data.Type.Equality.~ ()) => Data.Aeson.Types.FromJSON.FromJSON (Stack.Types.Resolver.ResolverWith a) instance Data.Store.Impl.Store Stack.Types.Resolver.SnapName instance Control.DeepSeq.NFData Stack.Types.Resolver.SnapName instance RIO.Prelude.Display.Display Stack.Types.Resolver.SnapName module Stack.Options.ResolverParser -- | Parser for the resolver abstractResolverOptsParser :: Bool -> Parser AbstractResolver compilerOptsParser :: Bool -> Parser (CompilerVersion 'CVWanted) readCompilerVersion :: ReadM (CompilerVersion 'CVWanted) -- | Constants used throughout the project. module Stack.Constants -- | Path where build plans are stored. buildPlanDir :: Path Abs Dir -> Path Abs Dir -- | Path where binary caches of the build plans are stored. buildPlanCacheDir :: Path Abs Dir -> Path Abs Dir -- | Extensions for anything that can be a Haskell module. haskellModuleExts :: [Text] -- | The filename used for the stack config file. stackDotYaml :: Path Rel File -- | Environment variable used to override the '.stack-work' relative dir. stackWorkEnvVar :: String -- | Environment variable used to override the '~/.stack' location. stackRootEnvVar :: String -- | Option name for the global stack root. stackRootOptionName :: String -- | Deprecated option name for the global stack root. -- -- Deprecated since stack-1.1.0. -- -- TODO: Remove occurences of this variable and use -- stackRootOptionName only after an appropriate deprecation -- period. deprecatedStackRootOptionName :: String -- | Environment variable used to indicate stack is running in container. inContainerEnvVar :: String -- | Environment variable used to indicate stack is running in container. -- although we already have STACK_IN_NIX_EXTRA_ARGS that is set in the -- same conditions, it can happen that STACK_IN_NIX_EXTRA_ARGS is set to -- empty. inNixShellEnvVar :: String -- | Name of the stack program. stackProgName :: String -- | Name of the stack program, uppercased stackProgNameUpper :: String wiredInPackages :: HashSet PackageName ghcjsBootPackages :: HashSet PackageName -- | Just to avoid repetition and magic strings. cabalPackageName :: PackageName -- | Deprecated implicit global project directory used when outside of a -- project. implicitGlobalProjectDirDeprecated :: Path Abs Dir -> Path Abs Dir -- | Implicit global project directory used when outside of a project. -- Normally, 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, and similarly, --ghcjs-options -- for Ghcjs. compilerOptionsCabalFlag :: WhichCompiler -> String -- | The flag to pass to GHC when we want to force its output to be -- colorized. ghcColorForceFlag :: String -- | The minimum allowed terminal width. Used for pretty-printing. minTerminalWidth :: Int -- | The maximum allowed terminal width. Used for pretty-printing. maxTerminalWidth :: Int -- | The default terminal width. Used for pretty-printing when we can't -- automatically detect it and when the user doesn't supply one. defaultTerminalWidth :: Int -- | True if using Windows OS. osIsWindows :: Bool -- | Docker types. module Stack.Types.Docker -- | Docker configuration. data DockerOpts DockerOpts :: !Bool -> !String -> !Bool -> !Maybe String -> !Maybe String -> !Bool -> !Bool -> !Bool -> !Maybe String -> ![String] -> ![Mount] -> ![String] -> !Path Abs File -> !Maybe DockerStackExe -> !Maybe Bool -> !VersionRange -> DockerOpts -- | Is using Docker enabled? [dockerEnable] :: DockerOpts -> !Bool -- | Exact Docker image tag or ID. Overrides docker-repo-*/tag. [dockerImage] :: DockerOpts -> !String -- | Does registry require login for pulls? [dockerRegistryLogin] :: DockerOpts -> !Bool -- | Optional username for Docker registry. [dockerRegistryUsername] :: DockerOpts -> !Maybe String -- | Optional password for Docker registry. [dockerRegistryPassword] :: DockerOpts -> !Maybe String -- | Automatically pull new images. [dockerAutoPull] :: DockerOpts -> !Bool -- | Whether to run a detached container [dockerDetach] :: DockerOpts -> !Bool -- | Create a persistent container (don't remove it when finished). Implied -- by dockerDetach. [dockerPersist] :: DockerOpts -> !Bool -- | Container name to use, only makes sense from command-line with -- dockerPersist or dockerDetach. [dockerContainerName] :: DockerOpts -> !Maybe String -- | Arguments to pass directly to docker run. [dockerRunArgs] :: DockerOpts -> ![String] -- | Volumes to mount in the container. [dockerMount] :: DockerOpts -> ![Mount] -- | Environment variables to set in the container. [dockerEnv] :: DockerOpts -> ![String] -- | Location of image usage database. [dockerDatabasePath] :: DockerOpts -> !Path Abs File -- | Location of container-compatible stack executable [dockerStackExe] :: DockerOpts -> !Maybe DockerStackExe -- | Set in-container user to match host's [dockerSetUser] :: DockerOpts -> !Maybe Bool -- | Require a version of Docker within this range. [dockerRequireDockerVersion] :: DockerOpts -> !VersionRange -- | An uninterpreted representation of docker options. Configurations may -- be "cascaded" using mappend (left-biased). data DockerOptsMonoid DockerOptsMonoid :: !Any -> !First Bool -> !First DockerMonoidRepoOrImage -> !First Bool -> !First String -> !First String -> !First Bool -> !First Bool -> !First Bool -> !First String -> ![String] -> ![Mount] -> ![String] -> !First (Path Abs File) -> !First DockerStackExe -> !First Bool -> !IntersectingVersionRange -> DockerOptsMonoid -- | Should Docker be defaulted to enabled (does docker: section -- exist in the config)? [dockerMonoidDefaultEnable] :: DockerOptsMonoid -> !Any -- | Is using Docker enabled? [dockerMonoidEnable] :: DockerOptsMonoid -> !First Bool -- | Docker repository name (e.g. fpco/stack-build or -- fpco/stack-full:lts-2.8) [dockerMonoidRepoOrImage] :: DockerOptsMonoid -> !First DockerMonoidRepoOrImage -- | Does registry require login for pulls? [dockerMonoidRegistryLogin] :: DockerOptsMonoid -> !First Bool -- | Optional username for Docker registry. [dockerMonoidRegistryUsername] :: DockerOptsMonoid -> !First String -- | Optional password for Docker registry. [dockerMonoidRegistryPassword] :: DockerOptsMonoid -> !First String -- | Automatically pull new images. [dockerMonoidAutoPull] :: DockerOptsMonoid -> !First Bool -- | Whether to run a detached container [dockerMonoidDetach] :: DockerOptsMonoid -> !First Bool -- | Create a persistent container (don't remove it when finished). Implied -- by dockerDetach. [dockerMonoidPersist] :: DockerOptsMonoid -> !First Bool -- | Container name to use, only makes sense from command-line with -- dockerPersist or dockerDetach. [dockerMonoidContainerName] :: DockerOptsMonoid -> !First String -- | Arguments to pass directly to docker run [dockerMonoidRunArgs] :: DockerOptsMonoid -> ![String] -- | Volumes to mount in the container [dockerMonoidMount] :: DockerOptsMonoid -> ![Mount] -- | Environment variables to set in the container [dockerMonoidEnv] :: DockerOptsMonoid -> ![String] -- | Location of image usage database. [dockerMonoidDatabasePath] :: DockerOptsMonoid -> !First (Path Abs File) -- | Location of container-compatible stack executable [dockerMonoidStackExe] :: DockerOptsMonoid -> !First DockerStackExe -- | Set in-container user to match host's [dockerMonoidSetUser] :: DockerOptsMonoid -> !First Bool -- | See: dockerRequireDockerVersion [dockerMonoidRequireDockerVersion] :: 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 -- | Parse DockerStackExe. parseDockerStackExe :: MonadThrow m => String -> m DockerStackExe -- | Docker volume mount. data Mount Mount :: String -> String -> Mount -- | Options for Docker repository or image. data DockerMonoidRepoOrImage DockerMonoidRepo :: String -> DockerMonoidRepoOrImage DockerMonoidImage :: String -> DockerMonoidRepoOrImage -- | Newtype for non-orphan FromJSON instance. newtype VersionRangeJSON VersionRangeJSON :: VersionRange -> VersionRangeJSON [unVersionRangeJSON] :: VersionRangeJSON -> VersionRange -- | Exceptions thrown by Stack.Docker. data StackDockerException -- | Docker must be enabled to use the command. DockerMustBeEnabledException :: StackDockerException -- | Command must be run on host OS (not in a container). OnlyOnHostException :: StackDockerException -- | docker inspect failed. InspectFailedException :: String -> StackDockerException -- | Image does not exist. NotPulledException :: String -> StackDockerException -- | Input to docker cleanup has invalid command. InvalidCleanupCommandException :: String -> StackDockerException -- | Invalid output from docker images. InvalidImagesOutputException :: String -> StackDockerException -- | Invalid output from docker ps. InvalidPSOutputException :: String -> StackDockerException -- | Invalid output from docker inspect. InvalidInspectOutputException :: String -> StackDockerException -- | Could not pull a Docker image. PullFailedException :: String -> StackDockerException -- | Installed version of docker below minimum version. DockerTooOldException :: Version -> Version -> StackDockerException -- | Installed version of docker is prohibited. DockerVersionProhibitedException :: [Version] -> Version -> StackDockerException -- | Installed version of docker is out of range specified in -- config file. BadDockerVersionException :: VersionRange -> Version -> StackDockerException -- | Invalid output from docker --version. InvalidVersionOutputException :: StackDockerException -- | Version of stack on host is too old for version in image. HostStackTooOldException :: Version -> Maybe Version -> StackDockerException -- | Version of stack in container/image is too old for version on -- host. ContainerStackTooOldException :: Version -> Version -> StackDockerException -- | Can't determine the project root (where to put docker sandbox). CannotDetermineProjectRootException :: StackDockerException -- | docker --version failed. DockerNotInstalledException :: StackDockerException -- | Using host stack-exe on unsupported platform. UnsupportedStackExeHostPlatformException :: StackDockerException -- | stack-exe option fails to parse. DockerStackExeParseException :: String -> StackDockerException -- | Docker enable argument name. dockerEnableArgName :: Text -- | Docker repo arg argument name. dockerRepoArgName :: Text -- | Docker image argument name. dockerImageArgName :: Text -- | Docker registry login argument name. dockerRegistryLoginArgName :: Text -- | Docker registry username argument name. dockerRegistryUsernameArgName :: Text -- | Docker registry password argument name. dockerRegistryPasswordArgName :: Text -- | Docker auto-pull argument name. dockerAutoPullArgName :: Text -- | Docker detach argument name. dockerDetachArgName :: Text -- | Docker run args argument name. dockerRunArgsArgName :: Text -- | Docker mount argument name. dockerMountArgName :: Text -- | Docker environment variable argument name. dockerEnvArgName :: Text -- | Docker container name argument name. dockerContainerNameArgName :: Text -- | Docker persist argument name. dockerPersistArgName :: Text -- | Docker database path argument name. dockerDatabasePathArgName :: Text -- | Docker database path argument name. dockerStackExeArgName :: Text -- | Value for --docker-stack-exe=download dockerStackExeDownloadVal :: String -- | Value for --docker-stack-exe=host dockerStackExeHostVal :: String -- | Value for --docker-stack-exe=image dockerStackExeImageVal :: String -- | Docker set-user argument name dockerSetUserArgName :: Text -- | Docker require-version argument name dockerRequireDockerVersionArgName :: Text -- | Argument name used to pass docker entrypoint data (only used -- internally) dockerEntrypointArgName :: String -- | Command-line argument for "docker" dockerCmdName :: String dockerHelpOptName :: String -- | Command-line argument for docker pull. dockerPullCmdName :: String -- | Command-line argument for docker cleanup. dockerCleanupCmdName :: String -- | Command-line option for --internal-re-exec-version. reExecArgName :: String -- | Platform that Docker containers run dockerContainerPlatform :: Platform instance GHC.Generics.Generic Stack.Types.Docker.DockerOptsMonoid instance GHC.Show.Show Stack.Types.Docker.DockerOptsMonoid instance GHC.Show.Show Stack.Types.Docker.DockerMonoidRepoOrImage instance GHC.Show.Show Stack.Types.Docker.DockerOpts instance GHC.Show.Show Stack.Types.Docker.DockerStackExe instance GHC.Exception.Type.Exception Stack.Types.Docker.StackDockerException instance GHC.Show.Show Stack.Types.Docker.StackDockerException instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Docker.DockerOptsMonoid) instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Docker.VersionRangeJSON instance GHC.Base.Semigroup Stack.Types.Docker.DockerOptsMonoid instance GHC.Base.Monoid Stack.Types.Docker.DockerOptsMonoid instance GHC.Read.Read Stack.Types.Docker.Mount instance GHC.Show.Show Stack.Types.Docker.Mount instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Docker.Mount instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Docker.DockerStackExe -- | This module implements parsing of additional arguments embedded in a -- comment when stack is invoked as a script interpreter -- --

Specifying arguments in script interpreter mode

-- -- stack can execute a Haskell source file using -- runghc and if required it can also install and setup -- the compiler and any package dependencies automatically. -- -- For using a Haskell source file as an executable script on a Unix like -- OS, the first line of the file must specify stack as the -- interpreter using a shebang directive e.g. -- --
--   #!/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 [String] module Stack.Types.VersionIntervals data VersionIntervals toVersionRange :: VersionIntervals -> VersionRange fromVersionRange :: VersionRange -> VersionIntervals withinIntervals :: Version -> VersionIntervals -> Bool unionVersionIntervals :: VersionIntervals -> VersionIntervals -> VersionIntervals intersectVersionIntervals :: VersionIntervals -> VersionIntervals -> VersionIntervals instance Data.Data.Data Stack.Types.VersionIntervals.VersionIntervals instance GHC.Classes.Eq Stack.Types.VersionIntervals.VersionIntervals instance GHC.Show.Show Stack.Types.VersionIntervals.VersionIntervals instance GHC.Generics.Generic Stack.Types.VersionIntervals.VersionIntervals instance Data.Data.Data Stack.Types.VersionIntervals.VersionInterval instance GHC.Classes.Eq Stack.Types.VersionIntervals.VersionInterval instance GHC.Show.Show Stack.Types.VersionIntervals.VersionInterval instance GHC.Generics.Generic Stack.Types.VersionIntervals.VersionInterval instance Data.Data.Data Stack.Types.VersionIntervals.Bound instance GHC.Classes.Eq Stack.Types.VersionIntervals.Bound instance GHC.Show.Show Stack.Types.VersionIntervals.Bound instance GHC.Generics.Generic Stack.Types.VersionIntervals.Bound instance Data.Store.Impl.Store Stack.Types.VersionIntervals.VersionIntervals instance Control.DeepSeq.NFData Stack.Types.VersionIntervals.VersionIntervals instance Data.Store.Impl.Store Stack.Types.VersionIntervals.VersionInterval instance Control.DeepSeq.NFData Stack.Types.VersionIntervals.VersionInterval instance Data.Store.Impl.Store Stack.Types.VersionIntervals.Bound instance Control.DeepSeq.NFData Stack.Types.VersionIntervals.Bound -- | Shared types for various stackage packages. module Stack.Types.BuildPlan -- | A definition of a snapshot. This could be a Stackage snapshot or -- something custom. It does not include information on the global -- package database, this is added later. -- -- It may seem more logic to attach flags, options, etc, directly with -- the desired package. However, this isn't possible yet: our definition -- may contain tarballs or Git repos, and we don't actually know the -- package names contained there. Therefore, we capture all of this -- additional information by package name, and later in the snapshot load -- step we will resolve the contents of tarballs and repos, figure out -- package names, and assigned values appropriately. data SnapshotDef SnapshotDef :: !Either (CompilerVersion 'CVWanted) SnapshotDef -> !LoadedResolver -> !Text -> ![PackageLocationIndex Subdirs] -> !Set PackageName -> !Map PackageName (Map FlagName Bool) -> !Map PackageName Bool -> !Map PackageName [Text] -> !Map PackageName (Maybe Version) -> SnapshotDef -- | The snapshot to extend from. This is either a specific compiler, or a -- SnapshotDef which gives us more information (like packages). -- Ultimately, we'll end up with a CompilerVersion. [sdParent] :: SnapshotDef -> !Either (CompilerVersion 'CVWanted) SnapshotDef -- | The resolver that provides this definition. [sdResolver] :: SnapshotDef -> !LoadedResolver -- | A user-friendly way of referring to this resolver. [sdResolverName] :: SnapshotDef -> !Text -- | Where to grab all of the packages from. [sdLocations] :: SnapshotDef -> ![PackageLocationIndex Subdirs] -- | Packages present in the parent which should not be included here. [sdDropPackages] :: SnapshotDef -> !Set PackageName -- | Flag values to override from the defaults [sdFlags] :: SnapshotDef -> !Map PackageName (Map FlagName Bool) -- | Packages which should be hidden when registering. This will affect, -- for example, the import parser in the script command. We use a -- Map instead of just a Set to allow overriding the hidden -- settings in a parent snapshot. [sdHidden] :: SnapshotDef -> !Map PackageName Bool -- | GHC options per package [sdGhcOptions] :: SnapshotDef -> !Map PackageName [Text] -- | Hints about which packages are available globally. When actually -- building code, we trust the package database provided by GHC itself, -- since it may be different based on platform or GHC install. However, -- when we want to check the compatibility of a snapshot with some -- codebase without installing GHC (e.g., during stack init), we would -- use this field. [sdGlobalHints] :: SnapshotDef -> !Map PackageName (Maybe Version) snapshotDefVC :: VersionConfig SnapshotDef -- | A relative file path including a unique string for the given snapshot. sdRawPathName :: SnapshotDef -> String -- | Where to get the contents of a package (including cabal file -- revisions) from. -- -- A GADT may be more logical than the index parameter, but this plays -- more nicely with Generic deriving. data PackageLocation subdirs -- | Note that we use FilePath and not Paths. The goal -- is: first parse the value raw, and then use canonicalizePath -- and parseAbsDir. PLFilePath :: !FilePath -> PackageLocation subdirs PLArchive :: !Archive subdirs -> PackageLocation subdirs -- | Stored in a source control repository PLRepo :: !Repo subdirs -> PackageLocation subdirs -- | Add in the possibility of getting packages from the index (including -- cabal file revisions). We have special handling of this case in many -- places in the codebase, and therefore represent it with a separate -- data type from PackageLocation. data PackageLocationIndex subdirs -- | Grab the package from the package index with the given version and -- (optional) cabal file info to specify the correct revision. PLIndex :: !PackageIdentifierRevision -> PackageLocationIndex subdirs PLOther :: !PackageLocation subdirs -> PackageLocationIndex subdirs -- | The type of a source control repository. data RepoType RepoGit :: RepoType RepoHg :: RepoType data Subdirs DefaultSubdirs :: Subdirs ExplicitSubdirs :: ![FilePath] -> Subdirs -- | Information on packages stored in a source control repository. data Repo subdirs Repo :: !Text -> !Text -> !RepoType -> !subdirs -> Repo subdirs [repoUrl] :: Repo subdirs -> !Text [repoCommit] :: Repo subdirs -> !Text [repoType] :: Repo subdirs -> !RepoType [repoSubdirs] :: Repo subdirs -> !subdirs -- | A package archive, could be from a URL or a local file path. Local -- file path archives are assumed to be unchanging over time, and so are -- allowed in custom snapshots. data Archive subdirs Archive :: !Text -> !subdirs -> !Maybe StaticSHA256 -> Archive subdirs [archiveUrl] :: Archive subdirs -> !Text [archiveSubdirs] :: Archive subdirs -> !subdirs [archiveHash] :: Archive subdirs -> !Maybe StaticSHA256 -- | Name of an executable. newtype ExeName ExeName :: Text -> ExeName [unExeName] :: ExeName -> Text -- | A fully loaded snapshot combined , including information gleaned from -- the global database and parsing cabal files. -- -- Invariant: a global package may not depend upon a snapshot package, a -- snapshot may not depend upon a local or project, and all dependencies -- must be satisfied. data LoadedSnapshot LoadedSnapshot :: !CompilerVersion 'CVActual -> !Map PackageName (LoadedPackageInfo GhcPkgId) -> !Map PackageName (LoadedPackageInfo (PackageLocationIndex FilePath)) -> LoadedSnapshot [lsCompilerVersion] :: LoadedSnapshot -> !CompilerVersion 'CVActual [lsGlobals] :: LoadedSnapshot -> !Map PackageName (LoadedPackageInfo GhcPkgId) [lsPackages] :: LoadedSnapshot -> !Map PackageName (LoadedPackageInfo (PackageLocationIndex FilePath)) loadedSnapshotVC :: VersionConfig LoadedSnapshot -- | Information on a single package for the LoadedSnapshot which -- can be installed. -- -- Note that much of the information below (such as the package -- dependencies or exposed modules) can be conditional in the cabal file, -- which means it will vary based on flags, arch, and OS. data LoadedPackageInfo loc LoadedPackageInfo :: !Version -> !loc -> !Map FlagName Bool -> ![Text] -> !Map PackageName VersionIntervals -> !Set ModuleName -> !Bool -> LoadedPackageInfo loc -- | This must match the version specified within rpiDef. [lpiVersion] :: LoadedPackageInfo loc -> !Version -- | Where to get the package from. This could be a few different things: -- -- [lpiLocation] :: LoadedPackageInfo loc -> !loc -- | Flags to build this package with. [lpiFlags] :: LoadedPackageInfo loc -> !Map FlagName Bool -- | GHC options to use when building this package. [lpiGhcOptions] :: LoadedPackageInfo loc -> ![Text] -- | All packages which must be builtcopiedregistered before this -- package. [lpiPackageDeps] :: LoadedPackageInfo loc -> !Map PackageName VersionIntervals -- | Modules exposed by this package's library [lpiExposedModules] :: LoadedPackageInfo loc -> !Set ModuleName -- | Should this package be hidden in the database. Affects the script -- interpreter's module name import parser. [lpiHide] :: LoadedPackageInfo loc -> !Bool newtype ModuleName ModuleName :: ByteString -> ModuleName [unModuleName] :: ModuleName -> ByteString fromCabalModuleName :: ModuleName -> ModuleName newtype ModuleInfo ModuleInfo :: Map ModuleName (Set PackageName) -> ModuleInfo [miModules] :: ModuleInfo -> Map ModuleName (Set PackageName) moduleInfoVC :: VersionConfig ModuleInfo -- | Modify the wanted compiler version in this snapshot. This is used when -- overriding via the compiler value in a custom snapshot or -- stack.yaml file. We do _not_ need to modify the snapshot's hash for -- this: all binary caches of a snapshot are stored in a filepath that -- encodes the actual compiler version in addition to the hash. -- Therefore, modifications here will not lead to any invalid data. setCompilerVersion :: CompilerVersion 'CVWanted -> SnapshotDef -> SnapshotDef -- | Determined the desired compiler version for this SnapshotDef. sdWantedCompilerVersion :: SnapshotDef -> CompilerVersion 'CVWanted instance Data.Data.Data Stack.Types.BuildPlan.ModuleInfo instance GHC.Generics.Generic Stack.Types.BuildPlan.ModuleInfo instance GHC.Classes.Ord Stack.Types.BuildPlan.ModuleInfo instance GHC.Classes.Eq Stack.Types.BuildPlan.ModuleInfo instance GHC.Show.Show Stack.Types.BuildPlan.ModuleInfo instance GHC.Classes.Eq Stack.Types.BuildPlan.LoadedSnapshot instance Data.Data.Data Stack.Types.BuildPlan.LoadedSnapshot instance GHC.Show.Show Stack.Types.BuildPlan.LoadedSnapshot instance GHC.Generics.Generic Stack.Types.BuildPlan.LoadedSnapshot instance GHC.Base.Functor Stack.Types.BuildPlan.LoadedPackageInfo instance Data.Data.Data loc => Data.Data.Data (Stack.Types.BuildPlan.LoadedPackageInfo loc) instance GHC.Classes.Eq loc => GHC.Classes.Eq (Stack.Types.BuildPlan.LoadedPackageInfo loc) instance GHC.Show.Show loc => GHC.Show.Show (Stack.Types.BuildPlan.LoadedPackageInfo loc) instance GHC.Generics.Generic (Stack.Types.BuildPlan.LoadedPackageInfo loc) instance Data.Data.Data Stack.Types.BuildPlan.ModuleName instance Control.DeepSeq.NFData Stack.Types.BuildPlan.ModuleName instance Data.Store.Impl.Store Stack.Types.BuildPlan.ModuleName instance GHC.Generics.Generic Stack.Types.BuildPlan.ModuleName instance GHC.Classes.Ord Stack.Types.BuildPlan.ModuleName instance GHC.Classes.Eq Stack.Types.BuildPlan.ModuleName instance GHC.Show.Show Stack.Types.BuildPlan.ModuleName instance Data.Data.Data Stack.Types.BuildPlan.DepInfo instance GHC.Classes.Eq Stack.Types.BuildPlan.DepInfo instance GHC.Show.Show Stack.Types.BuildPlan.DepInfo instance GHC.Generics.Generic Stack.Types.BuildPlan.DepInfo instance GHC.Enum.Bounded Stack.Types.BuildPlan.Component instance GHC.Enum.Enum Stack.Types.BuildPlan.Component instance Data.Data.Data Stack.Types.BuildPlan.Component instance GHC.Classes.Ord Stack.Types.BuildPlan.Component instance GHC.Classes.Eq Stack.Types.BuildPlan.Component instance GHC.Show.Show Stack.Types.BuildPlan.Component instance GHC.Generics.Generic Stack.Types.BuildPlan.Component instance Data.Data.Data Stack.Types.BuildPlan.ExeName instance Control.DeepSeq.NFData Stack.Types.BuildPlan.ExeName instance Data.Store.Impl.Store Stack.Types.BuildPlan.ExeName instance GHC.Generics.Generic Stack.Types.BuildPlan.ExeName instance Data.String.IsString Stack.Types.BuildPlan.ExeName instance Data.Hashable.Class.Hashable Stack.Types.BuildPlan.ExeName instance GHC.Classes.Ord Stack.Types.BuildPlan.ExeName instance GHC.Classes.Eq Stack.Types.BuildPlan.ExeName instance GHC.Show.Show Stack.Types.BuildPlan.ExeName instance GHC.Generics.Generic Stack.Types.BuildPlan.SnapshotDef instance Data.Data.Data Stack.Types.BuildPlan.SnapshotDef instance GHC.Classes.Eq Stack.Types.BuildPlan.SnapshotDef instance GHC.Show.Show Stack.Types.BuildPlan.SnapshotDef instance GHC.Base.Functor Stack.Types.BuildPlan.PackageLocationIndex instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.PackageLocationIndex subdirs) instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.PackageLocationIndex subdirs) instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.PackageLocationIndex subdirs) instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.PackageLocationIndex subdirs) instance GHC.Generics.Generic (Stack.Types.BuildPlan.PackageLocationIndex subdirs) instance GHC.Base.Functor Stack.Types.BuildPlan.PackageLocation instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.PackageLocation subdirs) instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.PackageLocation subdirs) instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.PackageLocation subdirs) instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.PackageLocation subdirs) instance GHC.Generics.Generic (Stack.Types.BuildPlan.PackageLocation subdirs) instance GHC.Base.Functor Stack.Types.BuildPlan.Repo instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.Repo subdirs) instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.Repo subdirs) instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.Repo subdirs) instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.Repo subdirs) instance GHC.Generics.Generic (Stack.Types.BuildPlan.Repo subdirs) instance Data.Data.Data Stack.Types.BuildPlan.Subdirs instance GHC.Classes.Eq Stack.Types.BuildPlan.Subdirs instance GHC.Show.Show Stack.Types.BuildPlan.Subdirs instance GHC.Generics.Generic Stack.Types.BuildPlan.Subdirs instance Data.Data.Data Stack.Types.BuildPlan.RepoType instance GHC.Classes.Ord Stack.Types.BuildPlan.RepoType instance GHC.Classes.Eq Stack.Types.BuildPlan.RepoType instance GHC.Show.Show Stack.Types.BuildPlan.RepoType instance GHC.Generics.Generic Stack.Types.BuildPlan.RepoType instance GHC.Base.Functor Stack.Types.BuildPlan.Archive instance Data.Data.Data subdirs => Data.Data.Data (Stack.Types.BuildPlan.Archive subdirs) instance GHC.Classes.Ord subdirs => GHC.Classes.Ord (Stack.Types.BuildPlan.Archive subdirs) instance GHC.Classes.Eq subdirs => GHC.Classes.Eq (Stack.Types.BuildPlan.Archive subdirs) instance GHC.Show.Show subdirs => GHC.Show.Show (Stack.Types.BuildPlan.Archive subdirs) instance GHC.Generics.Generic (Stack.Types.BuildPlan.Archive subdirs) instance Data.Store.Impl.Store Stack.Types.BuildPlan.ModuleInfo instance Control.DeepSeq.NFData Stack.Types.BuildPlan.ModuleInfo instance GHC.Base.Semigroup Stack.Types.BuildPlan.ModuleInfo instance GHC.Base.Monoid Stack.Types.BuildPlan.ModuleInfo instance Data.Store.Impl.Store Stack.Types.BuildPlan.LoadedSnapshot instance Control.DeepSeq.NFData Stack.Types.BuildPlan.LoadedSnapshot instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.LoadedPackageInfo a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.LoadedPackageInfo a) instance Data.Store.Impl.Store Stack.Types.BuildPlan.DepInfo instance Control.DeepSeq.NFData Stack.Types.BuildPlan.DepInfo instance GHC.Base.Semigroup Stack.Types.BuildPlan.DepInfo instance GHC.Base.Monoid Stack.Types.BuildPlan.DepInfo instance Data.Store.Impl.Store Stack.Types.BuildPlan.Component instance Control.DeepSeq.NFData Stack.Types.BuildPlan.Component instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings (Stack.Types.BuildPlan.PackageLocation subdirs)) instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.BuildPlan.GitHubRepo instance Data.Store.Impl.Store Stack.Types.BuildPlan.SnapshotDef instance Control.DeepSeq.NFData Stack.Types.BuildPlan.SnapshotDef instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.PackageLocationIndex a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.PackageLocationIndex a) instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.BuildPlan.PackageLocationIndex subdirs) instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings (Stack.Types.BuildPlan.PackageLocationIndex subdirs)) instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.PackageLocation a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.PackageLocation a) instance (subdirs Data.Type.Equality.~ Stack.Types.BuildPlan.Subdirs) => Data.Aeson.Types.ToJSON.ToJSON (Stack.Types.BuildPlan.PackageLocation subdirs) instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.Repo a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.Repo a) instance Data.Store.Impl.Store Stack.Types.BuildPlan.Subdirs instance Control.DeepSeq.NFData Stack.Types.BuildPlan.Subdirs instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.BuildPlan.Subdirs instance Data.Store.Impl.Store Stack.Types.BuildPlan.RepoType instance Control.DeepSeq.NFData Stack.Types.BuildPlan.RepoType instance Data.Store.Impl.Store a => Data.Store.Impl.Store (Stack.Types.BuildPlan.Archive a) instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Stack.Types.BuildPlan.Archive a) -- | Run external pagers ($PAGER, less, more) -- and editors ($VISUAL, $EDITOR, nano, -- pico, vi). module System.Process.PagerEditor -- | Run pager, providing a function that writes to the pager's input. pageWriter :: (Handle -> IO ()) -> IO () -- | Run pager to display a lazy ByteString. pageByteString :: LByteString -> IO () -- | Run pager to display a Text pageText :: Text -> IO () -- | Run pager to display a ByteString-Builder. pageBuilder :: Builder -> IO () -- | Run pager to display contents of a file. pageFile :: FilePath -> IO () -- | Run pager to display a string. pageString :: String -> IO () -- | Exception running pager. data PagerException PagerNotFound :: PagerException PagerExitFailure :: FilePath -> Int -> PagerException -- | Run editor to edit a file. editFile :: FilePath -> IO () -- | Run editor, providing functions to write and read the file contents. editReaderWriter :: forall a. String -> (Handle -> IO ()) -> (FilePath -> IO a) -> IO a -- | Run editor on a ByteString. editByteString :: String -> LByteString -> IO LByteString -- | Run editor on a String. editString :: String -> String -> IO String -- | Exception running editor. data EditorException EditorNotFound :: EditorException EditorExitFailure :: FilePath -> Int -> EditorException instance GHC.Show.Show System.Process.PagerEditor.EditorException instance GHC.Exception.Type.Exception System.Process.PagerEditor.EditorException instance GHC.Show.Show System.Process.PagerEditor.PagerException instance GHC.Exception.Type.Exception System.Process.PagerEditor.PagerException module System.Terminal -- | Get the width, in columns, of the terminal if we can. getTerminalWidth :: IO (Maybe Int) instance GHC.Show.Show System.Terminal.WindowWidth instance GHC.Classes.Ord System.Terminal.WindowWidth instance GHC.Classes.Eq System.Terminal.WindowWidth instance Foreign.Storable.Storable System.Terminal.WindowWidth -- | Run environment module Stack.Types.Runner -- | Monadic environment. data Runner Runner :: !Bool -> !Bool -> !Bool -> !LogFunc -> !Int -> !ProcessContext -> !IORef (Map PackageIdentifierRevision GenericPackageDescription, Map (Path Abs Dir) (GenericPackageDescription, Path Abs File)) -> Runner [runnerReExec] :: Runner -> !Bool [runnerTerminal] :: Runner -> !Bool [runnerUseColor] :: Runner -> !Bool [runnerLogFunc] :: Runner -> !LogFunc [runnerTermWidth] :: Runner -> !Int [runnerProcessContext] :: Runner -> !ProcessContext -- | Cache of previously parsed cabal files. -- -- TODO: This is really an ugly hack to avoid spamming the user with -- warnings when we parse cabal files multiple times and bypass -- performance issues. Ideally: we would just design the system such that -- it only ever parses a cabal file once. But for now, this is a decent -- workaround. See: -- https://github.com/commercialhaskell/stack/issues/3591. [runnerParsedCabalFiles] :: Runner -> !IORef (Map PackageIdentifierRevision GenericPackageDescription, Map (Path Abs Dir) (GenericPackageDescription, Path Abs File)) class (HasProcessContext env, HasLogFunc env) => HasRunner env runnerL :: HasRunner env => Lens' env Runner terminalL :: HasRunner env => Lens' env Bool useColorL :: HasRunner env => Lens' env Bool reExecL :: HasRunner env => Lens' env Bool data ColorWhen ColorNever :: ColorWhen ColorAlways :: ColorWhen ColorAuto :: ColorWhen -- | With a Runner, do the thing withRunner :: MonadUnliftIO m => LogLevel -> Bool -> Bool -> ColorWhen -> Maybe Int -> Bool -> (Runner -> m a) -> m a instance GHC.Generics.Generic Stack.Types.Runner.ColorWhen instance GHC.Show.Show Stack.Types.Runner.ColorWhen instance GHC.Classes.Eq Stack.Types.Runner.ColorWhen instance Stack.Types.Runner.HasRunner Stack.Types.Runner.Runner instance RIO.Process.HasProcessContext Stack.Types.Runner.Runner instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Runner.Runner -- | This version of the module is only for non-Windows (eg unix-like) -- operating systems. module Stack.DefaultColorWhen defaultColorWhen :: IO ColorWhen -- | Nix configuration module Stack.Config.Nix -- | Interprets NixOptsMonoid options. nixOptsFromMonoid :: HasRunner env => NixOptsMonoid -> OS -> RIO env NixOpts nixCompiler :: CompilerVersion a -> Either StringException Text data StackNixException -- | Nix can't be given packages and a shell file at the same time NixCannotUseShellFileAndPackagesException :: StackNixException instance GHC.Exception.Type.Exception Stack.Config.Nix.StackNixException instance GHC.Show.Show Stack.Config.Nix.StackNixException -- | This module re-exports some of the interface for -- Text.PrettyPrint.Annotated.Leijen along with additional -- definitions useful for stack. -- -- It defines a Monoid instance for Doc. module Text.PrettyPrint.Leijen.Extended class Display a where { type family Ann a; type Ann a = AnsiAnn; } display :: Display a => a -> Doc (Ann a) display :: (Display a, Show a) => a -> Doc (Ann a) type AnsiDoc = Doc AnsiAnn newtype AnsiAnn AnsiAnn :: [SGR] -> AnsiAnn class HasAnsiAnn a getAnsiAnn :: HasAnsiAnn a => a -> AnsiAnn toAnsiDoc :: HasAnsiAnn a => Doc a -> AnsiDoc hDisplayAnsi :: (Display a, HasAnsiAnn (Ann a), MonadIO m) => Handle -> Int -> a -> m () displayAnsi :: (Display a, HasAnsiAnn (Ann a)) => Int -> a -> Text displayPlain :: Display a => Int -> a -> Text renderDefault :: Int -> Doc a -> SimpleDoc a black :: Doc AnsiAnn -> Doc AnsiAnn red :: Doc AnsiAnn -> Doc AnsiAnn green :: Doc AnsiAnn -> Doc AnsiAnn yellow :: Doc AnsiAnn -> Doc AnsiAnn blue :: Doc AnsiAnn -> Doc AnsiAnn magenta :: Doc AnsiAnn -> Doc AnsiAnn cyan :: Doc AnsiAnn -> Doc AnsiAnn white :: Doc AnsiAnn -> Doc AnsiAnn dullblack :: Doc AnsiAnn -> Doc AnsiAnn dullred :: Doc AnsiAnn -> Doc AnsiAnn dullgreen :: Doc AnsiAnn -> Doc AnsiAnn dullyellow :: Doc AnsiAnn -> Doc AnsiAnn dullblue :: Doc AnsiAnn -> Doc AnsiAnn dullmagenta :: Doc AnsiAnn -> Doc AnsiAnn dullcyan :: Doc AnsiAnn -> Doc AnsiAnn dullwhite :: Doc AnsiAnn -> Doc AnsiAnn onblack :: Doc AnsiAnn -> Doc AnsiAnn onred :: Doc AnsiAnn -> Doc AnsiAnn ongreen :: Doc AnsiAnn -> Doc AnsiAnn onyellow :: Doc AnsiAnn -> Doc AnsiAnn onblue :: Doc AnsiAnn -> Doc AnsiAnn onmagenta :: Doc AnsiAnn -> Doc AnsiAnn oncyan :: Doc AnsiAnn -> Doc AnsiAnn onwhite :: Doc AnsiAnn -> Doc AnsiAnn ondullblack :: Doc AnsiAnn -> Doc AnsiAnn ondullred :: Doc AnsiAnn -> Doc AnsiAnn ondullgreen :: Doc AnsiAnn -> Doc AnsiAnn ondullyellow :: Doc AnsiAnn -> Doc AnsiAnn ondullblue :: Doc AnsiAnn -> Doc AnsiAnn ondullmagenta :: Doc AnsiAnn -> Doc AnsiAnn ondullcyan :: Doc AnsiAnn -> Doc AnsiAnn ondullwhite :: Doc AnsiAnn -> Doc AnsiAnn bold :: Doc AnsiAnn -> Doc AnsiAnn faint :: Doc AnsiAnn -> Doc AnsiAnn normal :: Doc AnsiAnn -> Doc AnsiAnn -- | The abstract data type Doc a represents pretty documents. -- -- Doc a is an instance of the Show class. (show -- doc) pretty prints document doc with a page width of 100 -- characters and a ribbon width of 40 characters. -- --
--   show (text "hello" <$> text "world")
--   
-- -- Which would return the string "hello\nworld", i.e. -- --
--   hello
--   world
--   
data Doc a -- | The document (nest i x) renders document x with the -- current indentation level increased by i (See also hang, -- align and indent). -- --
--   nest 2 (text "hello" <$> text "world") <$> text "!"
--   
-- -- outputs as: -- --
--   hello
--     world
--   !
--   
nest :: () => Int -> Doc a -> Doc a -- | The line document advances to the next line and indents to -- the current nesting level. Doc aument line behaves like -- (text " ") if the line break is undone by group. line :: () => Doc a -- | The linebreak document advances to the next line and indents -- to the current nesting level. Document linebreak behaves like -- empty if the line break is undone by group. linebreak :: () => Doc a -- | The group combinator is used to specify alternative layouts. -- The document (group x) undoes all line breaks in document -- x. The resulting line is added to the current line if that -- fits the page. Otherwise, the document x is rendered without -- any changes. group :: () => Doc a -> Doc a -- | The document softline behaves like space if the -- resulting output fits the page, otherwise it behaves like line. -- --
--   softline = group line
--   
softline :: () => Doc a -- | The document softbreak behaves like empty if the -- resulting output fits the page, otherwise it behaves like line. -- --
--   softbreak  = group linebreak
--   
softbreak :: () => Doc a -- | 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 <$> y)
--   
-- --
--   test    = text "hi" <+> (text "nice" $$ text "world")
--   
-- -- which will be layed out as: -- --
--   hi nice
--      world
--   
align :: () => Doc a -> Doc a -- | 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 text
--           (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 -> Doc a -> Doc a -- | The document (indent i x) indents document x with -- i spaces. -- --
--   test  = indent 4 (fillSep (map text
--           (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 -> Doc a -> Doc a -- | 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    = text "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 :: () => Doc a -> Doc a -> Doc a -> [Doc a] -> Doc a -- | The document (x <+> y) concatenates document x -- and y with a space in between. (infixr 6) (<+>) :: () => Doc a -> Doc a -> Doc a infixr 6 <+> -- | The document (hsep xs) concatenates all documents xs -- horizontally with (<+>). hsep :: () => [Doc a] -> Doc a -- | The document (vsep xs) concatenates all documents xs -- vertically with (<$>). If a group undoes the -- line breaks inserted by vsep, all documents are separated -- with a space. -- --
--   someText = map text (words ("text to lay out"))
--   
--   test     = text "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     = text "some" <+> align (vsep someText)
--   
-- -- Which is printed as: -- --
--   some text
--        to
--        lay
--        out
--   
vsep :: () => [Doc a] -> Doc a -- | 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 (</>) empty xs
--   
fillSep :: () => [Doc a] -> Doc a -- | The document (sep xs) concatenates all documents xs -- either horizontally with (<+>), if it fits the page, or -- vertically with (<$>). -- --
--   sep xs  = group (vsep xs)
--   
sep :: () => [Doc a] -> Doc a -- | The document (hcat xs) concatenates all documents xs -- horizontally with (<>). hcat :: () => [Doc a] -> Doc a -- | The document (vcat xs) concatenates all documents xs -- vertically with (<$$>). If a group undoes the -- line breaks inserted by vcat, all documents are directly -- concatenated. vcat :: () => [Doc a] -> Doc a -- | The document (fillCat xs) concatenates documents xs -- horizontally with (<>) as long as its fits the page, -- than inserts a linebreak and continues doing that for all -- documents in xs. -- --
--   fillCat xs  = foldr (\<\/\/\>) empty xs
--   
fillCat :: () => [Doc a] -> Doc a -- | The document (cat xs) concatenates all documents xs -- either horizontally with (<>), if it fits the page, or -- vertically with (<$$>). -- --
--   cat xs  = group (vcat xs)
--   
cat :: () => [Doc a] -> Doc a -- | (punctuate p xs) concatenates all documents in xs -- with document p except for the last document. -- --
--   someText = map text ["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 tupled or, in general, -- encloseSep.) punctuate :: () => Doc a -> [Doc a] -> [Doc a] -- | The document (fill i x) renders document x. It than -- appends spaces 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 (text name) <+> text "::" <+> text tp
--   
--   test   = text "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 -> Doc a -> Doc a -- | The document (fillBreak i x) first renders document -- x. It than appends spaces until the width is equal -- to i. If the width of x is already larger than -- i, the nesting level is increased by i and a -- line is appended. When we redefine ptype in the -- previous example to use fillBreak, we get a useful variation -- of the previous output: -- --
--   ptype (name,tp)
--          = fillBreak 6 (text name) <+> text "::" <+> text tp
--   
-- -- The output will now be: -- --
--   let empty  :: Doc a
--       nest   :: Int -> Doc a -> Doc a
--       linebreak
--              :: Doc a
--   
fillBreak :: () => Int -> Doc a -> Doc a -- | The document (enclose l r x) encloses document x -- between documents l and r using (<>). -- --
--   enclose l r x   = l <> x <> r
--   
enclose :: () => Doc a -> Doc a -> Doc a -> Doc a -- | Document (squotes x) encloses document x with single -- quotes "'". squotes :: () => Doc a -> Doc a -- | Document (dquotes x) encloses document x with double -- quotes '"'. dquotes :: () => Doc a -> Doc a -- | Document (parens x) encloses document x in -- parenthesis, "(" and ")". parens :: () => Doc a -> Doc a -- | Document (angles x) encloses document x in angles, -- "<" and ">". angles :: () => Doc a -> Doc a -- | Document (braces x) encloses document x in braces, -- "{" and "}". braces :: () => Doc a -> Doc a -- | Document (brackets x) encloses document x in square -- brackets, "[" and "]". brackets :: () => Doc a -> Doc a annotate :: () => a -> Doc a -> Doc a -- | Strip annotations from a document. This is useful for re-using the -- textual formatting of some sub-document, but applying a different -- high-level annotation. noAnnotate :: () => Doc a -> Doc a instance GHC.Classes.Ord Text.PrettyPrint.Leijen.Extended.SGRTag instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.SGRTag instance GHC.Base.Monoid Text.PrettyPrint.Leijen.Extended.AnsiAnn instance GHC.Base.Semigroup Text.PrettyPrint.Leijen.Extended.AnsiAnn instance GHC.Show.Show Text.PrettyPrint.Leijen.Extended.AnsiAnn instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.AnsiAnn instance Text.PrettyPrint.Leijen.Extended.HasAnsiAnn Text.PrettyPrint.Leijen.Extended.AnsiAnn instance Text.PrettyPrint.Leijen.Extended.HasAnsiAnn () instance Text.PrettyPrint.Leijen.Extended.Display (Text.PrettyPrint.Annotated.Leijen.Doc a) instance GHC.Base.Semigroup (Text.PrettyPrint.Annotated.Leijen.Doc a) instance GHC.Base.Monoid (Text.PrettyPrint.Annotated.Leijen.Doc a) module Stack.PrettyPrint displayPlain :: Display a => Int -> a -> Text displayWithColor :: (HasRunner env, Display a, HasAnsiAnn (Ann a), MonadReader env m, HasLogFunc env, HasCallStack) => a -> m Text prettyDebug :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyInfo :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyNote :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyWarn :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyError :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyWarnNoIndent :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyErrorNoIndent :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => Doc AnsiAnn -> m () prettyDebugL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyInfoL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyNoteL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyWarnL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyErrorL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyWarnNoIndentL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyErrorNoIndentL :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => [Doc AnsiAnn] -> m () prettyDebugS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () prettyInfoS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () prettyNoteS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () prettyWarnS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () prettyErrorS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () prettyWarnNoIndentS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () prettyErrorNoIndentS :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m) => String -> m () -- | Style an AnsiDoc as a warning. Should be used sparingly, not to -- style entire long messages. For example, it's used to style the -- "Warning:" label for an error message, not the entire message. styleWarning :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc as an error. Should be used sparingly, not to -- style entire long messages. For example, it's used to style the -- "Error:" label for an error message, not the entire message. styleError :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc in a way to emphasize that it is a -- particularly good thing. styleGood :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc as a shell command, i.e. when suggesting -- something to the user that should be typed in directly as written. styleShell :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc as a filename. See styleDir for -- directories. styleFile :: AnsiDoc -> AnsiDoc -- | Style an AsciDoc as a URL. For now using the same style as -- files. styleUrl :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc as a directory name. See styleFile for -- files. styleDir :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc as a module name styleModule :: AnsiDoc -> AnsiDoc -- | Style an AnsiDoc in a way that emphasizes that it is related to -- a current thing. For example, could be used when talking about the -- current package we're processing when outputting the name of it. styleCurrent :: AnsiDoc -> AnsiDoc styleTarget :: AnsiDoc -> AnsiDoc -- | Style used to highlight part of a recommended course of action. styleRecommendation :: AnsiDoc -> AnsiDoc displayMilliseconds :: Double -> AnsiDoc -- | Display a bulleted list of AnsiDoc. bulletedList :: [AnsiDoc] -> AnsiDoc -- | Display a bulleted list of AnsiDoc with a blank line between -- each. spacedBulletedList :: [AnsiDoc] -> AnsiDoc debugBracket :: (HasCallStack, HasRunner env, MonadReader env m, MonadIO m, MonadUnliftIO m) => Doc AnsiAnn -> m a -> m a class Display a where { type family Ann a; type Ann a = AnsiAnn; } display :: Display a => a -> Doc (Ann a) display :: (Display a, Show a) => a -> Doc (Ann a) type AnsiDoc = Doc AnsiAnn newtype AnsiAnn AnsiAnn :: [SGR] -> AnsiAnn class HasAnsiAnn a getAnsiAnn :: HasAnsiAnn a => a -> AnsiAnn toAnsiDoc :: HasAnsiAnn a => Doc a -> AnsiDoc -- | The abstract data type Doc a represents pretty documents. -- -- Doc a is an instance of the Show class. (show -- doc) pretty prints document doc with a page width of 100 -- characters and a ribbon width of 40 characters. -- --
--   show (text "hello" <$> text "world")
--   
-- -- Which would return the string "hello\nworld", i.e. -- --
--   hello
--   world
--   
data Doc a -- | The document (nest i x) renders document x with the -- current indentation level increased by i (See also hang, -- align and indent). -- --
--   nest 2 (text "hello" <$> text "world") <$> text "!"
--   
-- -- outputs as: -- --
--   hello
--     world
--   !
--   
nest :: () => Int -> Doc a -> Doc a -- | The line document advances to the next line and indents to -- the current nesting level. Doc aument line behaves like -- (text " ") if the line break is undone by group. line :: () => Doc a -- | The linebreak document advances to the next line and indents -- to the current nesting level. Document linebreak behaves like -- empty if the line break is undone by group. linebreak :: () => Doc a -- | The group combinator is used to specify alternative layouts. -- The document (group x) undoes all line breaks in document -- x. The resulting line is added to the current line if that -- fits the page. Otherwise, the document x is rendered without -- any changes. group :: () => Doc a -> Doc a -- | The document softline behaves like space if the -- resulting output fits the page, otherwise it behaves like line. -- --
--   softline = group line
--   
softline :: () => Doc a -- | The document softbreak behaves like empty if the -- resulting output fits the page, otherwise it behaves like line. -- --
--   softbreak  = group linebreak
--   
softbreak :: () => Doc a -- | 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 <$> y)
--   
-- --
--   test    = text "hi" <+> (text "nice" $$ text "world")
--   
-- -- which will be layed out as: -- --
--   hi nice
--      world
--   
align :: () => Doc a -> Doc a -- | 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 text
--           (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 -> Doc a -> Doc a -- | The document (indent i x) indents document x with -- i spaces. -- --
--   test  = indent 4 (fillSep (map text
--           (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 -> Doc a -> Doc a -- | 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    = text "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 :: () => Doc a -> Doc a -> Doc a -> [Doc a] -> Doc a -- | The document (x <+> y) concatenates document x -- and y with a space in between. (infixr 6) (<+>) :: () => Doc a -> Doc a -> Doc a infixr 6 <+> -- | The document (hsep xs) concatenates all documents xs -- horizontally with (<+>). hsep :: () => [Doc a] -> Doc a -- | The document (vsep xs) concatenates all documents xs -- vertically with (<$>). If a group undoes the -- line breaks inserted by vsep, all documents are separated -- with a space. -- --
--   someText = map text (words ("text to lay out"))
--   
--   test     = text "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     = text "some" <+> align (vsep someText)
--   
-- -- Which is printed as: -- --
--   some text
--        to
--        lay
--        out
--   
vsep :: () => [Doc a] -> Doc a -- | 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 (</>) empty xs
--   
fillSep :: () => [Doc a] -> Doc a -- | The document (sep xs) concatenates all documents xs -- either horizontally with (<+>), if it fits the page, or -- vertically with (<$>). -- --
--   sep xs  = group (vsep xs)
--   
sep :: () => [Doc a] -> Doc a -- | The document (hcat xs) concatenates all documents xs -- horizontally with (<>). hcat :: () => [Doc a] -> Doc a -- | The document (vcat xs) concatenates all documents xs -- vertically with (<$$>). If a group undoes the -- line breaks inserted by vcat, all documents are directly -- concatenated. vcat :: () => [Doc a] -> Doc a -- | The document (fillCat xs) concatenates documents xs -- horizontally with (<>) as long as its fits the page, -- than inserts a linebreak and continues doing that for all -- documents in xs. -- --
--   fillCat xs  = foldr (\<\/\/\>) empty xs
--   
fillCat :: () => [Doc a] -> Doc a -- | The document (cat xs) concatenates all documents xs -- either horizontally with (<>), if it fits the page, or -- vertically with (<$$>). -- --
--   cat xs  = group (vcat xs)
--   
cat :: () => [Doc a] -> Doc a -- | (punctuate p xs) concatenates all documents in xs -- with document p except for the last document. -- --
--   someText = map text ["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 tupled or, in general, -- encloseSep.) punctuate :: () => Doc a -> [Doc a] -> [Doc a] -- | The document (fill i x) renders document x. It than -- appends spaces 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 (text name) <+> text "::" <+> text tp
--   
--   test   = text "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 -> Doc a -> Doc a -- | The document (fillBreak i x) first renders document -- x. It than appends spaces until the width is equal -- to i. If the width of x is already larger than -- i, the nesting level is increased by i and a -- line is appended. When we redefine ptype in the -- previous example to use fillBreak, we get a useful variation -- of the previous output: -- --
--   ptype (name,tp)
--          = fillBreak 6 (text name) <+> text "::" <+> text tp
--   
-- -- The output will now be: -- --
--   let empty  :: Doc a
--       nest   :: Int -> Doc a -> Doc a
--       linebreak
--              :: Doc a
--   
fillBreak :: () => Int -> Doc a -> Doc a -- | The document (enclose l r x) encloses document x -- between documents l and r using (<>). -- --
--   enclose l r x   = l <> x <> r
--   
enclose :: () => Doc a -> Doc a -> Doc a -> Doc a -- | Document (squotes x) encloses document x with single -- quotes "'". squotes :: () => Doc a -> Doc a -- | Document (dquotes x) encloses document x with double -- quotes '"'. dquotes :: () => Doc a -> Doc a -- | Document (parens x) encloses document x in -- parenthesis, "(" and ")". parens :: () => Doc a -> Doc a -- | Document (angles x) encloses document x in angles, -- "<" and ">". angles :: () => Doc a -> Doc a -- | Document (braces x) encloses document x in braces, -- "{" and "}". braces :: () => Doc a -> Doc a -- | Document (brackets x) encloses document x in square -- brackets, "[" and "]". brackets :: () => Doc a -> Doc a -- | Use after a label and before the rest of what's being labelled for -- consistent spacingindentingetc. -- -- For example this is used after "Warning:" in warning messages. indentAfterLabel :: Doc a -> Doc a -- | Make a Doc from each word in a String wordDocs :: String -> [Doc a] -- | Wordwrap a String flow :: String -> Doc a instance Text.PrettyPrint.Leijen.Extended.Display Stack.Types.PackageName.PackageName instance Text.PrettyPrint.Leijen.Extended.Display Stack.Types.PackageIdentifier.PackageIdentifier instance Text.PrettyPrint.Leijen.Extended.Display Stack.Types.Version.Version instance Text.PrettyPrint.Leijen.Extended.Display (Path.Internal.Path b Path.File) instance Text.PrettyPrint.Leijen.Extended.Display (Path.Internal.Path b Path.Dir) instance Text.PrettyPrint.Leijen.Extended.Display (Stack.Types.PackageName.PackageName, Stack.Types.NamedComponent.NamedComponent) instance Text.PrettyPrint.Leijen.Extended.Display Distribution.ModuleName.ModuleName module Network.HTTP.Download.Verified -- | Copied and extended version of Network.HTTP.Download.download. -- -- Has the following additional features: * Verifies that response -- content-length header (if present) matches expected length * Limits -- the download to (close to) the expected # of bytes * Verifies that the -- expected # bytes were downloaded (not too few) * Verifies md5 if -- response includes content-md5 header * Verifies the expected hashes -- -- Throws VerifiedDownloadException. Throws IOExceptions related to file -- system operations. Throws HttpException. verifiedDownload :: HasRunner env => DownloadRequest -> Path Abs File -> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) -> RIO env Bool recoveringHttp :: forall env a. HasRunner env => RetryPolicy -> RIO env a -> RIO env a -- | A request together with some checks to perform. data DownloadRequest DownloadRequest :: Request -> [HashCheck] -> Maybe LengthCheck -> RetryPolicy -> DownloadRequest [drRequest] :: DownloadRequest -> Request [drHashChecks] :: DownloadRequest -> [HashCheck] [drLengthCheck] :: DownloadRequest -> Maybe LengthCheck [drRetryPolicy] :: DownloadRequest -> RetryPolicy -- | Default to retrying seven times with exponential backoff starting from -- one hundred milliseconds. -- -- This means the tries will occur after these delays if necessary: -- -- drRetryPolicyDefault :: RetryPolicy data HashCheck HashCheck :: a -> CheckHexDigest -> HashCheck [hashCheckAlgorithm] :: HashCheck -> a [hashCheckHexDigest] :: HashCheck -> CheckHexDigest data CheckHexDigest CheckHexDigestString :: String -> CheckHexDigest CheckHexDigestByteString :: ByteString -> CheckHexDigest CheckHexDigestHeader :: ByteString -> CheckHexDigest type LengthCheck = Int -- | An exception regarding verification of a download. data VerifiedDownloadException WrongContentLength :: Request -> Int -> ByteString -> VerifiedDownloadException WrongStreamLength :: Request -> Int -> Int -> VerifiedDownloadException WrongDigest :: Request -> String -> CheckHexDigest -> String -> VerifiedDownloadException instance GHC.Show.Show Network.HTTP.Download.Verified.VerifyFileException instance GHC.Show.Show Network.HTTP.Download.Verified.CheckHexDigest instance GHC.Show.Show Network.HTTP.Download.Verified.HashCheck instance GHC.Exception.Type.Exception Network.HTTP.Download.Verified.VerifyFileException instance GHC.Show.Show Network.HTTP.Download.Verified.VerifiedDownloadException instance GHC.Exception.Type.Exception Network.HTTP.Download.Verified.VerifiedDownloadException instance Data.String.IsString Network.HTTP.Download.Verified.CheckHexDigest module Network.HTTP.Download -- | Copied and extended version of Network.HTTP.Download.download. -- -- Has the following additional features: * Verifies that response -- content-length header (if present) matches expected length * Limits -- the download to (close to) the expected # of bytes * Verifies that the -- expected # bytes were downloaded (not too few) * Verifies md5 if -- response includes content-md5 header * Verifies the expected hashes -- -- Throws VerifiedDownloadException. Throws IOExceptions related to file -- system operations. Throws HttpException. verifiedDownload :: HasRunner env => DownloadRequest -> Path Abs File -> (Maybe Integer -> ConduitM ByteString Void (RIO env) ()) -> RIO env Bool -- | A request together with some checks to perform. data DownloadRequest DownloadRequest :: Request -> [HashCheck] -> Maybe LengthCheck -> RetryPolicy -> DownloadRequest [drRequest] :: DownloadRequest -> Request [drHashChecks] :: DownloadRequest -> [HashCheck] [drLengthCheck] :: DownloadRequest -> Maybe LengthCheck [drRetryPolicy] :: DownloadRequest -> RetryPolicy -- | Default to retrying seven times with exponential backoff starting from -- one hundred milliseconds. -- -- This means the tries will occur after these delays if necessary: -- -- drRetryPolicyDefault :: RetryPolicy data HashCheck HashCheck :: a -> CheckHexDigest -> HashCheck [hashCheckAlgorithm] :: HashCheck -> a [hashCheckHexDigest] :: HashCheck -> CheckHexDigest data DownloadException RedownloadInvalidResponse :: Request -> Path Abs File -> Response () -> DownloadException RedownloadHttpError :: HttpException -> DownloadException data CheckHexDigest CheckHexDigestString :: String -> CheckHexDigest CheckHexDigestByteString :: ByteString -> CheckHexDigest CheckHexDigestHeader :: ByteString -> CheckHexDigest type LengthCheck = Int -- | An exception regarding verification of a download. data VerifiedDownloadException WrongContentLength :: Request -> Int -> ByteString -> VerifiedDownloadException WrongStreamLength :: Request -> Int -> Int -> VerifiedDownloadException WrongDigest :: Request -> String -> CheckHexDigest -> String -> VerifiedDownloadException -- | Download the given URL to the given location. If the file already -- exists, no download is performed. Otherwise, creates the parent -- directory, downloads to a temporary file, and on file download -- completion moves to the appropriate destination. -- -- Throws an exception if things go wrong download :: HasRunner env => Request -> Path Abs File -> RIO env Bool -- | Same as download, but will download a file a second time if it -- is already present. -- -- Returns True if the file was downloaded, False otherwise redownload :: HasRunner env => Request -> Path Abs File -> RIO env Bool httpJSON :: (MonadIO m, FromJSON a) => Request -> m (Response a) httpLbs :: MonadIO m => Request -> m (Response ByteString) httpLBS :: MonadIO m => Request -> m (Response ByteString) -- | Convert a URL into a 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 -- | 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 -- | Set the user-agent request header setGithubHeaders :: Request -> Request withResponse :: (MonadUnliftIO m, MonadIO n) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a instance GHC.Show.Show Network.HTTP.Download.DownloadException instance GHC.Exception.Type.Exception Network.HTTP.Download.DownloadException -- | Dealing with the 01-index file and all its cabal files. module Stack.PackageIndex -- | Update all of the package indices updateAllIndices :: HasCabalLoader env => RIO env () -- | Load the package caches, or create the caches if necessary. -- -- This has two levels of caching: in memory, and the on-disk cache. So, -- feel free to call this function multiple times. getPackageCaches :: HasCabalLoader env => RIO env (PackageCache PackageIndex) -- | Get the known versions for a given package from the package caches. -- -- See getPackageCaches for performance notes. getPackageVersions :: HasCabalLoader env => PackageName -> RIO env (HashMap Version (Maybe CabalHash)) lookupPackageVersions :: PackageName -> PackageCache index -> HashMap Version (Maybe CabalHash) data CabalLoader CabalLoader :: !IORef (Maybe (PackageCache PackageIndex)) -> ![PackageIndex] -> !Path Abs Dir -> !MVar Bool -> !Int -> !Bool -> CabalLoader [clCache] :: CabalLoader -> !IORef (Maybe (PackageCache PackageIndex)) -- | Information on package indices. This is left biased, meaning that -- packages in an earlier index will shadow those in a later index. -- -- Warning: if you override packages in an index vs what's available -- upstream, you may correct your compiled snapshots, as different -- projects may have different definitions of what pkg-ver means! This -- feature is primarily intended for adding local packages, not -- overriding. Overriding is better accomplished by adding to your list -- of packages. -- -- Note that indices specified in a later config file will override -- previous indices, not extend them. -- -- Using an assoc list instead of a Map to keep track of priority [clIndices] :: CabalLoader -> ![PackageIndex] -- | ~/.stack more often than not [clStackRoot] :: CabalLoader -> !Path Abs Dir -- | Want to try updating the index once during a single run for missing -- package identifiers. We also want to ensure we only update once at a -- time. Start at True. -- -- TODO: probably makes sense to move this concern into getPackageCaches [clUpdateRef] :: CabalLoader -> !MVar Bool -- | How many concurrent connections are allowed when downloading [clConnectionCount] :: CabalLoader -> !Int -- | Ignore a revision mismatch when loading up cabal files, and fall back -- to the latest revision. See: -- https://github.com/commercialhaskell/stack/issues/3520 [clIgnoreRevisionMismatch] :: CabalLoader -> !Bool class HasRunner env => HasCabalLoader env cabalLoaderL :: HasCabalLoader env => Lens' env CabalLoader -- | Location of the 01-index.tar file configPackageIndex :: HasCabalLoader env => IndexName -> RIO env (Path Abs File) -- | Root for a specific package index configPackageIndexRoot :: HasCabalLoader env => IndexName -> RIO env (Path Abs Dir) instance GHC.Exception.Type.Exception Stack.PackageIndex.PackageIndexException instance GHC.Show.Show Stack.PackageIndex.PackageIndexException -- | The Config type. module Stack.Types.Config -- | Class for environment values which have a Platform class HasPlatform env platformL :: HasPlatform env => Lens' env Platform platformL :: (HasPlatform env, HasConfig env) => Lens' env Platform platformVariantL :: HasPlatform env => Lens' env PlatformVariant platformVariantL :: (HasPlatform env, HasConfig env) => Lens' env PlatformVariant -- | A variant of the platform, used to differentiate Docker builds from -- host data PlatformVariant PlatformVariantNone :: PlatformVariant PlatformVariant :: String -> PlatformVariant -- | The top-level Stackage configuration. data Config Config :: !Path Rel Dir -> !Path Abs File -> !BuildOpts -> !DockerOpts -> !NixOpts -> !EnvSettings -> IO ProcessContext -> !Path Abs Dir -> !Path Abs Dir -> !Bool -> !Platform -> !PlatformVariant -> !Maybe GHCVariant -> !Maybe CompilerBuild -> !Urls -> !Bool -> !Bool -> !Bool -> !Bool -> !VersionCheck -> !Path Abs Dir -> !VersionRange -> !Int -> !Maybe (Path Abs File) -> !HpackExecutable -> !Set FilePath -> !Set FilePath -> !Bool -> !ImageOpts -> !Map Text Text -> !Maybe SCM -> !Map PackageName [Text] -> !Map ApplyGhcOptions [Text] -> ![SetupInfoLocation] -> !PvpBounds -> !Bool -> !Map (Maybe PackageName) Bool -> !Bool -> !ApplyGhcOptions -> !Bool -> !Maybe TemplateName -> !Bool -> !DumpLogs -> !Maybe (Project, Path Abs File) -> !Bool -> !Bool -> !Text -> !Runner -> !CabalLoader -> Config -- | this allows to override .stack-work directory [configWorkDir] :: Config -> !Path Rel Dir -- | Path to user configuration file (usually ~.stackconfig.yaml) [configUserConfigPath] :: Config -> !Path Abs File -- | Build configuration [configBuild] :: Config -> !BuildOpts -- | Docker configuration [configDocker] :: Config -> !DockerOpts -- | Execution environment (e.g nix-shell) configuration [configNix] :: Config -> !NixOpts -- | Environment variables to be passed to external tools [configProcessContextSettings] :: Config -> !EnvSettings -> IO ProcessContext -- | Non-platform-specific path containing local installations [configLocalProgramsBase] :: Config -> !Path Abs Dir -- | Path containing local installations (mainly GHC) [configLocalPrograms] :: Config -> !Path Abs Dir -- | Hide the Template Haskell "Loading package ..." messages from the -- console [configHideTHLoading] :: Config -> !Bool -- | The platform we're building for, used in many directory names [configPlatform] :: Config -> !Platform -- | Variant of the platform, also used in directory names [configPlatformVariant] :: Config -> !PlatformVariant -- | The variant of GHC requested by the user. In most cases, use -- BuildConfig or MiniConfigs version instead, which will -- have an auto-detected default. [configGHCVariant0] :: Config -> !Maybe GHCVariant -- | Override build of the compiler distribution (e.g. standard, gmp4, -- tinfo6) [configGHCBuild] :: Config -> !Maybe CompilerBuild -- | URLs for other files used by stack. TODO: Better document e.g. The -- latest snapshot file. A build plan name (e.g. lts5.9.yaml) is appended -- when downloading the build plan actually. [configUrls] :: Config -> !Urls -- | Should we use the system-installed GHC (on the PATH) if available? Can -- be overridden by command line options. [configSystemGHC] :: Config -> !Bool -- | Should we automatically install GHC if missing or the wrong version is -- available? Can be overridden by command line options. [configInstallGHC] :: Config -> !Bool -- | Don't bother checking the GHC version or architecture. [configSkipGHCCheck] :: Config -> !Bool -- | On Windows: don't use a sandboxed MSYS [configSkipMsys] :: Config -> !Bool -- | Specifies which versions of the compiler are acceptable. [configCompilerCheck] :: Config -> !VersionCheck -- | Directory we should install executables into [configLocalBin] :: Config -> !Path Abs Dir -- | Require a version of stack within this range. [configRequireStackVersion] :: Config -> !VersionRange -- | How many concurrent jobs to run, defaults to number of capabilities [configJobs] :: Config -> !Int -- | Optional gcc override path [configOverrideGccPath] :: Config -> !Maybe (Path Abs File) -- | Use Hpack executable (overrides bundled Hpack) [configOverrideHpack] :: Config -> !HpackExecutable -- | [configExtraIncludeDirs] :: Config -> !Set FilePath -- | [configExtraLibDirs] :: Config -> !Set FilePath -- | Run test suites concurrently [configConcurrentTests] :: Config -> !Bool [configImage] :: Config -> !ImageOpts -- | Parameters for templates. [configTemplateParams] :: Config -> !Map Text Text -- | Initialize SCM (e.g. git) when creating new projects. [configScmInit] :: Config -> !Maybe SCM -- | Additional GHC options to apply to specific packages. [configGhcOptionsByName] :: Config -> !Map PackageName [Text] -- | Additional GHC options to apply to categories of packages [configGhcOptionsByCat] :: Config -> !Map ApplyGhcOptions [Text] -- | Additional SetupInfo (inline or remote) to use to find tools. [configSetupInfoLocations] :: Config -> ![SetupInfoLocation] -- | How PVP upper bounds should be added to packages [configPvpBounds] :: Config -> !PvpBounds -- | Force the code page to UTF-8 on Windows [configModifyCodePage] :: Config -> !Bool -- | See explicitSetupDeps. Nothing provides the default -- value. [configExplicitSetupDeps] :: Config -> !Map (Maybe PackageName) Bool -- | Rebuild on GHC options changes [configRebuildGhcOptions] :: Config -> !Bool -- | Which packages to ghc-options on the command line apply to? [configApplyGhcOptions] :: Config -> !ApplyGhcOptions -- | Ignore version ranges in .cabal files. Funny naming chosen to match -- cabal. [configAllowNewer] :: Config -> !Bool -- | The default template to use when none is specified. (If Nothing, the -- default default is used.) [configDefaultTemplate] :: Config -> !Maybe TemplateName -- | Allow users other than the stack root owner to use the stack -- installation. [configAllowDifferentUser] :: Config -> !Bool -- | Dump logs of local non-dependencies when doing a build. [configDumpLogs] :: Config -> !DumpLogs -- | Just when a local project can be found, Nothing when -- stack must fall back on the implicit global project. [configMaybeProject] :: Config -> !Maybe (Project, Path Abs File) -- | Are we allowed to build local packages? The script command disallows -- this. [configAllowLocals] :: Config -> !Bool -- | Should we save Hackage credentials to a file? [configSaveHackageCreds] :: Config -> !Bool -- | Hackage base URL used when uploading packages [configHackageBaseUrl] :: Config -> !Text [configRunner] :: Config -> !Runner [configCabalLoader] :: Config -> !CabalLoader -- | Class for environment values that can provide a Config. class (HasPlatform env, HasProcessContext env, HasCabalLoader env) => HasConfig env configL :: HasConfig env => Lens' env Config configL :: (HasConfig env, HasBuildConfig env) => Lens' env Config -- | Get the URL to request the information on the latest snapshots askLatestSnapshotUrl :: (MonadReader env m, HasConfig env) => m Text -- | Provide an explicit list of package dependencies when running a custom -- Setup.hs explicitSetupDeps :: (MonadReader env m, HasConfig env) => PackageName -> m Bool -- | A superset of 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 -> !SnapshotDef -> !GHCVariant -> ![PackageLocation Subdirs] -> ![PackageLocationIndex Subdirs] -> ![Path Abs Dir] -> !Path Abs File -> !Map PackageName (Map FlagName Bool) -> !Bool -> BuildConfig [bcConfig] :: BuildConfig -> !Config -- | Build plan wanted for this build [bcSnapshotDef] :: BuildConfig -> !SnapshotDef -- | The variant of GHC used to select a GHC bindist. [bcGHCVariant] :: BuildConfig -> !GHCVariant -- | Local packages [bcPackages] :: BuildConfig -> ![PackageLocation Subdirs] -- | Extra dependencies specified in configuration. -- -- These dependencies will not be installed to a shared location, and -- will override packages provided by the resolver. [bcDependencies] :: BuildConfig -> ![PackageLocationIndex Subdirs] -- | Extra package databases [bcExtraPackageDBs] :: BuildConfig -> ![Path Abs Dir] -- | Location of the stack.yaml file. -- -- Note: if the STACK_YAML environment variable is used, this may be -- different from projectRootL / "stack.yaml" -- -- FIXME MSS 2016-12-08: is the above comment still true? projectRootL is -- defined in terms of bcStackYaml [bcStackYaml] :: BuildConfig -> !Path Abs File -- | Per-package flag overrides [bcFlags] :: BuildConfig -> !Map PackageName (Map FlagName Bool) -- | Are we loading from the implicit global stack.yaml? This is useful for -- providing better error messages. [bcImplicitGlobal] :: BuildConfig -> !Bool data LocalPackages LocalPackages :: !Map PackageName LocalPackageView -> !Map PackageName (GenericPackageDescription, PackageLocationIndex FilePath) -> LocalPackages [lpProject] :: LocalPackages -> !Map PackageName LocalPackageView [lpDependencies] :: LocalPackages -> !Map PackageName (GenericPackageDescription, PackageLocationIndex FilePath) -- | A view of a local package needed for resolving components data LocalPackageView LocalPackageView :: !Path Abs File -> !GenericPackageDescription -> !PackageLocation FilePath -> LocalPackageView [lpvCabalFP] :: LocalPackageView -> !Path Abs File [lpvGPD] :: LocalPackageView -> !GenericPackageDescription [lpvLoc] :: LocalPackageView -> !PackageLocation FilePath -- | Root directory for the given LocalPackageView lpvRoot :: LocalPackageView -> Path Abs Dir -- | Package name for the given 'LocalPackageView lpvName :: LocalPackageView -> PackageName -- | Version for the given 'LocalPackageView lpvVersion :: LocalPackageView -> Version -- | All components available in the given LocalPackageView lpvComponents :: LocalPackageView -> Set NamedComponent stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File) -- | Directory containing the project's stack.yaml file projectRootL :: HasBuildConfig env => Getting r env (Path Abs Dir) class HasConfig env => HasBuildConfig env buildConfigL :: HasBuildConfig env => Lens' env BuildConfig buildConfigL :: (HasBuildConfig env, HasEnvConfig env) => Lens' env BuildConfig -- | Specialized bariant of GHC (e.g. libgmp4 or integer-simple) data GHCVariant -- | Standard bindist GHCStandard :: GHCVariant -- | Bindist that uses integer-simple GHCIntegerSimple :: GHCVariant -- | Other bindists GHCCustom :: String -> GHCVariant -- | Render a GHC variant to a String. ghcVariantName :: GHCVariant -> String -- | Render a GHC variant to a String suffix. ghcVariantSuffix :: GHCVariant -> String -- | Parse GHC variant from a String. parseGHCVariant :: MonadThrow m => String -> m GHCVariant -- | Class for environment values which have a GHCVariant class HasGHCVariant env ghcVariantL :: HasGHCVariant env => Lens' env GHCVariant ghcVariantL :: (HasGHCVariant env, HasBuildConfig env) => Lens' env GHCVariant -- | Directory containing snapshots snapshotsDir :: (MonadReader env m, HasEnvConfig env, MonadThrow m) => m (Path Abs Dir) -- | Configuration after the environment has been setup. data EnvConfig EnvConfig :: !BuildConfig -> !Version -> !CompilerVersion 'CVActual -> !CompilerBuild -> !IORef (Maybe LocalPackages) -> !LoadedSnapshot -> EnvConfig [envConfigBuildConfig] :: EnvConfig -> !BuildConfig -- | This is the version of Cabal that stack will use to compile Setup.hs -- files in the build process. -- -- Note that this is not necessarily the same version as the one that -- stack depends on as a library and which is displayed when running -- stack list-dependencies | grep Cabal in the stack project. [envConfigCabalVersion] :: EnvConfig -> !Version -- | The actual version of the compiler to be used, as opposed to -- wantedCompilerL, which provides the version specified by the -- build plan. [envConfigCompilerVersion] :: EnvConfig -> !CompilerVersion 'CVActual [envConfigCompilerBuild] :: EnvConfig -> !CompilerBuild -- | Cache for getLocalPackages. [envConfigPackagesRef] :: EnvConfig -> !IORef (Maybe LocalPackages) -- | The fully resolved snapshot information. [envConfigLoadedSnapshot] :: EnvConfig -> !LoadedSnapshot class (HasBuildConfig env, HasGHCVariant env) => HasEnvConfig env envConfigL :: HasEnvConfig env => Lens' env EnvConfig -- | Get the path for the given compiler ignoring any local binaries. -- -- https://github.com/commercialhaskell/stack/issues/1052 getCompilerPath :: (MonadIO m, MonadThrow m, MonadReader env m, HasConfig env) => WhichCompiler -> m (Path Abs File) -- | Which packages do ghc-options on the command line apply to? data ApplyGhcOptions -- | all local targets AGOTargets :: ApplyGhcOptions -- | all local packages, even non-targets AGOLocals :: ApplyGhcOptions -- | every package AGOEverything :: ApplyGhcOptions data HpackExecutable HpackBundled :: HpackExecutable HpackCommand :: String -> HpackExecutable data ConfigException ParseConfigFileException :: Path Abs File -> ParseException -> ConfigException ParseCustomSnapshotException :: Text -> ParseException -> ConfigException NoProjectConfigFound :: Path Abs Dir -> Maybe Text -> ConfigException UnexpectedArchiveContents :: [Path Abs Dir] -> [Path Abs File] -> ConfigException UnableToExtractArchive :: Text -> Path Abs File -> ConfigException BadStackVersionException :: VersionRange -> ConfigException NoMatchingSnapshot :: WhichSolverCmd -> NonEmpty SnapName -> ConfigException ResolverMismatch :: WhichSolverCmd -> !Text -> String -> ConfigException ResolverPartial :: WhichSolverCmd -> !Text -> String -> ConfigException NoSuchDirectory :: FilePath -> ConfigException ParseGHCVariantException :: String -> ConfigException BadStackRoot :: Path Abs Dir -> ConfigException -- | $STACK_ROOT, parent dir Won'tCreateStackRootInDirectoryOwnedByDifferentUser :: Path Abs Dir -> Path Abs Dir -> ConfigException UserDoesn'tOwnDirectory :: Path Abs Dir -> ConfigException FailedToCloneRepo :: String -> ConfigException ManualGHCVariantSettingsAreIncompatibleWithSystemGHC :: ConfigException NixRequiresSystemGhc :: ConfigException NoResolverWhenUsingNoLocalConfig :: ConfigException InvalidResolverForNoLocalConfig :: String -> ConfigException DuplicateLocalPackageNames :: ![(PackageName, [PackageLocationIndex FilePath])] -> ConfigException data WhichSolverCmd IsInitCmd :: WhichSolverCmd IsSolverCmd :: WhichSolverCmd IsNewCmd :: WhichSolverCmd data ConfigMonoid ConfigMonoid :: !First (Path Abs Dir) -> !First (Path Rel Dir) -> !BuildOptsMonoid -> !DockerOptsMonoid -> !NixOptsMonoid -> !First Int -> !First Bool -> !First Text -> !UrlsMonoid -> !First [PackageIndex] -> !First Bool -> !First Bool -> !First Bool -> !First Bool -> !First VersionCheck -> !IntersectingVersionRange -> !First String -> !First GHCVariant -> !First CompilerBuild -> !First Int -> !Set FilePath -> !Set FilePath -> !First (Path Abs File) -> !First FilePath -> !First Bool -> !First FilePath -> !ImageOptsMonoid -> !Map Text Text -> !First SCM -> !MonoidMap PackageName (Dual [Text]) -> !MonoidMap ApplyGhcOptions (Dual [Text]) -> ![Path Abs Dir] -> ![SetupInfoLocation] -> !First (Path Abs Dir) -> !First PvpBounds -> !First Bool -> !Map (Maybe PackageName) Bool -> !First Bool -> !First ApplyGhcOptions -> !First Bool -> !First TemplateName -> !First Bool -> !First DumpLogs -> !First Bool -> !First Text -> !First Bool -> ConfigMonoid -- | See: clStackRoot [configMonoidStackRoot] :: ConfigMonoid -> !First (Path Abs Dir) -- | See: configWorkDir. [configMonoidWorkDir] :: ConfigMonoid -> !First (Path Rel Dir) -- | build options. [configMonoidBuildOpts] :: ConfigMonoid -> !BuildOptsMonoid -- | Docker options. [configMonoidDockerOpts] :: ConfigMonoid -> !DockerOptsMonoid -- | Options for the execution environment (nix-shell or container) [configMonoidNixOpts] :: ConfigMonoid -> !NixOptsMonoid -- | See: configConnectionCount [configMonoidConnectionCount] :: ConfigMonoid -> !First Int -- | See: configHideTHLoading [configMonoidHideTHLoading] :: ConfigMonoid -> !First Bool -- | Deprecated in favour of urlsMonoidLatestSnapshot [configMonoidLatestSnapshotUrl] :: ConfigMonoid -> !First Text -- | See: 'configUrls [configMonoidUrls] :: ConfigMonoid -> !UrlsMonoid -- | See: picIndices [configMonoidPackageIndices] :: ConfigMonoid -> !First [PackageIndex] -- | See: configSystemGHC [configMonoidSystemGHC] :: ConfigMonoid -> !First Bool -- | See: configInstallGHC [configMonoidInstallGHC] :: ConfigMonoid -> !First Bool -- | See: configSkipGHCCheck [configMonoidSkipGHCCheck] :: ConfigMonoid -> !First Bool -- | See: configSkipMsys [configMonoidSkipMsys] :: ConfigMonoid -> !First Bool -- | See: configCompilerCheck [configMonoidCompilerCheck] :: ConfigMonoid -> !First VersionCheck -- | See: configRequireStackVersion [configMonoidRequireStackVersion] :: ConfigMonoid -> !IntersectingVersionRange -- | Used for overriding the platform [configMonoidArch] :: ConfigMonoid -> !First String -- | Used for overriding the platform [configMonoidGHCVariant] :: ConfigMonoid -> !First GHCVariant -- | Used for overriding the GHC build [configMonoidGHCBuild] :: ConfigMonoid -> !First CompilerBuild -- | See: configJobs [configMonoidJobs] :: ConfigMonoid -> !First Int -- | See: configExtraIncludeDirs [configMonoidExtraIncludeDirs] :: ConfigMonoid -> !Set FilePath -- | See: configExtraLibDirs [configMonoidExtraLibDirs] :: ConfigMonoid -> !Set FilePath -- | Allow users to override the path to gcc [configMonoidOverrideGccPath] :: ConfigMonoid -> !First (Path Abs File) -- | Use Hpack executable (overrides bundled Hpack) [configMonoidOverrideHpack] :: ConfigMonoid -> !First FilePath -- | See: configConcurrentTests [configMonoidConcurrentTests] :: ConfigMonoid -> !First Bool -- | Used to override the binary installation dir [configMonoidLocalBinPath] :: ConfigMonoid -> !First FilePath -- | Image creation options. [configMonoidImageOpts] :: ConfigMonoid -> !ImageOptsMonoid -- | Template parameters. [configMonoidTemplateParameters] :: ConfigMonoid -> !Map Text Text -- | Initialize SCM (e.g. git init) when making new projects? [configMonoidScmInit] :: ConfigMonoid -> !First SCM -- | See configGhcOptionsByName. Uses Dual so that options -- from the configs on the right come first, so that they can be -- overridden. [configMonoidGhcOptionsByName] :: 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. [configMonoidGhcOptionsByCat] :: ConfigMonoid -> !MonoidMap ApplyGhcOptions (Dual [Text]) -- | Additional paths to search for executables in [configMonoidExtraPath] :: ConfigMonoid -> ![Path Abs Dir] -- | Additional setup info (inline or remote) to use for installing tools [configMonoidSetupInfoLocations] :: ConfigMonoid -> ![SetupInfoLocation] -- | Override the default local programs dir, where e.g. GHC is installed. [configMonoidLocalProgramsBase] :: ConfigMonoid -> !First (Path Abs Dir) -- | See configPvpBounds [configMonoidPvpBounds] :: ConfigMonoid -> !First PvpBounds -- | See configModifyCodePage [configMonoidModifyCodePage] :: ConfigMonoid -> !First Bool -- | See configExplicitSetupDeps [configMonoidExplicitSetupDeps] :: ConfigMonoid -> !Map (Maybe PackageName) Bool -- | See configMonoidRebuildGhcOptions [configMonoidRebuildGhcOptions] :: ConfigMonoid -> !First Bool -- | See configApplyGhcOptions [configMonoidApplyGhcOptions] :: ConfigMonoid -> !First ApplyGhcOptions -- | See configMonoidAllowNewer [configMonoidAllowNewer] :: ConfigMonoid -> !First Bool -- | The default template to use when none is specified. (If Nothing, the -- default default is used.) [configMonoidDefaultTemplate] :: ConfigMonoid -> !First TemplateName -- | Allow users other than the stack root owner to use the stack -- installation. [configMonoidAllowDifferentUser] :: ConfigMonoid -> !First Bool -- | See configDumpLogs [configMonoidDumpLogs] :: ConfigMonoid -> !First DumpLogs -- | See configSaveHackageCreds [configMonoidSaveHackageCreds] :: ConfigMonoid -> !First Bool -- | See configHackageBaseUrl [configMonoidHackageBaseUrl] :: ConfigMonoid -> !First Text -- | See configIgnoreRevisionMismatch [configMonoidIgnoreRevisionMismatch] :: ConfigMonoid -> !First Bool configMonoidInstallGHCName :: Text configMonoidSystemGHCName :: Text parseConfigMonoid :: Path Abs Dir -> Value -> Parser (WithJSONWarnings ConfigMonoid) -- | Which build log files to dump data DumpLogs -- | don't dump any logfiles DumpNoLogs :: DumpLogs -- | dump logfiles containing warnings DumpWarningLogs :: DumpLogs -- | dump all logfiles DumpAllLogs :: DumpLogs -- | Controls which version of the environment is used data EnvSettings EnvSettings :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> EnvSettings -- | include local project bin directory, GHC_PACKAGE_PATH, etc [esIncludeLocals] :: EnvSettings -> !Bool -- | include the GHC_PACKAGE_PATH variable [esIncludeGhcPackagePath] :: EnvSettings -> !Bool -- | set the STACK_EXE variable to the current executable name [esStackExe] :: EnvSettings -> !Bool -- | set the locale to C.UTF-8 [esLocaleUtf8] :: EnvSettings -> !Bool -- | if True, keep GHCRTS variable in environment [esKeepGhcRts] :: EnvSettings -> !Bool minimalEnvSettings :: EnvSettings -- | Default 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 -- | Parsed global command-line options. data GlobalOpts GlobalOpts :: !Maybe String -> !Maybe DockerEntrypoint -> !LogLevel -> !Bool -> !ConfigMonoid -> !Maybe AbstractResolver -> !Maybe (CompilerVersion 'CVWanted) -> !Bool -> !ColorWhen -> !Maybe Int -> !StackYamlLoc FilePath -> GlobalOpts -- | Expected re-exec in container version [globalReExecVersion] :: GlobalOpts -> !Maybe String -- | Data used when stack is acting as a Docker entrypoint (internal use -- only) [globalDockerEntrypoint] :: GlobalOpts -> !Maybe DockerEntrypoint -- | Log level [globalLogLevel] :: GlobalOpts -> !LogLevel -- | Whether to include timings in logs. [globalTimeInLog] :: GlobalOpts -> !Bool -- | Config monoid, for passing into loadConfig [globalConfigMonoid] :: GlobalOpts -> !ConfigMonoid -- | Resolver override [globalResolver] :: GlobalOpts -> !Maybe AbstractResolver -- | Compiler override [globalCompiler] :: GlobalOpts -> !Maybe (CompilerVersion 'CVWanted) -- | We're in a terminal? [globalTerminal] :: GlobalOpts -> !Bool -- | When to use ansi terminal colors [globalColorWhen] :: GlobalOpts -> !ColorWhen -- | Terminal width override [globalTermWidth] :: GlobalOpts -> !Maybe Int -- | Override project stack.yaml [globalStackYaml] :: GlobalOpts -> !StackYamlLoc FilePath -- | Parsed global command-line options monoid. data GlobalOptsMonoid GlobalOptsMonoid :: !First String -> !First DockerEntrypoint -> !First LogLevel -> !First Bool -> !ConfigMonoid -> !First AbstractResolver -> !First (CompilerVersion 'CVWanted) -> !First Bool -> !First ColorWhen -> !First Int -> !First FilePath -> GlobalOptsMonoid -- | Expected re-exec in container version [globalMonoidReExecVersion] :: GlobalOptsMonoid -> !First String -- | Data used when stack is acting as a Docker entrypoint (internal use -- only) [globalMonoidDockerEntrypoint] :: GlobalOptsMonoid -> !First DockerEntrypoint -- | Log level [globalMonoidLogLevel] :: GlobalOptsMonoid -> !First LogLevel -- | Whether to include timings in logs. [globalMonoidTimeInLog] :: GlobalOptsMonoid -> !First Bool -- | Config monoid, for passing into loadConfig [globalMonoidConfigMonoid] :: GlobalOptsMonoid -> !ConfigMonoid -- | Resolver override [globalMonoidResolver] :: GlobalOptsMonoid -> !First AbstractResolver -- | Compiler override [globalMonoidCompiler] :: GlobalOptsMonoid -> !First (CompilerVersion 'CVWanted) -- | We're in a terminal? [globalMonoidTerminal] :: GlobalOptsMonoid -> !First Bool -- | When to use ansi colors [globalMonoidColorWhen] :: GlobalOptsMonoid -> !First ColorWhen -- | Terminal width override [globalMonoidTermWidth] :: GlobalOptsMonoid -> !First Int -- | Override project stack.yaml [globalMonoidStackYaml] :: GlobalOptsMonoid -> !First FilePath data StackYamlLoc filepath SYLDefault :: StackYamlLoc filepath SYLOverride :: !filepath -> StackYamlLoc filepath -- | FilePath is the directory containing the script file, used for -- resolving custom snapshot files. SYLNoConfig :: !Path Abs Dir -> StackYamlLoc filepath -- | Default logging level should be something useful but not crazy. defaultLogLevel :: LogLevel -- | Value returned by loadConfig. data LoadConfig LoadConfig :: !Config -> !Maybe (CompilerVersion 'CVWanted) -> IO BuildConfig -> !Maybe (Path Abs Dir) -> LoadConfig -- | Top-level Stack configuration. [lcConfig] :: LoadConfig -> !Config -- | Action to load the remaining BuildConfig. [lcLoadBuildConfig] :: LoadConfig -> !Maybe (CompilerVersion 'CVWanted) -> IO BuildConfig -- | The project root directory, if in a project. [lcProjectRoot] :: LoadConfig -> !Maybe (Path Abs Dir) -- | Information on a single package index data PackageIndex PackageIndex :: !IndexName -> !Text -> !IndexType -> !Text -> !Bool -> PackageIndex [indexName] :: PackageIndex -> !IndexName -- | URL for the tarball or, in the case of Hackage Security, the root of -- the directory [indexLocation] :: PackageIndex -> !Text [indexType] :: PackageIndex -> !IndexType -- | URL prefix for downloading packages [indexDownloadPrefix] :: PackageIndex -> !Text -- | Require that hashes and package size information be available for -- packages in this index [indexRequireHashes] :: PackageIndex -> !Bool -- | Unique name for a package index newtype IndexName IndexName :: ByteString -> IndexName [unIndexName] :: IndexName -> ByteString indexNameText :: IndexName -> Text -- | A project is a collection of packages. We can have multiple stack.yaml -- files, but only one of them may contain project information. data Project Project :: !Maybe String -> ![PackageLocation Subdirs] -> ![PackageLocationIndex Subdirs] -> !Map PackageName (Map FlagName Bool) -> !Resolver -> !Maybe (CompilerVersion 'CVWanted) -> ![FilePath] -> Project -- | A warning message to display to the user when the auto generated -- config may have issues. [projectUserMsg] :: Project -> !Maybe String -- | Packages which are actually part of the project (as opposed to -- dependencies). -- -- NOTE Stack has always allowed these packages to be any kind of -- package location, but in reality only PLFilePath really makes -- sense. We could consider replacing [PackageLocation] with -- [FilePath] to properly enforce this idea, though it will -- slightly break backwards compatibility if someone really did want to -- treat such things as non-deps. [projectPackages] :: Project -> ![PackageLocation Subdirs] -- | Dependencies defined within the stack.yaml file, to be applied on top -- of the snapshot. [projectDependencies] :: Project -> ![PackageLocationIndex Subdirs] -- | Flags to be applied on top of the snapshot flags. [projectFlags] :: Project -> !Map PackageName (Map FlagName Bool) -- | How we resolve which SnapshotDef to use [projectResolver] :: Project -> !Resolver -- | When specified, overrides which compiler to use [projectCompiler] :: Project -> !Maybe (CompilerVersion 'CVWanted) [projectExtraPackageDBs] :: Project -> ![FilePath] data ProjectAndConfigMonoid ProjectAndConfigMonoid :: !Project -> !ConfigMonoid -> ProjectAndConfigMonoid parseProjectAndConfigMonoid :: Path Abs Dir -> Value -> Parser (WithJSONWarnings ProjectAndConfigMonoid) data PvpBounds PvpBounds :: !PvpBoundsType -> !Bool -> PvpBounds [pbType] :: PvpBounds -> !PvpBoundsType [pbAsRevision] :: PvpBounds -> !Bool -- | How PVP bounds should be added to .cabal files data PvpBoundsType PvpBoundsNone :: PvpBoundsType PvpBoundsUpper :: PvpBoundsType PvpBoundsLower :: PvpBoundsType PvpBoundsBoth :: PvpBoundsType parsePvpBounds :: Text -> Either String PvpBounds readColorWhen :: ReadM ColorWhen -- | A software control system. data SCM Git :: SCM -- | Suffix applied to an installation root to get the bin dir bindirSuffix :: Path Rel Dir -- | File containing the installed cache, see Stack.PackageDump configInstalledCache :: (HasBuildConfig env, MonadReader env m) => m (Path Abs File) -- | Where to store LoadedSnapshot caches configLoadedSnapshotCache :: (MonadThrow m, MonadReader env m, HasConfig env, HasGHCVariant env) => SnapshotDef -> GlobalInfoSource -> m (Path Abs File) -- | Where do we get information on global packages for loading up a -- LoadedSnapshot? data GlobalInfoSource -- | Accept the hints in the snapshot definition GISSnapshotHints :: GlobalInfoSource -- | Look up the actual information in the installed compiler GISCompiler :: CompilerVersion 'CVActual -> GlobalInfoSource -- | Per-project work dir getProjectWorkDir :: (HasBuildConfig env, MonadReader env m) => m (Path Abs Dir) -- | Suffix applied to an installation root to get the doc dir docDirSuffix :: Path Rel Dir -- | Directory for holding flag cache information flagCacheLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Get the extra bin directories (for the PATH). Puts more local first -- -- Bool indicates whether or not to include the locals extraBinDirs :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Bool -> [Path Abs Dir]) -- | Where HPC reports and tix files get stored. hpcReportDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Installation root for dependencies installationRootDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Installation root for locals installationRootLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Installation root for compiler tools bindirCompilerTools :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Hoogle directory. hoogleRoot :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Get the hoogle database path. hoogleDatabasePath :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs File) -- | Package database for installing dependencies into packageDatabaseDeps :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Extra package databases packageDatabaseExtra :: (MonadReader env m, HasEnvConfig env) => m [Path Abs Dir] -- | Package database for installing local packages into packageDatabaseLocal :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Abs Dir) -- | Relative directory for the platform identifier platformOnlyRelDir :: (MonadReader env m, HasPlatform env, MonadThrow m) => m (Path Rel Dir) -- | Relative directory for the platform and GHC identifier platformGhcRelDir :: (MonadReader env m, HasEnvConfig env, MonadThrow m) => m (Path Rel Dir) -- | Relative directory for the platform and GHC identifier without GHC -- bindist build platformGhcVerOnlyRelDir :: (MonadReader env m, HasPlatform env, HasGHCVariant env, MonadThrow m) => m (Path Rel Dir) -- | This is an attempt to shorten stack paths on Windows to decrease our -- chances of hitting 260 symbol path limit. The idea is to calculate -- SHA1 hash of the path used on other architectures, encode with base 16 -- and take first 8 symbols of it. useShaPathOnWindows :: MonadThrow m => Path Rel Dir -> m (Path Rel Dir) shaPath :: (IsPath Rel t, MonadThrow m) => Path Rel t -> m (Path Rel t) shaPathForBytes :: (IsPath Rel t, MonadThrow m) => ByteString -> m (Path Rel t) -- |
--   ".stack-work"
--   
workDirL :: HasConfig env => Lens' env (Path Rel Dir) data EvalOpts EvalOpts :: !String -> !ExecOptsExtra -> EvalOpts [evalArg] :: EvalOpts -> !String [evalExtra] :: EvalOpts -> !ExecOptsExtra data ExecOpts ExecOpts :: !SpecialExecCmd -> ![String] -> !ExecOptsExtra -> ExecOpts [eoCmd] :: ExecOpts -> !SpecialExecCmd [eoArgs] :: ExecOpts -> ![String] [eoExtra] :: ExecOpts -> !ExecOptsExtra data SpecialExecCmd ExecCmd :: String -> SpecialExecCmd ExecRun :: SpecialExecCmd ExecGhc :: SpecialExecCmd ExecRunGhc :: SpecialExecCmd data ExecOptsExtra ExecOptsPlain :: ExecOptsExtra ExecOptsEmbellished :: !EnvSettings -> ![String] -> ![String] -> !Maybe FilePath -> ExecOptsExtra [eoEnvSettings] :: ExecOptsExtra -> !EnvSettings [eoPackages] :: ExecOptsExtra -> ![String] [eoRtsOptions] :: ExecOptsExtra -> ![String] [eoCwd] :: ExecOptsExtra -> !Maybe FilePath -- | Build of the compiler distribution (e.g. standard, gmp4, tinfo6) | -- Information for a file to download. data DownloadInfo DownloadInfo :: Text -> Maybe Int -> Maybe ByteString -> Maybe ByteString -> DownloadInfo -- | URL or absolute file path [downloadInfoUrl] :: DownloadInfo -> Text [downloadInfoContentLength] :: DownloadInfo -> Maybe Int [downloadInfoSha1] :: DownloadInfo -> Maybe ByteString [downloadInfoSha256] :: DownloadInfo -> Maybe ByteString data VersionedDownloadInfo VersionedDownloadInfo :: Version -> DownloadInfo -> VersionedDownloadInfo [vdiVersion] :: VersionedDownloadInfo -> Version [vdiDownloadInfo] :: VersionedDownloadInfo -> DownloadInfo data GHCDownloadInfo GHCDownloadInfo :: [Text] -> Map Text Text -> DownloadInfo -> GHCDownloadInfo [gdiConfigureOpts] :: GHCDownloadInfo -> [Text] [gdiConfigureEnv] :: GHCDownloadInfo -> Map Text Text [gdiDownloadInfo] :: GHCDownloadInfo -> DownloadInfo data SetupInfo SetupInfo :: Maybe DownloadInfo -> Maybe DownloadInfo -> Map Text VersionedDownloadInfo -> Map Text (Map Version GHCDownloadInfo) -> Map Text (Map (CompilerVersion 'CVActual) DownloadInfo) -> Map Text (Map Version DownloadInfo) -> SetupInfo [siSevenzExe] :: SetupInfo -> Maybe DownloadInfo [siSevenzDll] :: SetupInfo -> Maybe DownloadInfo [siMsys2] :: SetupInfo -> Map Text VersionedDownloadInfo [siGHCs] :: SetupInfo -> Map Text (Map Version GHCDownloadInfo) [siGHCJSs] :: SetupInfo -> Map Text (Map (CompilerVersion 'CVActual) DownloadInfo) [siStack] :: SetupInfo -> Map Text (Map Version DownloadInfo) -- | Remote or inline SetupInfo data SetupInfoLocation SetupInfoFileOrURL :: String -> SetupInfoLocation SetupInfoInline :: SetupInfo -> SetupInfoLocation -- | Data passed into Docker container for the Docker entrypoint's use newtype DockerEntrypoint DockerEntrypoint :: Maybe DockerUser -> DockerEntrypoint -- | UIDGIDetc of host user, if we wish to perform UID/GID switch in -- container [deUser] :: DockerEntrypoint -> Maybe DockerUser -- | Docker host user info data DockerUser DockerUser :: UserID -> GroupID -> [GroupID] -> FileMode -> DockerUser -- | uid [duUid] :: DockerUser -> UserID -- | gid [duGid] :: DockerUser -> GroupID -- | Supplemantal groups [duGroups] :: DockerUser -> [GroupID] -- | File creation mask } [duUmask] :: DockerUser -> FileMode -- | The compiler specified by the SnapshotDef. This may be -- different from the actual compiler used! wantedCompilerVersionL :: HasBuildConfig s => Getting r s (CompilerVersion 'CVWanted) -- | The version of the compiler which will actually be used. May be -- different than that specified in the SnapshotDef and returned -- by wantedCompilerVersionL. actualCompilerVersionL :: HasEnvConfig s => Lens' s (CompilerVersion 'CVActual) buildOptsL :: HasConfig s => Lens' s BuildOpts globalOptsL :: Lens' GlobalOpts ConfigMonoid buildOptsInstallExesL :: Lens' BuildOpts Bool buildOptsMonoidHaddockL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsMonoidTestsL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsMonoidBenchmarksL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsMonoidInstallExesL :: Lens' BuildOptsMonoid (Maybe Bool) buildOptsHaddockL :: Lens' BuildOpts Bool globalOptsBuildOptsMonoidL :: Lens' GlobalOpts BuildOptsMonoid stackRootL :: HasCabalLoader s => Lens' s (Path Abs Dir) configUrlsL :: HasConfig env => Lens' env Urls cabalVersionL :: HasEnvConfig env => Lens' env Version whichCompilerL :: Getting r (CompilerVersion a) WhichCompiler envOverrideSettingsL :: HasConfig env => Lens' env (EnvSettings -> IO ProcessContext) loadedSnapshotL :: HasEnvConfig env => Lens' env LoadedSnapshot globalHintsL :: HasBuildConfig s => Getting r s (Map PackageName (Maybe Version)) shouldForceGhcColorFlag :: (HasRunner env, HasEnvConfig env) => RIO env Bool appropriateGhcColorFlag :: (HasRunner env, HasEnvConfig env) => RIO env (Maybe String) view :: MonadReader s m => Getting a s a -> m a -- | 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 instance GHC.Classes.Ord Stack.Types.Config.GhcOptionKey instance GHC.Classes.Eq Stack.Types.Config.GhcOptionKey instance GHC.Show.Show Stack.Types.Config.GlobalOpts instance GHC.Generics.Generic Stack.Types.Config.GlobalOptsMonoid instance GHC.Show.Show Stack.Types.Config.GlobalOptsMonoid instance GHC.Show.Show Stack.Types.Config.DockerEntrypoint instance GHC.Read.Read Stack.Types.Config.DockerEntrypoint instance GHC.Show.Show Stack.Types.Config.DockerUser instance GHC.Read.Read Stack.Types.Config.DockerUser instance GHC.Generics.Generic Stack.Types.Config.ConfigMonoid instance GHC.Show.Show Stack.Types.Config.ConfigMonoid instance GHC.Classes.Ord Stack.Types.Config.PvpBounds instance GHC.Classes.Eq Stack.Types.Config.PvpBounds instance GHC.Read.Read Stack.Types.Config.PvpBounds instance GHC.Show.Show Stack.Types.Config.PvpBounds instance GHC.Enum.Bounded Stack.Types.Config.PvpBoundsType instance GHC.Enum.Enum Stack.Types.Config.PvpBoundsType instance GHC.Classes.Ord Stack.Types.Config.PvpBoundsType instance GHC.Classes.Eq Stack.Types.Config.PvpBoundsType instance GHC.Read.Read Stack.Types.Config.PvpBoundsType instance GHC.Show.Show Stack.Types.Config.PvpBoundsType instance GHC.Show.Show Stack.Types.Config.SetupInfoLocation instance GHC.Show.Show Stack.Types.Config.SetupInfo instance GHC.Show.Show Stack.Types.Config.GHCDownloadInfo instance GHC.Show.Show Stack.Types.Config.VersionedDownloadInfo instance GHC.Show.Show Stack.Types.Config.DownloadInfo instance GHC.Show.Show Stack.Types.Config.GHCVariant instance GHC.Show.Show Stack.Types.Config.SCM instance GHC.Show.Show Stack.Types.Config.Project instance GHC.Show.Show Stack.Types.Config.PackageEntry instance Data.Traversable.Traversable Stack.Types.Config.StackYamlLoc instance Data.Foldable.Foldable Stack.Types.Config.StackYamlLoc instance GHC.Base.Functor Stack.Types.Config.StackYamlLoc instance GHC.Show.Show filepath => GHC.Show.Show (Stack.Types.Config.StackYamlLoc filepath) instance GHC.Show.Show Stack.Types.Config.EvalOpts instance GHC.Show.Show Stack.Types.Config.ExecOpts instance GHC.Show.Show Stack.Types.Config.ExecOptsExtra instance GHC.Classes.Eq Stack.Types.Config.SpecialExecCmd instance GHC.Show.Show Stack.Types.Config.SpecialExecCmd instance GHC.Classes.Ord Stack.Types.Config.EnvSettings instance GHC.Classes.Eq Stack.Types.Config.EnvSettings instance GHC.Show.Show Stack.Types.Config.EnvSettings instance GHC.Enum.Bounded Stack.Types.Config.DumpLogs instance GHC.Enum.Enum Stack.Types.Config.DumpLogs instance GHC.Classes.Ord Stack.Types.Config.DumpLogs instance GHC.Classes.Eq Stack.Types.Config.DumpLogs instance GHC.Read.Read Stack.Types.Config.DumpLogs instance GHC.Show.Show Stack.Types.Config.DumpLogs instance GHC.Enum.Bounded Stack.Types.Config.ApplyGhcOptions instance GHC.Enum.Enum Stack.Types.Config.ApplyGhcOptions instance GHC.Classes.Ord Stack.Types.Config.ApplyGhcOptions instance GHC.Classes.Eq Stack.Types.Config.ApplyGhcOptions instance GHC.Read.Read Stack.Types.Config.ApplyGhcOptions instance GHC.Show.Show Stack.Types.Config.ApplyGhcOptions instance GHC.Classes.Ord Stack.Types.Config.HpackExecutable instance GHC.Classes.Eq Stack.Types.Config.HpackExecutable instance GHC.Read.Read Stack.Types.Config.HpackExecutable instance GHC.Show.Show Stack.Types.Config.HpackExecutable instance Stack.Types.Config.HasPlatform (Distribution.System.Platform, Stack.Types.Config.PlatformVariant) instance Stack.Types.Config.HasPlatform Stack.Types.Config.Config instance Stack.Types.Config.HasPlatform Stack.Types.Config.LoadConfig instance Stack.Types.Config.HasPlatform Stack.Types.Config.BuildConfig instance Stack.Types.Config.HasPlatform Stack.Types.Config.EnvConfig instance Stack.Types.Config.HasGHCVariant Stack.Types.Config.GHCVariant instance Stack.Types.Config.HasGHCVariant Stack.Types.Config.BuildConfig instance Stack.Types.Config.HasGHCVariant Stack.Types.Config.EnvConfig instance RIO.Process.HasProcessContext Stack.Types.Config.LoadConfig instance RIO.Process.HasProcessContext Stack.Types.Config.BuildConfig instance RIO.Process.HasProcessContext Stack.Types.Config.EnvConfig instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.LoadConfig instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.BuildConfig instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.EnvConfig instance Stack.Types.Config.HasConfig Stack.Types.Config.Config instance Stack.Types.Config.HasConfig Stack.Types.Config.LoadConfig instance Stack.Types.Config.HasConfig Stack.Types.Config.BuildConfig instance Stack.Types.Config.HasConfig Stack.Types.Config.EnvConfig instance Stack.Types.Config.HasBuildConfig Stack.Types.Config.BuildConfig instance Stack.Types.Config.HasBuildConfig Stack.Types.Config.EnvConfig instance Stack.Types.Config.HasEnvConfig Stack.Types.Config.EnvConfig instance Stack.Types.Runner.HasRunner Stack.Types.Config.LoadConfig instance Stack.Types.Runner.HasRunner Stack.Types.Config.BuildConfig instance Stack.Types.Runner.HasRunner Stack.Types.Config.EnvConfig instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.GhcOptions instance Data.Aeson.Types.FromJSON.FromJSONKey Stack.Types.Config.GhcOptionKey instance GHC.Base.Semigroup Stack.Types.Config.GlobalOptsMonoid instance GHC.Base.Monoid Stack.Types.Config.GlobalOptsMonoid instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.EnvConfig instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.LoadConfig instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.BuildConfig instance RIO.Process.HasProcessContext Stack.Types.Config.Config instance Stack.PackageIndex.HasCabalLoader Stack.Types.Config.Config instance Stack.Types.Runner.HasRunner Stack.Types.Config.Config instance RIO.Prelude.Logger.HasLogFunc Stack.Types.Config.Config instance GHC.Base.Semigroup Stack.Types.Config.ConfigMonoid instance GHC.Base.Monoid Stack.Types.Config.ConfigMonoid instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Config.PvpBounds instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.PvpBounds instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.SetupInfoLocation) instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.SetupInfo) instance GHC.Base.Semigroup Stack.Types.Config.SetupInfo instance GHC.Base.Monoid Stack.Types.Config.SetupInfo instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.GHCDownloadInfo) instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.VersionedDownloadInfo) instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.DownloadInfo) instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.GHCVariant instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.SCM instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Config.SCM instance Stack.Types.Config.IsPath Path.Abs Path.Dir instance Stack.Types.Config.IsPath Path.Rel Path.Dir instance Stack.Types.Config.IsPath Path.Abs Path.File instance Stack.Types.Config.IsPath Path.Rel Path.File instance GHC.Show.Show Stack.Types.Config.ConfigException instance GHC.Exception.Type.Exception Stack.Types.Config.ConfigException instance Data.Aeson.Types.ToJSON.ToJSON Stack.Types.Config.Project instance Data.Aeson.Types.FromJSON.FromJSON (Data.Aeson.Extended.WithJSONWarnings Stack.Types.Config.PackageEntry) instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.DumpLogs instance Data.Aeson.Types.FromJSON.FromJSON Stack.Types.Config.ApplyGhcOptions -- | Provide ability to upload tarballs to Hackage. module Stack.Upload -- | Upload a single tarball with the given Uploader. -- -- Since 0.1.0.0 upload :: String -> HackageCreds -> FilePath -> IO () -- | Upload a single tarball with the given Uploader. Instead of -- sending a file like upload, this sends a lazy bytestring. -- -- Since 0.1.2.1 uploadBytes :: String -> HackageCreds -> String -> ByteString -> IO () uploadRevision :: String -> HackageCreds -> PackageIdentifier -> ByteString -> IO () -- | Username and password to log into Hackage. -- -- Since 0.1.0.0 data HackageCreds -- | Load Hackage credentials, either from a save file or the command line. -- -- Since 0.1.0.0 loadCreds :: Config -> IO HackageCreds instance GHC.Show.Show Stack.Upload.HackageCreds instance Data.Aeson.Types.ToJSON.ToJSON Stack.Upload.HackageCreds instance Data.Aeson.Types.FromJSON.FromJSON (GHC.IO.FilePath -> Stack.Upload.HackageCreds) module Stack.Types.Package -- | All exceptions thrown by the library. data PackageException PackageInvalidCabalFile :: !Either PackageIdentifierRevision (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PackageException PackageNoCabalFileFound :: Path Abs Dir -> PackageException PackageMultipleCabalFilesFound :: Path Abs Dir -> [Path Abs File] -> PackageException MismatchedCabalName :: Path Abs File -> PackageName -> PackageException MismatchedCabalIdentifier :: !PackageIdentifierRevision -> !PackageIdentifier -> PackageException -- | Libraries in a package. Since Cabal 2.0, internal libraries are a -- thing. data PackageLibraries NoLibraries :: PackageLibraries -- | the foreign library names, sub libraries get built automatically -- without explicit component name passing HasLibraries :: !Set Text -> PackageLibraries -- | Some package info. data Package Package :: !PackageName -> !Version -> !Either License License -> !GetPackageFiles -> !Map PackageName DepValue -> !Set ExeName -> !Set PackageName -> ![Text] -> !Map FlagName Bool -> !Map FlagName Bool -> !PackageLibraries -> !Set Text -> !Map Text TestSuiteInterface -> !Set Text -> !Set Text -> !GetPackageOpts -> !Bool -> !BuildType -> !Maybe (Map PackageName VersionRange) -> Package -- | Name of the package. [packageName] :: Package -> !PackageName -- | Version of the package [packageVersion] :: Package -> !Version -- | The license the package was released under. [packageLicense] :: Package -> !Either License License -- | Get all files of the package. [packageFiles] :: Package -> !GetPackageFiles -- | Packages that the package depends on, both as libraries and build -- tools. [packageDeps] :: Package -> !Map PackageName DepValue -- | Build tools specified in the legacy manner (build-tools:) that failed -- the hard-coded lookup. [packageUnknownTools] :: Package -> !Set ExeName -- | Original dependencies (not sieved). [packageAllDeps] :: Package -> !Set PackageName -- | Ghc options used on package. [packageGhcOptions] :: Package -> ![Text] -- | Flags used on package. [packageFlags] :: Package -> !Map FlagName Bool -- | Defaults for unspecified flags. [packageDefaultFlags] :: Package -> !Map FlagName Bool -- | does the package have a buildable library stanza? [packageLibraries] :: Package -> !PackageLibraries -- | names of internal libraries [packageInternalLibraries] :: Package -> !Set Text -- | names and interfaces of test suites [packageTests] :: Package -> !Map Text TestSuiteInterface -- | names of benchmarks [packageBenchmarks] :: Package -> !Set Text -- | names of executables [packageExes] :: Package -> !Set Text -- | Args to pass to GHC. [packageOpts] :: Package -> !GetPackageOpts -- | Does the package have exposed modules? [packageHasExposedModules] :: Package -> !Bool -- | Package build-type. [packageBuildType] :: Package -> !BuildType -- | If present: custom-setup dependencies [packageSetupDeps] :: Package -> !Maybe (Map PackageName VersionRange) -- | The value for a map from dependency name. This contains both the -- version range and the type of dependency, and provides a semigroup -- instance. data DepValue DepValue :: !VersionRange -> !DepType -> DepValue [dvVersionRange] :: DepValue -> !VersionRange [dvType] :: DepValue -> !DepType -- | Is this package being used as a library, or just as a build tool? If -- the former, we need to ensure that a library actually exists. See -- https://github.com/commercialhaskell/stack/issues/2195 data DepType AsLibrary :: DepType AsBuildTool :: DepType packageIdentifier :: Package -> PackageIdentifier packageDefinedFlags :: Package -> Set FlagName -- | Files that the package depends on, relative to package directory. -- Argument is the location of the .cabal file newtype GetPackageOpts GetPackageOpts :: (forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts)) -> GetPackageOpts [getPackageOpts] :: GetPackageOpts -> forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts) -- | GHC options based on cabal information and ghc-options. data BuildInfoOpts BuildInfoOpts :: [String] -> [String] -> [String] -> Path Abs File -> BuildInfoOpts [bioOpts] :: BuildInfoOpts -> [String] [bioOneWordOpts] :: BuildInfoOpts -> [String] -- | These options can safely have nubOrd applied to them, as there -- are no multi-word options (see -- https://github.com/commercialhaskell/stack/issues/1255) [bioPackageFlags] :: BuildInfoOpts -> [String] [bioCabalMacros] :: BuildInfoOpts -> Path Abs File -- | Files to get for a cabal package. data CabalFileType AllFiles :: CabalFileType Modules :: CabalFileType -- | Files that the package depends on, relative to package directory. -- Argument is the location of the .cabal file newtype GetPackageFiles GetPackageFiles :: (forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning])) -> GetPackageFiles [getPackageFiles] :: GetPackageFiles -> forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning]) -- | Warning generated when reading a package data PackageWarning -- | Modules found that are not listed in cabal file UnlistedModulesWarning :: NamedComponent -> [ModuleName] -> PackageWarning -- | Package build configuration data PackageConfig PackageConfig :: !Bool -> !Bool -> !Map FlagName Bool -> ![Text] -> !CompilerVersion 'CVActual -> !Platform -> PackageConfig -- | Are tests enabled? [packageConfigEnableTests] :: PackageConfig -> !Bool -- | Are benchmarks enabled? [packageConfigEnableBenchmarks] :: PackageConfig -> !Bool -- | Configured flags. [packageConfigFlags] :: PackageConfig -> !Map FlagName Bool -- | Configured ghc options. [packageConfigGhcOptions] :: PackageConfig -> ![Text] -- | GHC version [packageConfigCompilerVersion] :: PackageConfig -> !CompilerVersion 'CVActual -- | host platform [packageConfigPlatform] :: PackageConfig -> !Platform type SourceMap = Map PackageName PackageSource -- | Where the package's source is located: local directory or package -- index data PackageSource -- | Package which exist on the filesystem (as opposed to an index tarball) PSFiles :: LocalPackage -> InstallLocation -> PackageSource -- | Package which is in an index, and the files do not exist on the -- filesystem yet. PSIndex :: InstallLocation -> Map FlagName Bool -> [Text] -> PackageIdentifierRevision -> PackageSource piiVersion :: PackageSource -> Version piiLocation :: PackageSource -> InstallLocation piiPackageLocation :: PackageSource -> PackageLocationIndex FilePath -- | Information on a locally available package of source code data LocalPackage LocalPackage :: !Package -> !Set NamedComponent -> !Set NamedComponent -> !Bool -> !Map PackageName VersionRange -> !Map PackageName VersionRange -> !Maybe Package -> !Path Abs Dir -> !Path Abs File -> !Bool -> !Maybe (Set FilePath) -> !Map NamedComponent (Map FilePath FileCacheInfo) -> !Map NamedComponent (Set (Path Abs File)) -> !PackageLocation FilePath -> LocalPackage -- | The Package info itself, after resolution with package flags, -- with tests and benchmarks disabled [lpPackage] :: LocalPackage -> !Package -- | Components to build, not including the library component. [lpComponents] :: LocalPackage -> !Set NamedComponent -- | Components explicitly requested for build, that are marked "buildable: -- false". [lpUnbuildable] :: LocalPackage -> !Set NamedComponent -- | Whether this package is wanted as a target. [lpWanted] :: LocalPackage -> !Bool -- | Used for determining if we can use --enable-tests in a normal build. [lpTestDeps] :: LocalPackage -> !Map PackageName VersionRange -- | Used for determining if we can use --enable-benchmarks in a normal -- build. [lpBenchDeps] :: LocalPackage -> !Map PackageName VersionRange -- | This stores the Package with tests and benchmarks enabled, if -- either is asked for by the user. [lpTestBench] :: LocalPackage -> !Maybe Package -- | Directory of the package. [lpDir] :: LocalPackage -> !Path Abs Dir -- | The .cabal file [lpCabalFile] :: LocalPackage -> !Path Abs File [lpForceDirty] :: LocalPackage -> !Bool -- | Nothing == not dirty, Just == dirty. Note that the Set may be empty if -- we forced the build to treat packages as dirty. Also, the Set may not -- include all modified files. [lpDirtyFiles] :: LocalPackage -> !Maybe (Set FilePath) -- | current state of the files [lpNewBuildCaches] :: LocalPackage -> !Map NamedComponent (Map FilePath FileCacheInfo) -- | all files used by this package [lpComponentFiles] :: LocalPackage -> !Map NamedComponent (Set (Path Abs File)) -- | Where this source code came from [lpLocation] :: LocalPackage -> !PackageLocation FilePath lpFiles :: LocalPackage -> Set (Path Abs File) -- | A location to install a package into, either snapshot or local data InstallLocation Snap :: InstallLocation Local :: InstallLocation data InstalledPackageLocation InstalledTo :: InstallLocation -> InstalledPackageLocation ExtraGlobal :: InstalledPackageLocation data FileCacheInfo FileCacheInfo :: !ModTime -> !Word64 -> !ByteString -> FileCacheInfo [fciModTime] :: FileCacheInfo -> !ModTime [fciSize] :: FileCacheInfo -> !Word64 [fciHash] :: FileCacheInfo -> !ByteString -- | Used for storage and comparison. newtype ModTime ModTime :: (Integer, Rational) -> ModTime modTimeVC :: VersionConfig ModTime testSuccessVC :: VersionConfig Bool -- | A descriptor from a .cabal file indicating one of the following: -- -- exposed-modules: Foo other-modules: Foo or main-is: Foo.hs data DotCabalDescriptor DotCabalModule :: !ModuleName -> DotCabalDescriptor DotCabalMain :: !FilePath -> DotCabalDescriptor DotCabalFile :: !FilePath -> DotCabalDescriptor DotCabalCFile :: !FilePath -> DotCabalDescriptor -- | Maybe get the module name from the .cabal descriptor. dotCabalModule :: DotCabalDescriptor -> Maybe ModuleName -- | Maybe get the main name from the .cabal descriptor. dotCabalMain :: DotCabalDescriptor -> Maybe FilePath -- | A path resolved from the .cabal file, which is either main-is or an -- exposedinternalreferenced module. data DotCabalPath DotCabalModulePath :: !Path Abs File -> DotCabalPath DotCabalMainPath :: !Path Abs File -> DotCabalPath DotCabalFilePath :: !Path Abs File -> DotCabalPath DotCabalCFilePath :: !Path Abs File -> DotCabalPath -- | Get the module path. dotCabalModulePath :: DotCabalPath -> Maybe (Path Abs File) -- | Get the main path. dotCabalMainPath :: DotCabalPath -> Maybe (Path Abs File) -- | Get the c file path. dotCabalCFilePath :: DotCabalPath -> Maybe (Path Abs File) -- | Get the path. dotCabalGetPath :: DotCabalPath -> Path Abs File type InstalledMap = Map PackageName (InstallLocation, Installed) data Installed Library :: PackageIdentifier -> GhcPkgId -> Maybe (Either License License) -> Installed Executable :: PackageIdentifier -> Installed installedPackageIdentifier :: Installed -> PackageIdentifier -- | Get the installed Version. installedVersion :: Installed -> Version instance GHC.Show.Show Stack.Types.Package.Package instance GHC.Show.Show Stack.Types.Package.LocalPackage instance GHC.Show.Show Stack.Types.Package.PackageSource instance GHC.Classes.Eq Stack.Types.Package.Installed instance GHC.Show.Show Stack.Types.Package.Installed instance GHC.Show.Show Stack.Types.Package.DotCabalPath instance GHC.Classes.Ord Stack.Types.Package.DotCabalPath instance GHC.Classes.Eq Stack.Types.Package.DotCabalPath instance GHC.Show.Show Stack.Types.Package.DotCabalDescriptor instance GHC.Classes.Ord Stack.Types.Package.DotCabalDescriptor instance GHC.Classes.Eq Stack.Types.Package.DotCabalDescriptor instance Data.Data.Data Stack.Types.Package.FileCacheInfo instance GHC.Classes.Eq Stack.Types.Package.FileCacheInfo instance GHC.Show.Show Stack.Types.Package.FileCacheInfo instance GHC.Generics.Generic Stack.Types.Package.FileCacheInfo instance Data.Data.Data Stack.Types.Package.ModTime instance Data.Store.Impl.Store Stack.Types.Package.ModTime instance Control.DeepSeq.NFData Stack.Types.Package.ModTime instance GHC.Classes.Eq Stack.Types.Package.ModTime instance GHC.Generics.Generic Stack.Types.Package.ModTime instance GHC.Show.Show Stack.Types.Package.ModTime instance GHC.Classes.Ord Stack.Types.Package.ModTime instance GHC.Classes.Eq Stack.Types.Package.InstalledPackageLocation instance GHC.Show.Show Stack.Types.Package.InstalledPackageLocation instance GHC.Classes.Eq Stack.Types.Package.InstallLocation instance GHC.Show.Show Stack.Types.Package.InstallLocation instance GHC.Show.Show Stack.Types.Package.PackageConfig instance GHC.Show.Show Stack.Types.Package.BuildInfoOpts instance GHC.Show.Show Stack.Types.Package.DepValue instance GHC.Classes.Eq Stack.Types.Package.DepType instance GHC.Show.Show Stack.Types.Package.DepType instance GHC.Show.Show Stack.Types.Package.PackageLibraries instance GHC.Show.Show Stack.Types.Package.GetPackageOpts instance GHC.Classes.Ord Stack.Types.Package.Package instance GHC.Classes.Eq Stack.Types.Package.Package instance GHC.Show.Show Stack.Types.Package.GetPackageFiles instance Data.Store.Impl.Store Stack.Types.Package.FileCacheInfo instance Control.DeepSeq.NFData Stack.Types.Package.FileCacheInfo instance GHC.Base.Semigroup Stack.Types.Package.InstallLocation instance GHC.Base.Monoid Stack.Types.Package.InstallLocation instance GHC.Base.Semigroup Stack.Types.Package.DepValue instance GHC.Base.Semigroup Stack.Types.Package.DepType instance GHC.Exception.Type.Exception Stack.Types.Package.PackageException instance GHC.Show.Show Stack.Types.Package.PackageException -- | Build-specific types. module Stack.Types.Build data StackBuildException Couldn'tFindPkgId :: PackageName -> StackBuildException CompilerVersionMismatch :: Maybe (CompilerVersion 'CVActual, Arch) -> (CompilerVersion 'CVWanted, Arch) -> GHCVariant -> CompilerBuild -> VersionCheck -> Maybe (Path Abs File) -> Text -> StackBuildException Couldn'tParseTargets :: [Text] -> StackBuildException UnknownTargets :: Set PackageName -> Map PackageName Version -> Path Abs File -> StackBuildException TestSuiteFailure :: PackageIdentifier -> Map Text (Maybe ExitCode) -> Maybe (Path Abs File) -> ByteString -> StackBuildException TestSuiteTypeUnsupported :: TestSuiteInterface -> StackBuildException ConstructPlanFailed :: String -> StackBuildException CabalExitedUnsuccessfully :: ExitCode -> PackageIdentifier -> Path Abs File -> [String] -> Maybe (Path Abs File) -> [Text] -> StackBuildException SetupHsBuildFailure :: ExitCode -> Maybe PackageIdentifier -> Path Abs File -> [String] -> Maybe (Path Abs File) -> [Text] -> StackBuildException ExecutionFailure :: [SomeException] -> StackBuildException LocalPackageDoesn'tMatchTarget :: PackageName -> Version -> Version -> StackBuildException NoSetupHsFound :: Path Abs Dir -> StackBuildException InvalidFlagSpecification :: Set UnusedFlags -> StackBuildException TargetParseException :: [Text] -> StackBuildException SolverGiveUp :: String -> StackBuildException SolverMissingCabalInstall :: StackBuildException SomeTargetsNotBuildable :: [(PackageName, NamedComponent)] -> StackBuildException TestSuiteExeMissing :: Bool -> String -> String -> String -> StackBuildException CabalCopyFailed :: Bool -> String -> StackBuildException LocalPackagesPresent :: [PackageIdentifier] -> StackBuildException data FlagSource FSCommandLine :: FlagSource FSStackYaml :: FlagSource data UnusedFlags UFNoPackage :: FlagSource -> PackageName -> UnusedFlags UFFlagsNotDefined :: FlagSource -> Package -> Set FlagName -> UnusedFlags UFSnapshot :: PackageName -> UnusedFlags -- | A location to install a package into, either snapshot or local data InstallLocation Snap :: InstallLocation Local :: InstallLocation -- | Used for storage and comparison. data ModTime -- | One-way conversion to serialized time. modTime :: UTCTime -> ModTime data Installed Library :: PackageIdentifier -> GhcPkgId -> Maybe (Either License License) -> Installed Executable :: PackageIdentifier -> Installed piiVersion :: PackageSource -> Version piiLocation :: PackageSource -> InstallLocation -- | A task to perform when building data Task Task :: !PackageIdentifier -> !TaskType -> !TaskConfigOpts -> !Map PackageIdentifier GhcPkgId -> !Bool -> !CachePkgSrc -> !Bool -> !Bool -> Task -- | the package/version to be built [taskProvides] :: Task -> !PackageIdentifier -- | the task type, telling us how to build this [taskType] :: Task -> !TaskType [taskConfigOpts] :: Task -> !TaskConfigOpts -- | GhcPkgIds of already-installed dependencies [taskPresent] :: Task -> !Map PackageIdentifier GhcPkgId -- | indicates that the package can be built in one step [taskAllInOne] :: Task -> !Bool [taskCachePkgSrc] :: Task -> !CachePkgSrc -- | Were any of the dependencies missing? The reason this is necessary -- is... hairy. And as you may expect, a bug in Cabal. See: -- https://github.com/haskell/cabal/issues/4728#issuecomment-337937673. -- The problem is that Cabal may end up generating the same package ID -- for a dependency, even if the ABI has changed. As a result, without -- this field, Stack would think that a reconfigure is unnecessary, when -- in fact we _do_ need to reconfigure. The details here suck. We really -- need proper hashes for package identifiers. [taskAnyMissing] :: Task -> !Bool -- | Is the build type of this package Configure. Check out -- ensureConfigureScript in Stack.Build.Execute for the motivation [taskBuildTypeConfig] :: Task -> !Bool taskIsTarget :: Task -> Bool taskLocation :: Task -> InstallLocation -- | Information on a locally available package of source code data LocalPackage LocalPackage :: !Package -> !Set NamedComponent -> !Set NamedComponent -> !Bool -> !Map PackageName VersionRange -> !Map PackageName VersionRange -> !Maybe Package -> !Path Abs Dir -> !Path Abs File -> !Bool -> !Maybe (Set FilePath) -> !Map NamedComponent (Map FilePath FileCacheInfo) -> !Map NamedComponent (Set (Path Abs File)) -> !PackageLocation FilePath -> LocalPackage -- | The Package info itself, after resolution with package flags, -- with tests and benchmarks disabled [lpPackage] :: LocalPackage -> !Package -- | Components to build, not including the library component. [lpComponents] :: LocalPackage -> !Set NamedComponent -- | Components explicitly requested for build, that are marked "buildable: -- false". [lpUnbuildable] :: LocalPackage -> !Set NamedComponent -- | Whether this package is wanted as a target. [lpWanted] :: LocalPackage -> !Bool -- | Used for determining if we can use --enable-tests in a normal build. [lpTestDeps] :: LocalPackage -> !Map PackageName VersionRange -- | Used for determining if we can use --enable-benchmarks in a normal -- build. [lpBenchDeps] :: LocalPackage -> !Map PackageName VersionRange -- | This stores the Package with tests and benchmarks enabled, if -- either is asked for by the user. [lpTestBench] :: LocalPackage -> !Maybe Package -- | Directory of the package. [lpDir] :: LocalPackage -> !Path Abs Dir -- | The .cabal file [lpCabalFile] :: LocalPackage -> !Path Abs File [lpForceDirty] :: LocalPackage -> !Bool -- | Nothing == not dirty, Just == dirty. Note that the Set may be empty if -- we forced the build to treat packages as dirty. Also, the Set may not -- include all modified files. [lpDirtyFiles] :: LocalPackage -> !Maybe (Set FilePath) -- | current state of the files [lpNewBuildCaches] :: LocalPackage -> !Map NamedComponent (Map FilePath FileCacheInfo) -- | all files used by this package [lpComponentFiles] :: LocalPackage -> !Map NamedComponent (Set (Path Abs File)) -- | Where this source code came from [lpLocation] :: LocalPackage -> !PackageLocation FilePath -- | Basic information used to calculate what the configure options are data BaseConfigOpts BaseConfigOpts :: !Path Abs Dir -> !Path Abs Dir -> !Path Abs Dir -> !Path Abs Dir -> !BuildOpts -> !BuildOptsCLI -> ![Path Abs Dir] -> BaseConfigOpts [bcoSnapDB] :: BaseConfigOpts -> !Path Abs Dir [bcoLocalDB] :: BaseConfigOpts -> !Path Abs Dir [bcoSnapInstallRoot] :: BaseConfigOpts -> !Path Abs Dir [bcoLocalInstallRoot] :: BaseConfigOpts -> !Path Abs Dir [bcoBuildOpts] :: BaseConfigOpts -> !BuildOpts [bcoBuildOptsCLI] :: BaseConfigOpts -> !BuildOptsCLI [bcoExtraDBs] :: BaseConfigOpts -> ![Path Abs Dir] -- | A complete plan of what needs to be built and how to do it data Plan Plan :: !Map PackageName Task -> !Map PackageName Task -> !Map GhcPkgId (PackageIdentifier, Text) -> !Map Text InstallLocation -> Plan [planTasks] :: Plan -> !Map PackageName Task -- | Final actions to be taken (test, benchmark, etc) [planFinals] :: Plan -> !Map PackageName Task -- | Text is reason we're unregistering, for display only [planUnregisterLocal] :: Plan -> !Map GhcPkgId (PackageIdentifier, Text) -- | Executables that should be installed after successful building [planInstallExes] :: Plan -> !Map Text InstallLocation -- | Options for the FinalAction DoTests data TestOpts TestOpts :: !Bool -> ![String] -> !Bool -> !Bool -> TestOpts -- | Whether successful tests will be run gain [toRerunTests] :: TestOpts -> !Bool -- | Arguments passed to the test program [toAdditionalArgs] :: TestOpts -> ![String] -- | Generate a code coverage report [toCoverage] :: TestOpts -> !Bool -- | Disable running of tests [toDisableRun] :: TestOpts -> !Bool -- | Options for the FinalAction DoBenchmarks data BenchmarkOpts BenchmarkOpts :: !Maybe String -> !Bool -> BenchmarkOpts -- | Arguments passed to the benchmark program [beoAdditionalArgs] :: BenchmarkOpts -> !Maybe String -- | Disable running of benchmarks [beoDisableRun] :: BenchmarkOpts -> !Bool data FileWatchOpts NoFileWatch :: FileWatchOpts FileWatch :: FileWatchOpts FileWatchPoll :: FileWatchOpts -- | Build options that is interpreted by the build command. This is built -- up from BuildOptsCLI and BuildOptsMonoid data BuildOpts BuildOpts :: !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !HaddockOpts -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe Bool -> !Maybe Bool -> !Bool -> !Bool -> !TestOpts -> !Bool -> !BenchmarkOpts -> !Bool -> !Bool -> !Bool -> ![Text] -> !Bool -> BuildOpts [boptsLibProfile] :: BuildOpts -> !Bool [boptsExeProfile] :: BuildOpts -> !Bool [boptsLibStrip] :: BuildOpts -> !Bool [boptsExeStrip] :: BuildOpts -> !Bool -- | Build haddocks? [boptsHaddock] :: BuildOpts -> !Bool -- | Options to pass to haddock [boptsHaddockOpts] :: BuildOpts -> !HaddockOpts -- | Open haddocks in the browser? [boptsOpenHaddocks] :: BuildOpts -> !Bool -- | Build haddocks for dependencies? [boptsHaddockDeps] :: BuildOpts -> !Maybe Bool -- | Build haddocks for all symbols and packages, like cabal haddock -- --internal [boptsHaddockInternal] :: BuildOpts -> !Bool -- | Build hyperlinked source if possible. Fallback to hscolour. -- Disable for no sources. [boptsHaddockHyperlinkSource] :: BuildOpts -> !Bool -- | Install executables to user path after building? [boptsInstallExes] :: BuildOpts -> !Bool -- | Install executables to compiler tools path after building? [boptsInstallCompilerTool] :: BuildOpts -> !Bool -- | Fetch all packages immediately ^ Watch files for changes and -- automatically rebuild [boptsPreFetch] :: BuildOpts -> !Bool -- | Keep building/running after failure [boptsKeepGoing] :: BuildOpts -> !Maybe Bool -- | Keep intermediate files and build directories [boptsKeepTmpFiles] :: BuildOpts -> !Maybe Bool -- | Force treating all local packages as having dirty files [boptsForceDirty] :: BuildOpts -> !Bool -- | Turn on tests for local targets [boptsTests] :: BuildOpts -> !Bool -- | Additional test arguments [boptsTestOpts] :: BuildOpts -> !TestOpts -- | Turn on benchmarks for local targets [boptsBenchmarks] :: BuildOpts -> !Bool -- | Additional test arguments ^ Commands (with arguments) to run after a -- successful build ^ Only perform the configure step when building [boptsBenchmarkOpts] :: BuildOpts -> !BenchmarkOpts -- | Perform the configure step even if already configured [boptsReconfigure] :: BuildOpts -> !Bool -- | Ask Cabal to be verbose in its builds [boptsCabalVerbose] :: BuildOpts -> !Bool -- | Whether to enable split-objs. [boptsSplitObjs] :: BuildOpts -> !Bool -- | Which components to skip when building [boptsSkipComponents] :: BuildOpts -> ![Text] -- | Should we use the interleaved GHC output when building multiple -- packages? [boptsInterleavedOutput] :: BuildOpts -> !Bool -- | Which subset of packages to build data BuildSubset BSAll :: BuildSubset -- | Only install packages in the snapshot database, skipping packages -- intended for the local database. BSOnlySnapshot :: BuildSubset BSOnlyDependencies :: BuildSubset defaultBuildOpts :: BuildOpts -- | The type of a task, either building local code or something from the -- package index (upstream) data TaskType TTFiles :: LocalPackage -> InstallLocation -> TaskType TTIndex :: Package -> InstallLocation -> PackageIdentifierRevision -> TaskType ttPackageLocation :: TaskType -> PackageLocationIndex FilePath -- | Given the IDs of any missing packages, produce the configure options data TaskConfigOpts TaskConfigOpts :: !Set PackageIdentifier -> !Map PackageIdentifier GhcPkgId -> ConfigureOpts -> TaskConfigOpts -- | Dependencies for which we don't yet have an GhcPkgId [tcoMissing] :: TaskConfigOpts -> !Set PackageIdentifier -- | Produce the list of options given the missing GhcPkgIds [tcoOpts] :: TaskConfigOpts -> !Map PackageIdentifier GhcPkgId -> ConfigureOpts -- | Stored on disk to know whether the files have changed. newtype BuildCache BuildCache :: Map FilePath FileCacheInfo -> BuildCache -- | Modification times of files. [buildCacheTimes] :: BuildCache -> Map FilePath FileCacheInfo buildCacheVC :: VersionConfig BuildCache -- | Stored on disk to know whether the flags have changed. data ConfigCache ConfigCache :: !ConfigureOpts -> !Set GhcPkgId -> !Set ByteString -> !Bool -> !CachePkgSrc -> ConfigCache -- | All options used for this package. [configCacheOpts] :: ConfigCache -> !ConfigureOpts -- | The GhcPkgIds of all of the dependencies. Since Cabal doesn't take the -- complete GhcPkgId (only a PackageIdentifier) in the configure options, -- just using the previous value is insufficient to know if dependencies -- have changed. [configCacheDeps] :: ConfigCache -> !Set GhcPkgId -- | The components to be built. It's a bit of a hack to include this in -- here, as it's not a configure option (just a build option), but this -- is a convenient way to force compilation when the components change. [configCacheComponents] :: ConfigCache -> !Set ByteString -- | Are haddocks to be built? [configCacheHaddock] :: ConfigCache -> !Bool [configCachePkgSrc] :: ConfigCache -> !CachePkgSrc configCacheVC :: VersionConfig ConfigCache -- | Render a BaseConfigOpts to an actual list of options configureOpts :: EnvConfig -> BaseConfigOpts -> Map PackageIdentifier GhcPkgId -> Bool -> InstallLocation -> Package -> ConfigureOpts data CachePkgSrc CacheSrcUpstream :: CachePkgSrc CacheSrcLocal :: FilePath -> CachePkgSrc toCachePkgSrc :: PackageSource -> CachePkgSrc isStackOpt :: Text -> Bool -- | Get set of wanted package names from locals. wantedLocalPackages :: [LocalPackage] -> Set PackageName data FileCacheInfo FileCacheInfo :: !ModTime -> !Word64 -> !ByteString -> FileCacheInfo [fciModTime] :: FileCacheInfo -> !ModTime [fciSize] :: FileCacheInfo -> !Word64 [fciHash] :: FileCacheInfo -> !ByteString -- | Configure options to be sent to Setup.hs configure data ConfigureOpts ConfigureOpts :: ![String] -> ![String] -> ConfigureOpts -- | Options related to various paths. We separate these out since they do -- not have an impact on the contents of the compiled binary for checking -- if we can use an existing precompiled cache. [coDirs] :: ConfigureOpts -> ![String] [coNoDirs] :: ConfigureOpts -> ![String] -- | Information on a compiled package: the library conf file (if -- relevant), the sublibraries (if present) and all of the executable -- paths. data PrecompiledCache PrecompiledCache :: !Maybe FilePath -> ![FilePath] -> ![FilePath] -> PrecompiledCache -- | .conf file inside the package database [pcLibrary] :: PrecompiledCache -> !Maybe FilePath -- | .conf file inside the package database, for each of the sublibraries [pcSubLibs] :: PrecompiledCache -> ![FilePath] -- | Full paths to executables [pcExes] :: PrecompiledCache -> ![FilePath] precompiledCacheVC :: VersionConfig PrecompiledCache instance Data.Data.Data Stack.Types.Build.PrecompiledCache instance GHC.Generics.Generic Stack.Types.Build.PrecompiledCache instance GHC.Classes.Eq Stack.Types.Build.PrecompiledCache instance GHC.Show.Show Stack.Types.Build.PrecompiledCache instance Data.Data.Data Stack.Types.Build.ConfigCache instance GHC.Show.Show Stack.Types.Build.ConfigCache instance GHC.Classes.Eq Stack.Types.Build.ConfigCache instance GHC.Generics.Generic Stack.Types.Build.ConfigCache instance GHC.Show.Show Stack.Types.Build.Plan instance GHC.Show.Show Stack.Types.Build.Task instance Data.Data.Data Stack.Types.Build.ConfigureOpts instance GHC.Generics.Generic Stack.Types.Build.ConfigureOpts instance GHC.Classes.Eq Stack.Types.Build.ConfigureOpts instance GHC.Show.Show Stack.Types.Build.ConfigureOpts instance GHC.Show.Show Stack.Types.Build.BaseConfigOpts instance GHC.Show.Show Stack.Types.Build.TaskType instance Data.Data.Data Stack.Types.Build.CachePkgSrc instance GHC.Show.Show Stack.Types.Build.CachePkgSrc instance GHC.Classes.Eq Stack.Types.Build.CachePkgSrc instance GHC.Generics.Generic Stack.Types.Build.CachePkgSrc instance Data.Data.Data Stack.Types.Build.BuildCache instance GHC.Show.Show Stack.Types.Build.BuildCache instance GHC.Classes.Eq Stack.Types.Build.BuildCache instance GHC.Generics.Generic Stack.Types.Build.BuildCache instance Control.DeepSeq.NFData Stack.Types.Build.PkgDepsOracle instance Data.Store.Impl.Store Stack.Types.Build.PkgDepsOracle instance Data.Hashable.Class.Hashable Stack.Types.Build.PkgDepsOracle instance GHC.Classes.Eq Stack.Types.Build.PkgDepsOracle instance GHC.Show.Show Stack.Types.Build.PkgDepsOracle instance GHC.Classes.Ord Stack.Types.Build.UnusedFlags instance GHC.Classes.Eq Stack.Types.Build.UnusedFlags instance GHC.Show.Show Stack.Types.Build.UnusedFlags instance GHC.Classes.Ord Stack.Types.Build.FlagSource instance GHC.Classes.Eq Stack.Types.Build.FlagSource instance GHC.Show.Show Stack.Types.Build.FlagSource instance Data.Store.Impl.Store Stack.Types.Build.PrecompiledCache instance Control.DeepSeq.NFData Stack.Types.Build.PrecompiledCache instance Data.Store.Impl.Store Stack.Types.Build.ConfigCache instance Control.DeepSeq.NFData Stack.Types.Build.ConfigCache instance GHC.Show.Show Stack.Types.Build.TaskConfigOpts instance Data.Store.Impl.Store Stack.Types.Build.ConfigureOpts instance Control.DeepSeq.NFData Stack.Types.Build.ConfigureOpts instance Data.Store.Impl.Store Stack.Types.Build.CachePkgSrc instance Control.DeepSeq.NFData Stack.Types.Build.CachePkgSrc instance Control.DeepSeq.NFData Stack.Types.Build.BuildCache instance Data.Store.Impl.Store Stack.Types.Build.BuildCache instance GHC.Show.Show Stack.Types.Build.StackBuildException instance GHC.Exception.Type.Exception Stack.Types.Build.StackBuildException -- | Functions for the GHC package database. module Stack.GhcPkg -- | Get the global package database getGlobalDB :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env (Path Abs Dir) -- | Get the value of a field of the package. findGhcPkgField :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> [Path Abs Dir] -> String -> Text -> RIO env (Maybe Text) -- | Create a package database in the given directory, if it doesn't exist. createDatabase :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> Path Abs Dir -> RIO env () unregisterGhcPkgId :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> CompilerVersion 'CVActual -> Path Abs Dir -> GhcPkgId -> PackageIdentifier -> RIO env () -- | Get the version of Cabal from the global package database. getCabalPkgVer :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env Version -- | Get the name to use for "ghc-pkg", given the compiler version. ghcPkgExeName :: WhichCompiler -> String -- | Get the environment variable to use for the package DB paths. ghcPkgPathEnvVar :: WhichCompiler -> Text -- | Get the value for GHC_PACKAGE_PATH mkGhcPackagePath :: Bool -> Path Abs Dir -> Path Abs Dir -> [Path Abs Dir] -> Path Abs Dir -> Text module Stack.PackageDump -- | A single line of input, not including line endings type Line = Text -- | Apply the given Sink to each section of output, broken by a single -- line containing --- eachSection :: Monad m => ConduitM Line Void m a -> ConduitM Text a m () -- | Grab each key/value pair eachPair :: Monad m => (Text -> ConduitM Line Void m a) -> ConduitM Line a m () -- | Dump information for a single package data DumpPackage profiling haddock symbols DumpPackage :: !GhcPkgId -> !PackageIdentifier -> !Maybe PackageIdentifier -> !Maybe License -> ![FilePath] -> ![Text] -> !Bool -> ![Text] -> ![GhcPkgId] -> ![FilePath] -> !Maybe FilePath -> !profiling -> !haddock -> !symbols -> !Bool -> DumpPackage profiling haddock symbols [dpGhcPkgId] :: DumpPackage profiling haddock symbols -> !GhcPkgId [dpPackageIdent] :: DumpPackage profiling haddock symbols -> !PackageIdentifier [dpParentLibIdent] :: DumpPackage profiling haddock symbols -> !Maybe PackageIdentifier [dpLicense] :: DumpPackage profiling haddock symbols -> !Maybe License [dpLibDirs] :: DumpPackage profiling haddock symbols -> ![FilePath] [dpLibraries] :: DumpPackage profiling haddock symbols -> ![Text] [dpHasExposedModules] :: DumpPackage profiling haddock symbols -> !Bool [dpExposedModules] :: DumpPackage profiling haddock symbols -> ![Text] [dpDepends] :: DumpPackage profiling haddock symbols -> ![GhcPkgId] [dpHaddockInterfaces] :: DumpPackage profiling haddock symbols -> ![FilePath] [dpHaddockHtml] :: DumpPackage profiling haddock symbols -> !Maybe FilePath [dpProfiling] :: DumpPackage profiling haddock symbols -> !profiling [dpHaddock] :: DumpPackage profiling haddock symbols -> !haddock [dpSymbols] :: DumpPackage profiling haddock symbols -> !symbols [dpIsExposed] :: DumpPackage profiling haddock symbols -> !Bool -- | Convert a stream of bytes into a stream of DumpPackages conduitDumpPackage :: MonadThrow m => ConduitM Text (DumpPackage () () ()) m () -- | Call ghc-pkg dump with appropriate flags and stream to the given -- Sink, for a single database ghcPkgDump :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> [Path Abs Dir] -> ConduitM Text Void (RIO env) a -> RIO env a -- | Call ghc-pkg describe with appropriate flags and stream to the given -- Sink, for a single database ghcPkgDescribe :: (HasProcessContext env, HasLogFunc env) => PackageName -> WhichCompiler -> [Path Abs Dir] -> ConduitM Text Void (RIO env) a -> RIO env a -- | Create a new, empty InstalledCache newInstalledCache :: MonadIO m => m InstalledCache -- | Load a InstalledCache from disk, swallowing any errors and -- returning an empty cache. loadInstalledCache :: HasLogFunc env => Path Abs File -> RIO env InstalledCache -- | Save a InstalledCache to disk saveInstalledCache :: HasLogFunc env => Path Abs File -> InstalledCache -> RIO env () -- | Add profiling information to the stream of DumpPackages addProfiling :: MonadIO m => InstalledCache -> ConduitM (DumpPackage a b c) (DumpPackage Bool b c) m () -- | Add haddock information to the stream of DumpPackages addHaddock :: MonadIO m => InstalledCache -> ConduitM (DumpPackage a b c) (DumpPackage a Bool c) m () -- | Add debugging symbol information to the stream of -- DumpPackages addSymbols :: MonadIO m => InstalledCache -> ConduitM (DumpPackage a b c) (DumpPackage a b Bool) m () -- | Find the package IDs matching the given constraints with all -- dependencies installed. Packages not mentioned in the provided -- Map are allowed to be present too. sinkMatching :: Monad m => Bool -> Bool -> Bool -> Map PackageName Version -> ConduitM (DumpPackage Bool Bool Bool) o m (Map PackageName (DumpPackage Bool Bool Bool)) -- | Prune a list of possible packages down to those whose dependencies are -- met. -- -- pruneDeps :: (Ord name, Ord id) => (id -> name) -> (item -> id) -> (item -> [id]) -> (item -> item -> item) -> [item] -> Map name item instance (GHC.Classes.Eq profiling, GHC.Classes.Eq haddock, GHC.Classes.Eq symbols) => GHC.Classes.Eq (Stack.PackageDump.DumpPackage profiling haddock symbols) instance (GHC.Show.Show profiling, GHC.Show.Show haddock, GHC.Show.Show symbols) => GHC.Show.Show (Stack.PackageDump.DumpPackage profiling haddock symbols) instance GHC.Exception.Type.Exception Stack.PackageDump.PackageDumpException instance GHC.Show.Show Stack.PackageDump.PackageDumpException module Stack.Setup.Installed getCompilerVersion :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env (CompilerVersion 'CVActual) markInstalled :: (MonadIO m, MonadThrow m) => Path Abs Dir -> Tool -> m () unmarkInstalled :: MonadIO m => Path Abs Dir -> Tool -> m () listInstalled :: (MonadIO m, MonadThrow m) => Path Abs Dir -> m [Tool] data Tool -- | e.g. ghc-7.8.4, msys2-20150512 Tool :: PackageIdentifier -> Tool -- | e.g. ghcjs-0.1.0_ghc-7.10.2 ToolGhcjs :: CompilerVersion 'CVActual -> Tool toolString :: Tool -> String toolNameString :: Tool -> String parseToolText :: Text -> Maybe Tool data ExtraDirs ExtraDirs :: ![Path Abs Dir] -> ![Path Abs Dir] -> ![Path Abs Dir] -> ExtraDirs [edBins] :: ExtraDirs -> ![Path Abs Dir] [edInclude] :: ExtraDirs -> ![Path Abs Dir] [edLib] :: ExtraDirs -> ![Path Abs Dir] -- | Binary directories for the given installed package extraDirs :: HasConfig env => Tool -> RIO env ExtraDirs installDir :: (MonadReader env m, MonadThrow m) => Path Abs Dir -> Tool -> m (Path Abs Dir) tempInstallDir :: (MonadReader env m, MonadThrow m) => Path Abs Dir -> Tool -> m (Path Abs Dir) instance GHC.Generics.Generic Stack.Setup.Installed.ExtraDirs instance GHC.Show.Show Stack.Setup.Installed.ExtraDirs instance GHC.Base.Semigroup Stack.Setup.Installed.ExtraDirs instance GHC.Base.Monoid Stack.Setup.Installed.ExtraDirs module Stack.Options.TestParser -- | Parser for test arguments. FIXME hide args testOptsParser :: Bool -> Parser TestOptsMonoid module Stack.Options.HaddockParser -- | Parser for haddock arguments. haddockOptsParser :: Bool -> Parser HaddockOptsMonoid module Stack.Options.GhcVariantParser -- | GHC variant parser ghcVariantParser :: Bool -> Parser GHCVariant module Stack.Options.BenchParser -- | Parser for bench arguments. FIXME hiding options benchOptsParser :: Bool -> Parser BenchmarkOptsMonoid -- | Global sqlite database shared by all projects. Warning: this is -- currently only accessible from outside a Docker container. module Stack.Docker.GlobalDB -- | Update last used time and project for a Docker image hash. updateDockerImageLastUsed :: Config -> String -> FilePath -> IO () -- | Get a list of Docker image hashes and when they were last used. getDockerImagesLastUsed :: Config -> IO [DockerImageLastUsed] -- | Given a list of all existing Docker images, remove any that no longer -- exist from the database. pruneDockerImagesLastUsed :: Config -> [String] -> IO () -- | Date and project path where Docker image hash last used. type DockerImageLastUsed = (String, [(UTCTime, FilePath)]) type DockerImageProjectId = Key DockerImageProject -- | Get the record of whether an executable is compatible with a Docker -- image getDockerImageExe :: Config -> String -> FilePath -> UTCTime -> IO (Maybe Bool) -- | Seet the record of whether an executable is compatible with a Docker -- image setDockerImageExe :: Config -> String -> FilePath -> UTCTime -> Bool -> IO () type DockerImageExeId = Key DockerImageExe instance GHC.Show.Show Stack.Docker.GlobalDB.DockerImageExe instance GHC.Show.Show Stack.Docker.GlobalDB.DockerImageProject instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageProject) instance Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Web.Internal.HttpApiData.FromHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Web.Internal.HttpApiData.ToHttpApiData (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Web.PathPieces.PathPiece (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance GHC.Classes.Ord (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance GHC.Classes.Eq (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance GHC.Read.Read (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance GHC.Show.Show (Database.Persist.Class.PersistEntity.Key Stack.Docker.GlobalDB.DockerImageExe) instance Database.Persist.Class.PersistField.PersistField Stack.Docker.GlobalDB.DockerImageExe instance Database.Persist.Sql.Class.PersistFieldSql Stack.Docker.GlobalDB.DockerImageExe instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Docker.GlobalDB.DockerImageExe instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.Sql.Types.Internal.SqlBackend Stack.Docker.GlobalDB.DockerImageExe instance Database.Persist.Class.PersistField.PersistField Stack.Docker.GlobalDB.DockerImageProject instance Database.Persist.Sql.Class.PersistFieldSql Stack.Docker.GlobalDB.DockerImageProject instance Database.Persist.Class.PersistEntity.PersistEntity Stack.Docker.GlobalDB.DockerImageProject instance Database.Persist.Class.PersistStore.ToBackendKey Database.Persist.Sql.Types.Internal.SqlBackend Stack.Docker.GlobalDB.DockerImageProject module Stack.Constants.Config -- | Package's build artifacts directory. distDirFromDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir) -- | Package's working directory. workDirFromDir :: (MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir) -- | Relative location of build artifacts. distRelativeDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Rel Dir) -- | Image staging dir from project root. imageStagingDir :: (MonadReader env m, HasConfig env, MonadThrow m) => Path Abs Dir -> Int -> m (Path Abs Dir) -- | Docker sandbox from project root. projectDockerSandboxDir :: (MonadReader env m, HasConfig env) => Path Abs Dir -> m (Path Abs Dir) -- | The filename used for dirtiness check of config. configCacheFile :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File) -- | The filename used for modification check of .cabal configCabalMod :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File) -- | The directory containing the files used for dirtiness check of source -- files. buildCachesDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir) -- | The filename used to mark tests as having succeeded testSuccessFile :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File) -- | The filename used to mark tests as having built testBuiltFile :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs File) -- | Relative location of directory for HPC work. hpcRelativeDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => m (Path Rel Dir) -- | Directory for HPC work. hpcDirFromDir :: (MonadThrow m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> m (Path Abs Dir) -- | Output .o/.hi directory. objectInterfaceDirL :: HasBuildConfig env => Getting r env (Path Abs Dir) -- | GHCi files directory. ghciDirL :: HasBuildConfig env => Getting r env (Path Abs Dir) -- | Directory for project templates. templatesDir :: Config -> Path Abs Dir -- | This module builds Docker (OpenContainer) images. module Stack.Image -- | Stages the executables & additional content in a staging directory -- under '.stack-work' stageContainerImageArtifacts :: HasEnvConfig env => Maybe (Path Abs Dir) -> [Text] -> RIO env () -- | Builds a Docker (OpenContainer) image extending the base -- image specified in the project's stack.yaml. Then new image will be -- extended with an ENTRYPOINT specified for each entrypoint -- listed in the config file. createContainerImageFromStage :: HasConfig env => Maybe (Path Abs Dir) -> [Text] -> RIO env () -- | The command name for dealing with images. imgCmdName :: String -- | The command name for building a docker container. imgDockerCmdName :: String -- | Convert image opts monoid to image options. imgOptsFromMonoid :: ImageOptsMonoid -> ImageOpts instance GHC.Exception.Type.Exception Stack.Image.StackImageException instance GHC.Show.Show Stack.Image.StackImageException -- | Docker configuration module Stack.Config.Docker -- | Interprets DockerOptsMonoid options. dockerOptsFromMonoid :: MonadThrow m => Maybe Project -> Path Abs Dir -> Maybe AbstractResolver -> DockerOptsMonoid -> m DockerOpts -- | Exceptions thrown by Stack.Docker.Config. data StackDockerConfigException -- | Only LTS resolvers are supported for default image tag. ResolverNotSupportedException :: String -> StackDockerConfigException -- | Invalid global database path. InvalidDatabasePathException :: SomeException -> StackDockerConfigException instance GHC.Exception.Type.Exception Stack.Config.Docker.StackDockerConfigException instance GHC.Show.Show Stack.Config.Docker.StackDockerConfigException -- | Build configuration module Stack.Config.Build -- | Interprets BuildOptsMonoid options. buildOptsFromMonoid :: BuildOptsMonoid -> BuildOpts haddockOptsFromMonoid :: HaddockOptsMonoid -> HaddockOpts testOptsFromMonoid :: TestOptsMonoid -> Maybe [String] -> TestOpts benchmarkOptsFromMonoid :: BenchmarkOptsMonoid -> Maybe [String] -> BenchmarkOpts -- | Generate haddocks module Stack.Build.Haddock -- | Generate Haddock index and contents for local packages. generateLocalHaddockIndex :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () () ()) -> [LocalPackage] -> RIO env () -- | Generate Haddock index and contents for local packages and their -- dependencies. generateDepsHaddockIndex :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () () ()) -> Map GhcPkgId (DumpPackage () () ()) -> Map GhcPkgId (DumpPackage () () ()) -> [LocalPackage] -> RIO env () -- | Generate Haddock index and contents for all snapshot packages. generateSnapHaddockIndex :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> BaseConfigOpts -> Map GhcPkgId (DumpPackage () () ()) -> Map GhcPkgId (DumpPackage () () ()) -> RIO env () openHaddocksInBrowser :: HasRunner env => BaseConfigOpts -> Map PackageName (PackageIdentifier, InstallLocation) -> Set PackageName -> RIO env () -- | Determine whether we should haddock for a package. shouldHaddockPackage :: BuildOpts -> Set PackageName -> PackageName -> Bool -- | Determine whether to build haddocks for dependencies. shouldHaddockDeps :: BuildOpts -> Bool -- | Cache information about previous builds module Stack.Build.Cache -- | Try to read the dirtiness cache for the given package directory. tryGetBuildCache :: HasEnvConfig env => Path Abs Dir -> NamedComponent -> RIO env (Maybe (Map FilePath FileCacheInfo)) -- | Try to read the dirtiness cache for the given package directory. tryGetConfigCache :: HasEnvConfig env => Path Abs Dir -> RIO env (Maybe ConfigCache) -- | Try to read the mod time of the cabal file from the last build tryGetCabalMod :: HasEnvConfig env => Path Abs Dir -> RIO env (Maybe ModTime) -- | Get all of the installed executables getInstalledExes :: (MonadReader env m, HasEnvConfig env, MonadIO m, MonadThrow m) => InstallLocation -> m [PackageIdentifier] -- | Loads the flag cache for the given installed extra-deps tryGetFlagCache :: HasEnvConfig env => Installed -> RIO env (Maybe ConfigCache) -- | Delete the caches for the project. deleteCaches :: (MonadIO m, MonadReader env m, HasEnvConfig env, MonadThrow m) => Path Abs Dir -> m () -- | Mark the given executable as installed markExeInstalled :: (MonadReader env m, HasEnvConfig env, MonadIO m, MonadThrow m) => InstallLocation -> PackageIdentifier -> m () -- | Mark the given executable as not installed markExeNotInstalled :: (MonadReader env m, HasEnvConfig env, MonadIO m, MonadThrow m) => InstallLocation -> PackageIdentifier -> m () writeFlagCache :: HasEnvConfig env => Installed -> ConfigCache -> RIO env () -- | Write the dirtiness cache for this package's files. writeBuildCache :: HasEnvConfig env => Path Abs Dir -> NamedComponent -> Map FilePath FileCacheInfo -> RIO env () -- | Write the dirtiness cache for this package's configuration. writeConfigCache :: HasEnvConfig env => Path Abs Dir -> ConfigCache -> RIO env () -- | See tryGetCabalMod writeCabalMod :: HasEnvConfig env => Path Abs Dir -> ModTime -> RIO env () -- | Mark a test suite as having succeeded setTestSuccess :: HasEnvConfig env => Path Abs Dir -> RIO env () -- | Mark a test suite as not having succeeded unsetTestSuccess :: HasEnvConfig env => Path Abs Dir -> RIO env () -- | Check if the test suite already passed checkTestSuccess :: HasEnvConfig env => Path Abs Dir -> RIO env Bool -- | Write out information about a newly built package writePrecompiledCache :: HasEnvConfig env => BaseConfigOpts -> PackageLocationIndex FilePath -> ConfigureOpts -> Set GhcPkgId -> Installed -> [GhcPkgId] -> Set Text -> RIO env () -- | Check the cache for a precompiled package matching the given -- configuration. readPrecompiledCache :: forall env. HasEnvConfig env => PackageLocationIndex FilePath -> ConfigureOpts -> Set GhcPkgId -> RIO env (Maybe PrecompiledCache) -- | Stored on disk to know whether the files have changed. newtype BuildCache BuildCache :: Map FilePath FileCacheInfo -> BuildCache -- | Modification times of files. [buildCacheTimes] :: BuildCache -> Map FilePath FileCacheInfo module Stack.Build.Installed type InstalledMap = Map PackageName (InstallLocation, Installed) data Installed Library :: PackageIdentifier -> GhcPkgId -> Maybe (Either License License) -> Installed Executable :: PackageIdentifier -> Installed -- | Options for getInstalled. data GetInstalledOpts GetInstalledOpts :: !Bool -> !Bool -> !Bool -> GetInstalledOpts -- | Require profiling libraries? [getInstalledProfiling] :: GetInstalledOpts -> !Bool -- | Require haddocks? [getInstalledHaddock] :: GetInstalledOpts -> !Bool -- | Require debugging symbols? [getInstalledSymbols] :: GetInstalledOpts -> !Bool -- | Returns the new InstalledMap and all of the locally registered -- packages. getInstalled :: HasEnvConfig env => GetInstalledOpts -> Map PackageName PackageSource -> RIO env (InstalledMap, [DumpPackage () () ()], [DumpPackage () () ()], [DumpPackage () () ()]) instance GHC.Show.Show Stack.Build.Installed.LoadHelper instance GHC.Show.Show Stack.Build.Installed.Allowed instance GHC.Classes.Eq Stack.Build.Installed.Allowed module Path.CheckInstall -- | Checks if the installed executable will be available on the user's -- PATH. This doesn't use envSearchPath menv because it includes -- paths only visible when running in the stack environment. warnInstallSearchPathIssues :: HasConfig env => FilePath -> [Text] -> RIO env () -- | Handy path information. module Stack.Path -- | Print out useful path information in a human-readable format (and -- support others later). path :: HasEnvConfig env => [Text] -> RIO env () pathParser :: Parser [Text] instance Stack.Types.Config.HasPlatform Stack.Path.PathInfo instance RIO.Prelude.Logger.HasLogFunc Stack.Path.PathInfo instance Stack.Types.Runner.HasRunner Stack.Path.PathInfo instance Stack.Types.Config.HasConfig Stack.Path.PathInfo instance Stack.PackageIndex.HasCabalLoader Stack.Path.PathInfo instance RIO.Process.HasProcessContext Stack.Path.PathInfo instance Stack.Types.Config.HasBuildConfig Stack.Path.PathInfo -- | Create new a new project directory populated with a basic working -- project. module Stack.New -- | Create a new project with the given options. new :: HasConfig env => NewOpts -> Bool -> RIO env (Path Abs Dir) -- | Options for creating a new project. data NewOpts NewOpts :: PackageName -> Bool -> Maybe TemplateName -> Map Text Text -> NewOpts -- | Name of the project to create. [newOptsProjectName] :: NewOpts -> PackageName -- | Whether to create the project without a directory. [newOptsCreateBare] :: NewOpts -> Bool -- | Name of the template to use. [newOptsTemplate] :: NewOpts -> Maybe TemplateName -- | Nonce parameters specified just for this invocation. [newOptsNonceParams] :: NewOpts -> Map Text Text -- | A template name. data TemplateName -- | Display help for the templates command. templatesHelp :: HasLogFunc env => RIO env () instance GHC.Exception.Type.Exception Stack.New.NewException instance GHC.Show.Show Stack.New.NewException -- | Functionality for downloading packages securely for cabal's usage. module Stack.Fetch -- | Intended to work for the command line command. unpackPackages :: HasCabalLoader env => Maybe SnapshotDef -> FilePath -> [String] -> RIO env () -- | Same as unpackPackageIdents, but for a single package. unpackPackageIdent :: HasCabalLoader env => Path Abs Dir -> Path Rel Dir -> PackageIdentifierRevision -> RIO env (Path Abs Dir) -- | Ensure that all of the given package idents are unpacked into the -- build unpack directory, and return the paths to all of the -- subdirectories. unpackPackageIdents :: HasCabalLoader env => Path Abs Dir -> Maybe (Path Rel Dir) -> [PackageIdentifierRevision] -> RIO env (Map PackageIdentifier (Path Abs Dir)) -- | Fetch packages into the cache without unpacking fetchPackages :: HasCabalLoader env => Set PackageIdentifier -> RIO env () -- | Internal function used to unpack tarball. -- -- Takes a path to a .tar.gz file, the name of the directory it should -- contain, and a destination folder to extract the tarball into. Returns -- unexpected entries, as pairs of paths and descriptions. untar :: forall b1 b2. Path b1 File -> Path Rel Dir -> Path b2 Dir -> IO [(FilePath, Text)] -- | Resolve a set of package names and identifiers into -- FetchPackage values. resolvePackages :: HasCabalLoader env => Maybe SnapshotDef -> [PackageIdentifierRevision] -> Set PackageName -> RIO env [ResolvedPackage] -- | Turn package identifiers and package names into a list of -- ResolvedPackages. Returns any unresolved names and -- identifier. These are considered unresolved even if the only mismatch -- is in the cabal file info (MSS 2017-07-17: old versions of this code -- had special handling to treat missing cabal file info as a warning, -- that's no longer necessary or desirable since all info should be -- present and checked). resolvePackagesAllowMissing :: forall env. HasCabalLoader env => Maybe SnapshotDef -> [PackageIdentifierRevision] -> Set PackageName -> RIO env (Set PackageName, HashSet PackageIdentifierRevision, [ResolvedPackage]) data ResolvedPackage ResolvedPackage :: !PackageIdentifier -> !Maybe PackageDownload -> !OffsetSize -> !PackageIndex -> ResolvedPackage [rpIdent] :: ResolvedPackage -> !PackageIdentifier [rpDownload] :: ResolvedPackage -> !Maybe PackageDownload [rpOffsetSize] :: ResolvedPackage -> !OffsetSize [rpIndex] :: ResolvedPackage -> !PackageIndex -- | Add the cabal files to a list of idents with their caches. withCabalFiles :: HasCabalLoader env => IndexName -> [(ResolvedPackage, a)] -> (PackageIdentifier -> a -> ByteString -> IO b) -> RIO env [b] loadFromIndex :: HasCabalLoader env => PackageIdentifierRevision -> RIO env ByteString instance GHC.Show.Show Stack.Fetch.ResolvedPackage instance GHC.Exception.Type.Exception Stack.Fetch.FetchException instance GHC.Show.Show Stack.Fetch.FetchException -- | Dealing with Cabal. module Stack.Package -- | Reads and exposes the package information readPackageDir :: forall env. HasConfig env => PackageConfig -> Path Abs Dir -> Bool -> RIO env (Package, Path Abs File) -- | Read the raw, unresolved package information from a file. readPackageUnresolvedDir :: forall env. HasConfig env => Path Abs Dir -> Bool -> RIO env (GenericPackageDescription, Path Abs File) -- | Read the GenericPackageDescription from the given -- PackageIdentifierRevision. readPackageUnresolvedIndex :: forall env. HasCabalLoader env => PackageIdentifierRevision -> RIO env GenericPackageDescription -- | Get GenericPackageDescription and PackageDescription -- reading info from given directory. readPackageDescriptionDir :: forall env. HasConfig env => PackageConfig -> Path Abs Dir -> Bool -> RIO env (GenericPackageDescription, PackageDescriptionPair) -- | 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 -> [Flag] -> PackageDescriptionPair -> Package -- | Some package info. data Package Package :: !PackageName -> !Version -> !Either License License -> !GetPackageFiles -> !Map PackageName DepValue -> !Set ExeName -> !Set PackageName -> ![Text] -> !Map FlagName Bool -> !Map FlagName Bool -> !PackageLibraries -> !Set Text -> !Map Text TestSuiteInterface -> !Set Text -> !Set Text -> !GetPackageOpts -> !Bool -> !BuildType -> !Maybe (Map PackageName VersionRange) -> Package -- | Name of the package. [packageName] :: Package -> !PackageName -- | Version of the package [packageVersion] :: Package -> !Version -- | The license the package was released under. [packageLicense] :: Package -> !Either License License -- | Get all files of the package. [packageFiles] :: Package -> !GetPackageFiles -- | Packages that the package depends on, both as libraries and build -- tools. [packageDeps] :: Package -> !Map PackageName DepValue -- | Build tools specified in the legacy manner (build-tools:) that failed -- the hard-coded lookup. [packageUnknownTools] :: Package -> !Set ExeName -- | Original dependencies (not sieved). [packageAllDeps] :: Package -> !Set PackageName -- | Ghc options used on package. [packageGhcOptions] :: Package -> ![Text] -- | Flags used on package. [packageFlags] :: Package -> !Map FlagName Bool -- | Defaults for unspecified flags. [packageDefaultFlags] :: Package -> !Map FlagName Bool -- | does the package have a buildable library stanza? [packageLibraries] :: Package -> !PackageLibraries -- | names of internal libraries [packageInternalLibraries] :: Package -> !Set Text -- | names and interfaces of test suites [packageTests] :: Package -> !Map Text TestSuiteInterface -- | names of benchmarks [packageBenchmarks] :: Package -> !Set Text -- | names of executables [packageExes] :: Package -> !Set Text -- | Args to pass to GHC. [packageOpts] :: Package -> !GetPackageOpts -- | Does the package have exposed modules? [packageHasExposedModules] :: Package -> !Bool -- | Package build-type. [packageBuildType] :: Package -> !BuildType -- | If present: custom-setup dependencies [packageSetupDeps] :: Package -> !Maybe (Map PackageName VersionRange) -- | A pair of package descriptions: one which modified the buildable -- values of test suites and benchmarks depending on whether they are -- enabled, and one which does not. -- -- Fields are intentionally lazy, we may only need one or the other -- value. -- -- MSS 2017-08-29: The very presence of this data type is terribly ugly, -- it represents the fact that the Cabal 2.0 upgrade did _not_ go well. -- Specifically, we used to have a field to indicate whether a component -- was enabled in addition to buildable, but that's gone now, and this is -- an ugly proxy. We should at some point clean up the mess of Package, -- LocalPackage, etc, and probably pull in the definition of -- PackageDescription from Cabal with our additionally needed metadata. -- But this is a good enough hack for the moment. Odds are, you're -- reading this in the year 2024 and thinking "wtf?" data PackageDescriptionPair PackageDescriptionPair :: PackageDescription -> PackageDescription -> PackageDescriptionPair [pdpOrigBuildable] :: PackageDescriptionPair -> PackageDescription [pdpModifiedBuildable] :: PackageDescriptionPair -> PackageDescription -- | Files that the package depends on, relative to package directory. -- Argument is the location of the .cabal file newtype GetPackageFiles GetPackageFiles :: (forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning])) -> GetPackageFiles [getPackageFiles] :: GetPackageFiles -> forall env. HasEnvConfig env => Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Set (Path Abs File), [PackageWarning]) -- | Files that the package depends on, relative to package directory. -- Argument is the location of the .cabal file newtype GetPackageOpts GetPackageOpts :: (forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts)) -> GetPackageOpts [getPackageOpts] :: GetPackageOpts -> forall env. HasEnvConfig env => SourceMap -> InstalledMap -> [PackageName] -> [PackageName] -> Path Abs File -> RIO env (Map NamedComponent (Map ModuleName (Path Abs File)), Map NamedComponent (Set DotCabalPath), Map NamedComponent BuildInfoOpts) -- | Package build configuration data PackageConfig PackageConfig :: !Bool -> !Bool -> !Map FlagName Bool -> ![Text] -> !CompilerVersion 'CVActual -> !Platform -> PackageConfig -- | Are tests enabled? [packageConfigEnableTests] :: PackageConfig -> !Bool -- | Are benchmarks enabled? [packageConfigEnableBenchmarks] :: PackageConfig -> !Bool -- | Configured flags. [packageConfigFlags] :: PackageConfig -> !Map FlagName Bool -- | Configured ghc options. [packageConfigGhcOptions] :: PackageConfig -> ![Text] -- | GHC version [packageConfigCompilerVersion] :: PackageConfig -> !CompilerVersion 'CVActual -- | host platform [packageConfigPlatform] :: PackageConfig -> !Platform -- | Path for the package's build log. buildLogPath :: (MonadReader env m, HasBuildConfig env, MonadThrow m) => Package -> Maybe String -> m (Path Abs File) -- | All exceptions thrown by the library. data PackageException PackageInvalidCabalFile :: !Either PackageIdentifierRevision (Path Abs File) -> !Maybe Version -> ![PError] -> ![PWarning] -> PackageException PackageNoCabalFileFound :: Path Abs Dir -> PackageException PackageMultipleCabalFilesFound :: Path Abs Dir -> [Path Abs File] -> PackageException MismatchedCabalName :: Path Abs File -> PackageName -> PackageException MismatchedCabalIdentifier :: !PackageIdentifierRevision -> !PackageIdentifier -> PackageException -- | Evaluates the conditions of a GenericPackageDescription, -- yielding a resolved PackageDescription. resolvePackageDescription :: PackageConfig -> GenericPackageDescription -> PackageDescriptionPair -- | Get all dependencies of the package (buildable targets only). -- -- Note that for Cabal versions 1.22 and earlier, there is a bug where -- Cabal requires dependencies for non-buildable components to be -- present. We're going to use GHC version as a proxy for Cabal library -- version in this case for simplicity, so we'll check for GHC being 7.10 -- or earlier. This obviously makes our function a lot more fun to -- write... packageDependencies :: PackageConfig -> PackageDescription -> Map PackageName VersionRange -- | Extract the PackageIdentifier given an exploded haskell -- package path. cabalFilePackageId :: (MonadIO m, MonadThrow m) => Path Abs File -> m PackageIdentifier gpdPackageIdentifier :: GenericPackageDescription -> PackageIdentifier gpdPackageName :: GenericPackageDescription -> PackageName gpdVersion :: GenericPackageDescription -> Version instance Stack.Types.Config.HasPlatform Stack.Package.Ctx instance Stack.Types.Config.HasGHCVariant Stack.Package.Ctx instance RIO.Prelude.Logger.HasLogFunc Stack.Package.Ctx instance Stack.Types.Runner.HasRunner Stack.Package.Ctx instance Stack.Types.Config.HasConfig Stack.Package.Ctx instance Stack.PackageIndex.HasCabalLoader Stack.Package.Ctx instance RIO.Process.HasProcessContext Stack.Package.Ctx instance Stack.Types.Config.HasBuildConfig Stack.Package.Ctx instance Stack.Types.Config.HasEnvConfig Stack.Package.Ctx module Stack.Sig.Sign -- | Sign a haskell package with the given url of the signature service and -- a path to a tarball. sign :: HasLogFunc env => String -> Path Abs File -> RIO env Signature -- | Sign a haskell package given the url to the signature service, a -- PackageIdentifier and a file path to the package on disk. signPackage :: HasLogFunc env => String -> PackageIdentifier -> Path Abs File -> RIO env Signature -- | Sign a haskell package with the given url to the signature service, a -- package tarball path (package tarball name) and a lazy bytestring of -- bytes that represent the tarball bytestream. The function will write -- the bytes to the path in a temp dir and sign the tarball with GPG. signTarBytes :: HasLogFunc env => String -> Path Rel File -> ByteString -> RIO env Signature module Stack.Sig -- | Deal with downloading, cloning, or whatever else is necessary for -- getting a PackageLocation into something Stack can work with. module Stack.PackageLocation -- | Same as resolveMultiPackageLocation, but works on a -- SinglePackageLocation. resolveSinglePackageLocation :: HasConfig env => Path Abs Dir -> PackageLocation FilePath -> RIO env (Path Abs Dir) -- | Resolve a PackageLocation into a path, downloading and cloning as -- necessary. -- -- Returns the updated PackageLocation value with just a single subdir -- (if relevant). resolveMultiPackageLocation :: HasConfig env => Path Abs Dir -> PackageLocation Subdirs -> RIO env [(Path Abs Dir, PackageLocation FilePath)] parseSingleCabalFile :: forall env. HasConfig env => Path Abs Dir -> Bool -> PackageLocation FilePath -> RIO env LocalPackageView -- | Parse the cabal files present in the given 'PackageLocationIndex -- FilePath'. parseSingleCabalFileIndex :: forall env. HasConfig env => Path Abs Dir -> PackageLocationIndex FilePath -> RIO env GenericPackageDescription -- | Load and parse cabal files into GenericPackageDescriptions parseMultiCabalFiles :: forall env. HasConfig env => Path Abs Dir -> Bool -> PackageLocation Subdirs -> RIO env [LocalPackageView] -- | parseMultiCabalFiles but supports PLIndex parseMultiCabalFilesIndex :: forall env. HasConfig env => Path Abs Dir -> PackageLocationIndex Subdirs -> RIO env [(GenericPackageDescription, PackageLocationIndex FilePath)] -- | Reading in SnapshotDefs and converting them into -- LoadedSnapshots. module Stack.Snapshot -- | Convert a Resolver into a SnapshotDef loadResolver :: forall env. HasConfig env => Resolver -> RIO env SnapshotDef -- | Fully load up a SnapshotDef into a LoadedSnapshot loadSnapshot :: forall env. (HasConfig env, HasGHCVariant env) => Maybe (CompilerVersion 'CVActual) -> Path Abs Dir -> SnapshotDef -> RIO env LoadedSnapshot -- | Given information on a LoadedSnapshot and a given set of -- additional packages and configuration values, calculates the new -- global and snapshot packages, as well as the new local packages. -- -- The new globals and snapshots must be a subset of the initial values. calculatePackagePromotion :: forall env localLocation. (HasConfig env, HasGHCVariant env) => Path Abs Dir -> LoadedSnapshot -> [(GenericPackageDescription, SinglePackageLocation, localLocation)] -> Map PackageName (Map FlagName Bool) -> Map PackageName Bool -> Map PackageName [Text] -> Set PackageName -> RIO env (Map PackageName (LoadedPackageInfo GhcPkgId), Map PackageName (LoadedPackageInfo SinglePackageLocation), Map PackageName (LoadedPackageInfo (SinglePackageLocation, Maybe localLocation))) instance GHC.Exception.Type.Exception Stack.Snapshot.SnapshotException instance GHC.Show.Show Stack.Snapshot.SnapshotException -- | The general Stack configuration that starts everything off. This -- should be smart to falback if there is no stack.yaml, instead relying -- on whatever files are available. -- -- If there is no stack.yaml, and there is a cabal.config, we read in -- those constraints, and if there's a cabal.sandbox.config, we read any -- constraints from there and also find the package database from there, -- etc. And if there's nothing, we should probably default to behaving -- like cabal, possibly with spitting out a warning that "you should run -- `stk init` to make things better". module Stack.Config -- | An environment with a subset of BuildConfig used for setup. data MiniConfig -- | Load the configuration, using current directory, environment -- variables, and defaults as necessary. The passed Maybe (Path Abs -- File) is an override for the location of the project's -- stack.yaml. loadConfig :: HasRunner env => ConfigMonoid -> Maybe AbstractResolver -> StackYamlLoc (Path Abs File) -> RIO env LoadConfig loadConfigMaybeProject :: HasRunner env => ConfigMonoid -> Maybe AbstractResolver -> LocalConfigStatus (Project, Path Abs File, ConfigMonoid) -> RIO env LoadConfig -- | Load the MiniConfig. loadMiniConfig :: Config -> MiniConfig -- | 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 packages from EnvConfig, downloading and cloning as necessary. If -- the packages have already been downloaded, this uses a cached value. getLocalPackages :: forall env. HasEnvConfig env => RIO env LocalPackages -- | Get the location of the implicit global project directory. If the -- directory already exists at the deprecated location, its location is -- returned. Otherwise, the new location is returned. getImplicitGlobalProjectDir :: HasLogFunc env => Config -> RIO env (Path Abs Dir) -- | This is slightly more expensive than asks -- (bcStackYaml . getBuildConfig) and should -- only be used when no BuildConfig is at hand. getStackYaml :: HasConfig env => RIO env (Path Abs File) -- | Download the Snapshots value from stackage.org. getSnapshots :: HasConfig env => RIO env Snapshots -- | Turn an AbstractResolver into a Resolver. makeConcreteResolver :: HasConfig env => Maybe (Path Abs Dir) -> AbstractResolver -> RIO env Resolver -- | 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 :: ByteString -- | Get the location of the project config file, if it exists. getProjectConfig :: HasLogFunc env => StackYamlLoc (Path Abs File) -> RIO env (LocalConfigStatus (Path Abs File)) data LocalConfigStatus a LCSNoProject :: LocalConfigStatus a LCSProject :: a -> LocalConfigStatus a -- | parent directory for making a concrete resolving LCSNoConfig :: !Path Abs Dir -> LocalConfigStatus a instance Data.Traversable.Traversable Stack.Config.LocalConfigStatus instance Data.Foldable.Foldable Stack.Config.LocalConfigStatus instance GHC.Base.Functor Stack.Config.LocalConfigStatus instance GHC.Show.Show a => GHC.Show.Show (Stack.Config.LocalConfigStatus a) instance Stack.Types.Config.HasConfig Stack.Config.MiniConfig instance RIO.Process.HasProcessContext Stack.Config.MiniConfig instance Stack.PackageIndex.HasCabalLoader Stack.Config.MiniConfig instance Stack.Types.Config.HasPlatform Stack.Config.MiniConfig instance Stack.Types.Config.HasGHCVariant Stack.Config.MiniConfig instance Stack.Types.Runner.HasRunner Stack.Config.MiniConfig instance RIO.Prelude.Logger.HasLogFunc Stack.Config.MiniConfig -- | Run commands in a nix-shell module Stack.Nix -- | If Nix is enabled, re-runs the currently running OS command in a Nix -- container. Otherwise, runs the inner action. reexecWithOptionalShell :: HasConfig env => Maybe (Path Abs Dir) -> IO (CompilerVersion 'CVWanted) -> IO () -> RIO env () -- | Command-line argument for "nix" nixCmdName :: String nixHelpOptName :: String instance GHC.Exception.Type.Exception Stack.Nix.StackNixException instance GHC.Show.Show Stack.Nix.StackNixException module Stack.Options.NixParser nixOptsParser :: Bool -> Parser NixOptsMonoid -- | Make changes to project or global configuration. module Stack.ConfigCmd data ConfigCmdSet ConfigCmdSetResolver :: AbstractResolver -> ConfigCmdSet ConfigCmdSetSystemGhc :: CommandScope -> Bool -> ConfigCmdSet ConfigCmdSetInstallGhc :: CommandScope -> Bool -> ConfigCmdSet configCmdSetParser :: Parser ConfigCmdSet cfgCmdSet :: (HasConfig env, HasGHCVariant env) => GlobalOpts -> ConfigCmdSet -> RIO env () cfgCmdSetName :: String cfgCmdName :: String -- | Clean a project. module Stack.Clean -- | Deletes build artifacts in the current project. -- -- Throws StackCleanException. clean :: HasEnvConfig env => CleanOpts -> RIO env () -- | Options for stack clean. data CleanOpts -- | Delete the "dist directories" as defined in distRelativeDir for -- the given local packages. If no packages are given, all project -- packages should be cleaned. CleanShallow :: [PackageName] -> CleanOpts -- | Delete all work directories in the project. CleanFull :: CleanOpts -- | Exceptions during cleanup. newtype StackCleanException NonLocalPackages :: [PackageName] -> StackCleanException instance GHC.Show.Show Stack.Clean.StackCleanException instance GHC.Exception.Type.Exception Stack.Clean.StackCleanException module Stack.Options.CleanParser -- | Command-line parser for the clean command. cleanOptsParser :: Parser CleanOpts -- | Parsing command line targets -- -- There are two relevant data sources for performing this parsing: the -- project configuration, and command line arguments. Project -- configurations includes the resolver (defining a LoadedSnapshot of -- global and snapshot packages), local dependencies, and project -- packages. It also defines local flag overrides. -- -- The command line arguments specify both additional local flag -- overrides and targets in their raw form. -- -- Flags are simple: we just combine CLI flags with config flags and make -- one big map of flags, preferring CLI flags when present. -- -- Raw targets can be a package name, a package name with component, just -- a component, or a package name and version number. We first must -- resolve these raw targets into both simple targets and additional -- dependencies. This works as follows: -- -- -- -- If in either of the last two bullets we added a package to local deps, -- print a warning to the user recommending modifying the extra-deps. -- -- Combine the various ResolveResultss together into -- Target values, by combining various components for a single -- package and ensuring that no conflicting statements were made about -- targets. -- -- At this point, we now have a Map from package name to SimpleTarget, -- and an updated Map of local dependencies. We still have the aggregated -- flags, and the snapshot and project packages. -- -- Finally, we upgrade the snapshot by using calculatePackagePromotion. module Stack.Build.Target -- | How a package is intended to be built data Target -- | Build all of the default components. TargetAll :: !PackageType -> Target -- | Only build specific components TargetComps :: !Set NamedComponent -> Target -- | Do we need any targets? For example, `stack build` will fail if no -- targets are provided. data NeedTargets NeedTargets :: NeedTargets AllowNoTargets :: NeedTargets data PackageType ProjectPackage :: PackageType Dependency :: PackageType parseTargets :: HasEnvConfig env => NeedTargets -> BuildOptsCLI -> RIO env (LoadedSnapshot, Map PackageName (LoadedPackageInfo (PackageLocationIndex FilePath)), Map PackageName Target) gpdVersion :: GenericPackageDescription -> Version -- | If this function returns Nothing, the input should be treated -- as a directory. parseRawTarget :: Text -> Maybe RawTarget -- | Raw command line input, without checking against any databases or list -- of locals. Does not deal with directories data RawTarget RTPackageComponent :: !PackageName -> !UnresolvedComponent -> RawTarget RTComponent :: !ComponentName -> RawTarget RTPackage :: !PackageName -> RawTarget RTPackageIdentifier :: !PackageIdentifier -> RawTarget -- | Either a fully resolved component, or a component name that could be -- either an executable, test, or benchmark data UnresolvedComponent ResolvedComponent :: !NamedComponent -> UnresolvedComponent UnresolvedComponent :: !ComponentName -> UnresolvedComponent instance GHC.Show.Show Stack.Build.Target.PackageType instance GHC.Classes.Eq Stack.Build.Target.PackageType instance GHC.Classes.Eq Stack.Build.Target.RawTarget instance GHC.Show.Show Stack.Build.Target.RawTarget instance GHC.Classes.Ord Stack.Build.Target.UnresolvedComponent instance GHC.Classes.Eq Stack.Build.Target.UnresolvedComponent instance GHC.Show.Show Stack.Build.Target.UnresolvedComponent -- | Functions for IDEs. module Stack.IDE -- | List the packages inside the current project. listPackages :: HasEnvConfig env => RIO env () -- | List the targets in the current project. listTargets :: HasEnvConfig env => RIO env () -- | Generate HPC (Haskell Program Coverage) reports module Stack.Coverage -- | Invoked at the beginning of running with "--coverage" deleteHpcReports :: HasEnvConfig env => RIO env () -- | Move a tix file into a sub-directory of the hpc report directory. -- Deletes the old one if one is present. updateTixFile :: HasEnvConfig env => PackageName -> Path Abs File -> String -> RIO env () -- | Generates the HTML coverage report and shows a textual coverage -- summary for a package. generateHpcReport :: HasEnvConfig env => Path Abs Dir -> Package -> [Text] -> RIO env () data HpcReportOpts HpcReportOpts :: [Text] -> Bool -> Maybe String -> Bool -> HpcReportOpts [hroptsInputs] :: HpcReportOpts -> [Text] [hroptsAll] :: HpcReportOpts -> Bool [hroptsDestDir] :: HpcReportOpts -> Maybe String [hroptsOpenBrowser] :: HpcReportOpts -> Bool generateHpcReportForTargets :: HasEnvConfig env => HpcReportOpts -> RIO env () generateHpcUnifiedReport :: HasEnvConfig env => RIO env () generateHpcMarkupIndex :: HasEnvConfig env => RIO env () instance GHC.Show.Show Stack.Coverage.HpcReportOpts -- | Resolving a build plan for a set of packages in a given Stackage -- snapshot. module Stack.BuildPlan data BuildPlanException UnknownPackages :: Path Abs File -> Map PackageName (Maybe Version, Set PackageName) -> Map PackageName (Set PackageIdentifier) -> BuildPlanException SnapshotNotFound :: SnapName -> BuildPlanException NeitherCompilerOrResolverSpecified :: Text -> BuildPlanException data BuildPlanCheck BuildPlanCheckOk :: Map PackageName (Map FlagName Bool) -> BuildPlanCheck BuildPlanCheckPartial :: Map PackageName (Map FlagName Bool) -> DepErrors -> BuildPlanCheck BuildPlanCheckFail :: Map PackageName (Map FlagName Bool) -> DepErrors -> CompilerVersion 'CVActual -> BuildPlanCheck -- | Check a set of GenericPackageDescriptions and a set of flags -- against a given snapshot. Returns how well the snapshot satisfies the -- dependencies of the packages. checkSnapBuildPlan :: (HasConfig env, HasGHCVariant env) => Path Abs Dir -> [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> SnapshotDef -> Maybe (CompilerVersion 'CVActual) -> RIO env BuildPlanCheck data DepError DepError :: !Maybe Version -> !Map PackageName VersionRange -> DepError [deVersion] :: DepError -> !Maybe Version [deNeededBy] :: DepError -> !Map PackageName VersionRange type DepErrors = Map PackageName DepError gpdPackageDeps :: GenericPackageDescription -> CompilerVersion 'CVActual -> Platform -> Map FlagName Bool -> Map PackageName VersionRange gpdPackages :: [GenericPackageDescription] -> Map PackageName Version removeSrcPkgDefaultFlags :: [GenericPackageDescription] -> Map PackageName (Map FlagName Bool) -> Map PackageName (Map FlagName Bool) -- | Find a snapshot and set of flags that is compatible with and matches -- as best as possible with the given GenericPackageDescriptions. selectBestSnapshot :: (HasConfig env, HasGHCVariant env) => Path Abs Dir -> [GenericPackageDescription] -> NonEmpty SnapName -> RIO env (SnapshotDef, BuildPlanCheck) showItems :: Show a => [a] -> Text instance GHC.Show.Show Stack.BuildPlan.DepError instance GHC.Show.Show Stack.BuildPlan.BuildPlanCheck instance GHC.Exception.Type.Exception Stack.BuildPlan.BuildPlanException instance GHC.Show.Show Stack.BuildPlan.BuildPlanException module Stack.Build.Source -- | Like loadSourceMapFull, but doesn't return values that aren't -- as commonly needed. loadSourceMap :: HasEnvConfig env => NeedTargets -> BuildOptsCLI -> RIO env ([LocalPackage], SourceMap) -- | Given the build commandline options, does the following: -- -- loadSourceMapFull :: HasEnvConfig env => NeedTargets -> BuildOptsCLI -> RIO env (Map PackageName Target, LoadedSnapshot, [LocalPackage], Set PackageName, SourceMap) type SourceMap = Map PackageName PackageSource -- | All flags for a local package. getLocalFlags :: BuildConfig -> BuildOptsCLI -> PackageName -> Map FlagName Bool -- | Get the configured options to pass from GHC, based on the build -- configuration and commandline. getGhcOptions :: BuildConfig -> BuildOptsCLI -> PackageName -> Bool -> Bool -> [Text] -- | Returns entries to add to the build cache for any newly found unlisted -- modules addUnlistedToBuildCache :: HasEnvConfig env => ModTime -> Package -> Path Abs File -> Set NamedComponent -> Map NamedComponent (Map FilePath a) -> RIO env (Map NamedComponent [Map FilePath FileCacheInfo], [PackageWarning]) -- | Construct a Plan for how to build module Stack.Build.ConstructPlan -- | Computes a build plan. This means figuring out which build -- Tasks to take, and the interdependencies among the build -- Tasks. In particular: -- -- 1) It determines which packages need to be built, based on the -- transitive deps of the current targets. For local packages, this is -- indicated by the lpWanted boolean. For extra packages to build, -- this comes from the extraToBuild0 argument of type Set -- PackageName. These are usually packages that have been specified -- on the commandline. -- -- 2) It will only rebuild an upstream package if it isn't present in the -- InstalledMap, or if some of its dependencies have changed. -- -- 3) It will only rebuild a local package if its files are dirty or some -- of its dependencies have changed. constructPlan :: forall env. HasEnvConfig env => LoadedSnapshot -> BaseConfigOpts -> [LocalPackage] -> Set PackageName -> [DumpPackage () () ()] -> (PackageLocationIndex FilePath -> Map FlagName Bool -> [Text] -> RIO EnvConfig Package) -> SourceMap -> InstalledMap -> Bool -> RIO env Plan instance GHC.Show.Show Stack.Build.ConstructPlan.DepsPath instance GHC.Classes.Ord Stack.Build.ConstructPlan.DepsPath instance GHC.Classes.Eq Stack.Build.ConstructPlan.DepsPath instance GHC.Generics.Generic Stack.Build.ConstructPlan.W instance GHC.Show.Show Stack.Build.ConstructPlan.ConstructPlanException instance GHC.Classes.Ord Stack.Build.ConstructPlan.ConstructPlanException instance GHC.Classes.Eq Stack.Build.ConstructPlan.ConstructPlanException instance GHC.Show.Show Stack.Build.ConstructPlan.BadDependency instance GHC.Classes.Ord Stack.Build.ConstructPlan.BadDependency instance GHC.Classes.Eq Stack.Build.ConstructPlan.BadDependency instance GHC.Show.Show Stack.Build.ConstructPlan.ToolWarning instance GHC.Show.Show Stack.Build.ConstructPlan.AddDepRes instance GHC.Show.Show Stack.Build.ConstructPlan.PackageInfo instance GHC.Classes.Ord Distribution.Types.VersionRange.VersionRange instance Stack.Types.Config.HasPlatform Stack.Build.ConstructPlan.Ctx instance Stack.Types.Config.HasGHCVariant Stack.Build.ConstructPlan.Ctx instance RIO.Prelude.Logger.HasLogFunc Stack.Build.ConstructPlan.Ctx instance Stack.Types.Runner.HasRunner Stack.Build.ConstructPlan.Ctx instance Stack.Types.Config.HasConfig Stack.Build.ConstructPlan.Ctx instance Stack.PackageIndex.HasCabalLoader Stack.Build.ConstructPlan.Ctx instance RIO.Process.HasProcessContext Stack.Build.ConstructPlan.Ctx instance Stack.Types.Config.HasBuildConfig Stack.Build.ConstructPlan.Ctx instance Stack.Types.Config.HasEnvConfig Stack.Build.ConstructPlan.Ctx instance GHC.Base.Semigroup Stack.Build.ConstructPlan.W instance GHC.Base.Monoid Stack.Build.ConstructPlan.W -- | Perform a build module Stack.Build.Execute -- | Print a description of build plan for human consumption. printPlan :: HasRunner env => Plan -> RIO env () -- | Fetch the packages necessary for a build, for example in combination -- with a dry run. preFetch :: HasEnvConfig env => Plan -> RIO env () -- | Perform the actual plan executePlan :: HasEnvConfig env => BuildOptsCLI -> BaseConfigOpts -> [LocalPackage] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> InstalledMap -> Map PackageName Target -> Plan -> RIO env () data ExecuteEnv -- | Execute a function that takes an ExecuteEnv. withExecuteEnv :: forall env a. HasEnvConfig env => BuildOpts -> BuildOptsCLI -> BaseConfigOpts -> [LocalPackage] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> [DumpPackage () () ()] -> (ExecuteEnv -> RIO env a) -> RIO env a -- | This sets up a context for executing build steps which need to run -- Cabal (via a compiled Setup.hs). In particular it does the following: -- -- withSingleContext :: forall env a. HasEnvConfig env => ActionContext -> ExecuteEnv -> Task -> Maybe (Map PackageIdentifier GhcPkgId) -> Maybe String -> (Package -> Path Abs File -> Path Abs Dir -> (ExcludeTHLoading -> [String] -> RIO env ()) -> (Text -> RIO env ()) -> OutputType -> RIO env a) -> RIO env a data ExcludeTHLoading ExcludeTHLoading :: ExcludeTHLoading KeepTHLoading :: ExcludeTHLoading instance GHC.Classes.Ord Stack.Build.Execute.ExecutableBuildStatus instance GHC.Classes.Eq Stack.Build.Execute.ExecutableBuildStatus instance GHC.Show.Show Stack.Build.Execute.ExecutableBuildStatus -- | Build the project. module Stack.Build -- | Build. -- -- If a buildLock is passed there is an important contract here. That -- lock must protect the snapshot, and it must be safe to unlock it if -- there are no further modifications to the snapshot to be performed by -- this build. build :: HasEnvConfig env => (Set (Path Abs File) -> IO ()) -> Maybe FileLock -> BuildOptsCLI -> RIO env () -- | Provide a function for loading package information from the package -- index loadPackage :: HasEnvConfig env => PackageLocationIndex FilePath -> Map FlagName Bool -> [Text] -> RIO env Package -- | Get the BaseConfigOpts necessary for constructing configure -- options mkBaseConfigOpts :: (MonadIO m, MonadReader env m, HasEnvConfig env, MonadThrow m) => BuildOptsCLI -> m BaseConfigOpts -- | Query information about the build and print the result to stdout in -- YAML format. queryBuildInfo :: HasEnvConfig env => [Text] -> RIO env () splitObjsWarning :: String newtype CabalVersionException CabalVersionException :: String -> CabalVersionException [unCabalVersionException] :: CabalVersionException -> String instance GHC.Show.Show Stack.Build.CabalVersionException instance GHC.Exception.Type.Exception Stack.Build.CabalVersionException module Stack.Setup -- | Modify the environment variables (like PATH) appropriately, possibly -- doing installation too setupEnv :: (HasBuildConfig env, HasGHCVariant env) => Maybe Text -> RIO env EnvConfig -- | Ensure compiler (ghc or ghcjs) is installed and provide the PATHs to -- add if necessary ensureCompiler :: (HasConfig env, HasGHCVariant env) => SetupOpts -> RIO env (Maybe ExtraDirs, CompilerBuild, Bool) -- | Ensure Docker container-compatible stack executable is -- downloaded ensureDockerStackExe :: HasConfig env => Platform -> RIO env (Path Abs File) -- | Get the version of the system compiler, if available getSystemCompiler :: (HasProcessContext env, HasLogFunc env) => WhichCompiler -> RIO env (Maybe (CompilerVersion 'CVActual, Arch)) getCabalInstallVersion :: (HasProcessContext env, HasLogFunc env) => RIO env (Maybe Version) data SetupOpts SetupOpts :: !Bool -> !Bool -> !CompilerVersion 'CVWanted -> !VersionCheck -> !Maybe (Path Abs File) -> !Bool -> !Bool -> !Bool -> !Bool -> !Maybe UpgradeTo -> !Maybe Text -> !FilePath -> !Maybe String -> [String] -> SetupOpts [soptsInstallIfMissing] :: SetupOpts -> !Bool -- | Should we use a system compiler installation, if available? [soptsUseSystem] :: SetupOpts -> !Bool [soptsWantedCompiler] :: SetupOpts -> !CompilerVersion 'CVWanted [soptsCompilerCheck] :: SetupOpts -> !VersionCheck -- | If we got the desired GHC version from that file [soptsStackYaml] :: SetupOpts -> !Maybe (Path Abs File) [soptsForceReinstall] :: SetupOpts -> !Bool -- | Run a sanity check on the selected GHC [soptsSanityCheck] :: SetupOpts -> !Bool -- | Don't check for a compatible GHC version/architecture [soptsSkipGhcCheck] :: SetupOpts -> !Bool -- | Do not use a custom msys installation on Windows [soptsSkipMsys] :: SetupOpts -> !Bool -- | Upgrade the global Cabal library in the database to the newest -- version. Only works reliably with a stack-managed installation. [soptsUpgradeCabal] :: SetupOpts -> !Maybe UpgradeTo -- | Message shown to user for how to resolve the missing GHC [soptsResolveMissingGHC] :: SetupOpts -> !Maybe Text -- | Location of the main stack-setup.yaml file [soptsSetupInfoYaml] :: SetupOpts -> !FilePath -- | Alternate GHC binary distribution (requires custom GHCVariant) [soptsGHCBindistURL] :: SetupOpts -> !Maybe String -- | Additional ghcjs-boot options, the default is "--clean" [soptsGHCJSBootOpts] :: SetupOpts -> [String] -- | Default location of the stack-setup.yaml file defaultSetupInfoYaml :: String removeHaskellEnvVars :: Map Text Text -> Map Text Text data StackReleaseInfo getDownloadVersion :: StackReleaseInfo -> Maybe Version -- | Current Stack version stackVersion :: Version preferredPlatforms :: (MonadReader env m, HasPlatform env, MonadThrow m) => m [(Bool, String)] downloadStackReleaseInfo :: (MonadIO m, MonadThrow m) => Maybe String -> Maybe String -> Maybe String -> m StackReleaseInfo downloadStackExe :: HasConfig env => [(Bool, String)] -> StackReleaseInfo -> Path Abs Dir -> Bool -> (Path Abs File -> IO ()) -> RIO env () instance GHC.Base.Functor (Stack.Setup.CheckDependency env) instance GHC.Show.Show Stack.Setup.SetupOpts instance GHC.Base.Applicative (Stack.Setup.CheckDependency env) instance GHC.Base.Alternative (Stack.Setup.CheckDependency env) instance GHC.Exception.Type.Exception Stack.Setup.SetupException instance GHC.Show.Show Stack.Setup.SetupException module Stack.Upgrade upgrade :: HasConfig env => ConfigMonoid -> Maybe AbstractResolver -> Maybe String -> UpgradeOpts -> RIO env () data UpgradeOpts upgradeOpts :: Parser UpgradeOpts instance GHC.Show.Show Stack.Upgrade.UpgradeOpts instance GHC.Show.Show Stack.Upgrade.SourceOpts instance GHC.Show.Show Stack.Upgrade.BinaryOpts module Stack.Solver -- | Perform some basic checks on a list of cabal files to be used for -- creating stack config. It checks for duplicate package names, package -- name and cabal file name mismatch and reports any issues related to -- those. -- -- If no error occurs it returns filepath and -- GenericPackageDescriptions pairs as well as any filenames for -- duplicate packages not included in the pairs. cabalPackagesCheck :: (HasConfig env, HasGHCVariant env) => [Path Abs Dir] -> String -> Maybe String -> RIO env (Map PackageName (Path Abs File, GenericPackageDescription), [Path Abs File]) -- | Finds all directories with a .cabal file or an hpack package.yaml. -- Subdirectories can be included depending on the recurse -- parameter. findCabalDirs :: HasConfig env => Bool -> Path Abs Dir -> RIO env (Set (Path Abs Dir)) -- | Given a resolver (snpashot, compiler or custom resolver) return the -- compiler version, package versions and packages flags for that -- resolver. getResolverConstraints :: (HasConfig env, HasGHCVariant env) => Maybe (CompilerVersion 'CVActual) -> Path Abs File -> SnapshotDef -> RIO env (CompilerVersion 'CVActual, Map PackageName (Version, Map FlagName Bool)) -- | Merge two separate maps, one defining constraints on package versions -- and the other defining package flagmap, into a single map of version -- and flagmap tuples. mergeConstraints :: Map PackageName v -> Map PackageName (Map p f) -> Map PackageName (v, Map p f) -- | Verify the combination of resolver, package flags and extra -- dependencies in an existing stack.yaml and suggest changes in flags or -- extra dependencies so that the specified packages can be compiled. solveExtraDeps :: HasEnvConfig env => Bool -> RIO env () -- | Given a resolver, user package constraints (versions and flags) and -- extra dependency constraints determine what extra dependencies are -- required outside the resolver snapshot and the specified extra -- dependencies. -- -- First it tries by using the snapshot and the input extra dependencies -- as hard constraints, if no solution is arrived at by using hard -- constraints it then tries using them as soft constraints or -- preferences. -- -- It returns either conflicting packages when no solution is arrived at -- or the solution in terms of src package flag settings and extra -- dependencies. solveResolverSpec :: (HasConfig env, HasGHCVariant env) => Path Abs File -> [Path Abs Dir] -> (SnapshotDef, ConstraintSpec, ConstraintSpec) -> RIO env (Either [PackageName] (ConstraintSpec, ConstraintSpec)) -- | Same as checkSnapBuildPLan, but set up a real GHC if needed. -- -- If we're using a Stackage snapshot, we can use the snapshot hints to -- determine global library information. This will not be available for -- custom and GHC resolvers, however. Therefore, we insist that it be -- installed first. Fortunately, the standard `stack solver` behavior -- only chooses Stackage snapshots, so the common case will not force the -- installation of a bunch of GHC versions. checkSnapBuildPlanActual :: (HasConfig env, HasGHCVariant env) => Path Abs Dir -> [GenericPackageDescription] -> Maybe (Map PackageName (Map FlagName Bool)) -> SnapshotDef -> RIO env BuildPlanCheck parseCabalOutputLine :: Text -> Either Text (PackageName, (Version, Map FlagName Bool)) instance GHC.Classes.Eq Stack.Solver.ConstraintType module Stack.Init -- | Generate stack.yaml initProject :: (HasConfig env, HasGHCVariant env) => WhichSolverCmd -> Path Abs Dir -> InitOpts -> Maybe AbstractResolver -> RIO env () data InitOpts InitOpts :: ![Text] -> Bool -> Bool -> Bool -> Bool -> InitOpts -- | List of sub directories to search for .cabal files [searchDirs] :: InitOpts -> ![Text] -- | Use solver to determine required external dependencies [useSolver] :: InitOpts -> Bool -- | Exclude conflicting or incompatible user packages [omitPackages] :: InitOpts -> Bool -- | Overwrite existing stack.yaml [forceOverwrite] :: InitOpts -> Bool -- | If True, include all .cabal files found in any sub directories [includeSubDirs] :: InitOpts -> Bool -- | Install GHC/GHCJS and Cabal. module Stack.SetupCmd setup :: (HasConfig env, HasGHCVariant env) => SetupCmdOpts -> CompilerVersion 'CVWanted -> VersionCheck -> Maybe (Path Abs File) -> RIO env () setupParser :: Parser SetupCmdOpts data SetupCmdOpts SetupCmdOpts :: !Maybe (CompilerVersion 'CVWanted) -> !Bool -> !Maybe UpgradeTo -> !String -> !Maybe String -> ![String] -> !Bool -> SetupCmdOpts [scoCompilerVersion] :: SetupCmdOpts -> !Maybe (CompilerVersion 'CVWanted) [scoForceReinstall] :: SetupCmdOpts -> !Bool [scoUpgradeCabal] :: SetupCmdOpts -> !Maybe UpgradeTo [scoSetupInfoYaml] :: SetupCmdOpts -> !String [scoGHCBindistURL] :: SetupCmdOpts -> !Maybe String [scoGHCJSBootOpts] :: SetupCmdOpts -> ![String] [scoGHCJSBootClean] :: SetupCmdOpts -> !Bool -- | Run commands in Docker containers module Stack.Docker -- | Clean-up old docker images and containers. cleanup :: HasConfig env => CleanupOpts -> RIO env () -- | Options for cleanup. data CleanupOpts CleanupOpts :: !CleanupAction -> !Maybe Integer -> !Maybe Integer -> !Maybe Integer -> !Maybe Integer -> !Maybe Integer -> CleanupOpts [dcAction] :: CleanupOpts -> !CleanupAction [dcRemoveKnownImagesLastUsedDaysAgo] :: CleanupOpts -> !Maybe Integer [dcRemoveUnknownImagesCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer [dcRemoveDanglingImagesCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer [dcRemoveStoppedContainersCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer [dcRemoveRunningContainersCreatedDaysAgo] :: CleanupOpts -> !Maybe Integer -- | Cleanup action. data CleanupAction CleanupInteractive :: CleanupAction CleanupImmediate :: CleanupAction CleanupDryRun :: CleanupAction -- | Command-line argument for docker cleanup. dockerCleanupCmdName :: String -- | Command-line argument for "docker" dockerCmdName :: String dockerHelpOptName :: String -- | Command-line argument for docker pull. dockerPullCmdName :: String -- | The Docker container "entrypoint": special actions performed when -- first entering a container, such as switching the UID/GID to the -- "outside-Docker" user's. entrypoint :: (HasProcessContext env, HasLogFunc env) => Config -> DockerEntrypoint -> RIO env () -- | Error if running in a container. preventInContainer :: MonadIO m => m () -> m () -- | Pull latest version of configured Docker image from registry. pull :: HasConfig env => RIO env () -- | If Docker is enabled, re-runs the currently running OS command in a -- Docker container. Otherwise, runs the inner action. -- -- This takes an optional release action which should be taken IFF -- control is transferring away from the current process to the -- intra-container one. The main use for this is releasing a lock. After -- launching reexecution, the host process becomes nothing but an manager -- for the call into docker and thus may not hold the lock. reexecWithOptionalContainer :: HasConfig env => Maybe (Path Abs Dir) -> Maybe (RIO env ()) -> IO () -> Maybe (RIO env ()) -> Maybe (RIO env ()) -> RIO env () -- | Remove the project's Docker sandbox. reset :: (MonadIO m, MonadReader env m, HasConfig env) => Maybe (Path Abs Dir) -> Bool -> m () -- | Command-line option for --internal-re-exec-version. reExecArgName :: String -- | Exceptions thrown by Stack.Docker. data StackDockerException -- | Docker must be enabled to use the command. DockerMustBeEnabledException :: StackDockerException -- | Command must be run on host OS (not in a container). OnlyOnHostException :: StackDockerException -- | docker inspect failed. InspectFailedException :: String -> StackDockerException -- | Image does not exist. NotPulledException :: String -> StackDockerException -- | Input to docker cleanup has invalid command. InvalidCleanupCommandException :: String -> StackDockerException -- | Invalid output from docker images. InvalidImagesOutputException :: String -> StackDockerException -- | Invalid output from docker ps. InvalidPSOutputException :: String -> StackDockerException -- | Invalid output from docker inspect. InvalidInspectOutputException :: String -> StackDockerException -- | Could not pull a Docker image. PullFailedException :: String -> StackDockerException -- | Installed version of docker below minimum version. DockerTooOldException :: Version -> Version -> StackDockerException -- | Installed version of docker is prohibited. DockerVersionProhibitedException :: [Version] -> Version -> StackDockerException -- | Installed version of docker is out of range specified in -- config file. BadDockerVersionException :: VersionRange -> Version -> StackDockerException -- | Invalid output from docker --version. InvalidVersionOutputException :: StackDockerException -- | Version of stack on host is too old for version in image. HostStackTooOldException :: Version -> Maybe Version -> StackDockerException -- | Version of stack in container/image is too old for version on -- host. ContainerStackTooOldException :: Version -> Version -> StackDockerException -- | Can't determine the project root (where to put docker sandbox). CannotDetermineProjectRootException :: StackDockerException -- | docker --version failed. DockerNotInstalledException :: StackDockerException -- | Using host stack-exe on unsupported platform. UnsupportedStackExeHostPlatformException :: StackDockerException -- | stack-exe option fails to parse. DockerStackExeParseException :: String -> StackDockerException instance GHC.Show.Show Stack.Docker.Inspect instance GHC.Show.Show Stack.Docker.ImageConfig instance GHC.Show.Show Stack.Docker.CleanupOpts instance GHC.Show.Show Stack.Docker.CleanupAction instance Data.Aeson.Types.FromJSON.FromJSON Stack.Docker.Inspect instance Data.Aeson.Types.FromJSON.FromJSON Stack.Docker.ImageConfig module Stack.Options.DockerParser -- | Options parser configuration for Docker. dockerOptsParser :: Bool -> Parser DockerOptsMonoid -- | Parser for docker cleanup arguments. dockerCleanupOptsParser :: Parser CleanupOpts module Stack.SDist -- | Given the path to a local package, creates its source distribution -- tarball. -- -- While this yields a FilePath, the name of the tarball, this -- tarball is not written to the disk and instead yielded as a lazy -- bytestring. getSDistTarball :: HasEnvConfig env => Maybe PvpBounds -> Path Abs Dir -> RIO env (FilePath, ByteString, Maybe (PackageIdentifier, ByteString)) -- | Check package in given tarball. This will log all warnings and will -- throw an exception in case of critical errors. -- -- Note that we temporarily decompress the archive to analyze it. checkSDistTarball :: HasEnvConfig env => SDistOpts -> Path Abs File -> RIO env () -- | Version of checkSDistTarball that first saves lazy bytestring -- to temporary directory and then calls checkSDistTarball on it. checkSDistTarball' :: HasEnvConfig env => SDistOpts -> String -> ByteString -> RIO env () -- | Special exception to throw when you want to fail because of bad -- results of package check. data SDistOpts SDistOpts :: [String] -> Maybe PvpBounds -> Bool -> Bool -> String -> Bool -> Maybe FilePath -> SDistOpts -- | Directories to package [sdoptsDirsToWorkWith] :: SDistOpts -> [String] -- | PVP Bounds overrides [sdoptsPvpBounds] :: SDistOpts -> Maybe PvpBounds -- | Whether to ignore check of the package for common errors [sdoptsIgnoreCheck] :: SDistOpts -> Bool -- | Whether to sign the package [sdoptsSign] :: SDistOpts -> Bool -- | The URL of the signature server [sdoptsSignServerUrl] :: SDistOpts -> String -- | Whether to build the tarball [sdoptsBuildTarball] :: SDistOpts -> Bool -- | Where to copy the tarball [sdoptsTarPath] :: SDistOpts -> Maybe FilePath instance GHC.Exception.Type.Exception Stack.SDist.CheckException instance GHC.Show.Show Stack.SDist.CheckException module Stack.Options.BuildMonoidParser buildOptsMonoidParser :: GlobalOptsContext -> Parser BuildOptsMonoid module Stack.Options.ConfigParser -- | Command-line arguments parser for configuration. configOptsParser :: FilePath -> GlobalOptsContext -> Parser ConfigMonoid module Stack.Options.GlobalParser -- | Parser for global command-line options. globalOptsParser :: FilePath -> GlobalOptsContext -> Maybe LogLevel -> Parser GlobalOptsMonoid -- | Create GlobalOpts from GlobalOptsMonoid. globalOptsFromMonoid :: Bool -> ColorWhen -> GlobalOptsMonoid -> GlobalOpts initOptsParser :: Parser InitOpts module Stack.Options.NewParser -- | Parser for stack new. newOptsParser :: Parser (NewOpts, InitOpts) -- | Run a GHCi configured with the user's package(s). module Stack.Ghci -- | Command-line options for GHC. data GhciOpts GhciOpts :: ![Text] -> ![String] -> ![Text] -> !Map (Maybe PackageName) (Map FlagName Bool) -> !Maybe FilePath -> !Bool -> ![String] -> !Maybe Text -> !Bool -> !Bool -> !Maybe Bool -> !Bool -> !Bool -> GhciOpts [ghciTargets] :: GhciOpts -> ![Text] [ghciArgs] :: GhciOpts -> ![String] [ghciGhcOptions] :: GhciOpts -> ![Text] [ghciFlags] :: GhciOpts -> !Map (Maybe PackageName) (Map FlagName Bool) [ghciGhcCommand] :: GhciOpts -> !Maybe FilePath [ghciNoLoadModules] :: GhciOpts -> !Bool [ghciAdditionalPackages] :: GhciOpts -> ![String] [ghciMainIs] :: GhciOpts -> !Maybe Text [ghciLoadLocalDeps] :: GhciOpts -> !Bool [ghciSkipIntermediate] :: GhciOpts -> !Bool [ghciHidePackages] :: GhciOpts -> !Maybe Bool [ghciNoBuild] :: GhciOpts -> !Bool [ghciOnlyMain] :: GhciOpts -> !Bool -- | Necessary information to load a package or its components. data GhciPkgInfo GhciPkgInfo :: !PackageName -> ![(NamedComponent, BuildInfoOpts)] -> !Path Abs Dir -> !ModuleMap -> !Set (Path Abs File) -> !Map NamedComponent (Set (Path Abs File)) -> !Maybe (Set (Path Abs File)) -> !Package -> GhciPkgInfo [ghciPkgName] :: GhciPkgInfo -> !PackageName [ghciPkgOpts] :: GhciPkgInfo -> ![(NamedComponent, BuildInfoOpts)] [ghciPkgDir] :: GhciPkgInfo -> !Path Abs Dir [ghciPkgModules] :: GhciPkgInfo -> !ModuleMap -- | C files. [ghciPkgCFiles] :: GhciPkgInfo -> !Set (Path Abs File) [ghciPkgMainIs] :: GhciPkgInfo -> !Map NamedComponent (Set (Path Abs File)) [ghciPkgTargetFiles] :: GhciPkgInfo -> !Maybe (Set (Path Abs File)) [ghciPkgPackage] :: GhciPkgInfo -> !Package data GhciException InvalidPackageOption :: String -> GhciException LoadingDuplicateModules :: GhciException MissingFileTarget :: String -> GhciException Can'tSpecifyFilesAndTargets :: GhciException Can'tSpecifyFilesAndMainIs :: GhciException GhciTargetParseException :: [Text] -> GhciException -- | Launch a GHCi session for the given local package targets with the -- given options and configure it with the load paths and extensions of -- those targets. ghci :: HasEnvConfig env => GhciOpts -> RIO env () instance GHC.Show.Show Stack.Ghci.GhciPkgInfo instance GHC.Show.Show Stack.Ghci.GhciOpts instance GHC.Exception.Type.Exception Stack.Ghci.GhciException instance GHC.Show.Show Stack.Ghci.GhciException module Stack.Dot -- | Visualize the project's dependencies as a graphviz graph dot :: HasEnvConfig env => DotOpts -> RIO env () listDependencies :: HasEnvConfig env => ListDepsOpts -> RIO env () -- | Options record for stack dot data DotOpts DotOpts :: !Bool -> !Bool -> !Maybe Int -> !Set String -> [Text] -> !Map (Maybe PackageName) (Map FlagName Bool) -> Bool -> Bool -> DotOpts -- | Include external dependencies [dotIncludeExternal] :: DotOpts -> !Bool -- | Include dependencies on base [dotIncludeBase] :: DotOpts -> !Bool -- | Limit the depth of dependency resolution to (Just n) or continue until -- fixpoint [dotDependencyDepth] :: DotOpts -> !Maybe Int -- | Package names to prune from the graph [dotPrune] :: DotOpts -> !Set String -- | stack TARGETs to trace dependencies for [dotTargets] :: DotOpts -> [Text] -- | Flags to apply when calculating dependencies [dotFlags] :: DotOpts -> !Map (Maybe PackageName) (Map FlagName Bool) -- | Like the "--test" flag for build, affects the meaning of -- dotTargets. [dotTestTargets] :: DotOpts -> Bool -- | Like the "--bench" flag for build, affects the meaning of -- dotTargets. [dotBenchTargets] :: DotOpts -> Bool -- | Information about a package in the dependency graph, when available. data DotPayload DotPayload :: Maybe Version -> Maybe (Either License License) -> DotPayload -- | The package version. [payloadVersion] :: DotPayload -> Maybe Version -- | The license the package was released under. [payloadLicense] :: DotPayload -> Maybe (Either License License) data ListDepsOpts ListDepsOpts :: !DotOpts -> !Text -> !Bool -> ListDepsOpts -- | The normal dot options. [listDepsDotOpts] :: ListDepsOpts -> !DotOpts -- | Separator between the package name and details. [listDepsSep] :: ListDepsOpts -> !Text -- | Print dependency licenses instead of versions. [listDepsLicense] :: ListDepsOpts -> !Bool -- | Resolve the dependency graph up to (Just depth) or until fixpoint is -- reached resolveDependencies :: (Applicative m, Monad m) => Maybe Int -> Map PackageName (Set PackageName, DotPayload) -> (PackageName -> m (Set PackageName, DotPayload)) -> m (Map PackageName (Set PackageName, DotPayload)) -- | Print a graphviz graph of the edges in the Map and highlight the given -- local packages printGraph :: (Applicative m, MonadIO m) => DotOpts -> Set PackageName -> Map PackageName (Set PackageName, DotPayload) -> m () -- | pruneGraph dontPrune toPrune graph prunes all packages in -- graph with a name in toPrune and removes resulting -- orphans unless they are in dontPrune pruneGraph :: (Foldable f, Foldable g, Eq a) => f PackageName -> g String -> Map PackageName (Set PackageName, a) -> Map PackageName (Set PackageName, a) instance GHC.Show.Show Stack.Dot.DotPayload instance GHC.Classes.Eq Stack.Dot.DotPayload -- | Utilities for running stack commands. module Stack.Runners -- | Loads global config, ignoring any configuration which would be loaded -- due to $PWD. withGlobalConfigAndLock :: GlobalOpts -> RIO Config () -> IO () withConfigAndLock :: GlobalOpts -> RIO Config () -> IO () withMiniConfigAndLock :: GlobalOpts -> RIO MiniConfig () -> IO () withBuildConfigAndLock :: GlobalOpts -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () -- | See issue #2010 for why this exists. Currently just used for the -- specific case of "stack clean --full". withBuildConfigAndLockNoDocker :: GlobalOpts -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfig :: GlobalOpts -> RIO EnvConfig () -> IO () withBuildConfigExt :: Bool -> GlobalOpts -> Maybe (RIO Config ()) -> (Maybe FileLock -> RIO EnvConfig ()) -> Maybe (RIO Config ()) -> IO () withBuildConfigDot :: DotOpts -> GlobalOpts -> RIO EnvConfig () -> IO () -- | Load the configuration. Convenience function used throughout this -- module. loadConfigWithOpts :: GlobalOpts -> (LoadConfig -> IO a) -> IO a loadCompilerVersion :: GlobalOpts -> LoadConfig -> IO (CompilerVersion 'CVWanted) -- | Enforce mutual exclusion of every action running via this function, on -- this path, on this users account. -- -- A lock file is created inside the given directory. Currently, stack -- uses locks per-snapshot. In the future, stack may refine this to an -- even more fine-grain locking approach. withUserFileLock :: MonadUnliftIO m => GlobalOpts -> Path Abs Dir -> (Maybe FileLock -> m a) -> m a -- | Unlock a lock file, if the value is Just munlockFile :: MonadIO m => Maybe FileLock -> m () module Stack.Options.Completion ghcOptsCompleter :: Completer targetCompleter :: Completer flagCompleter :: Completer projectExeCompleter :: Completer module Stack.Options.ScriptParser data ScriptOpts ScriptOpts :: ![String] -> !FilePath -> ![String] -> !ScriptExecute -> ![String] -> ScriptOpts [soPackages] :: ScriptOpts -> ![String] [soFile] :: ScriptOpts -> !FilePath [soArgs] :: ScriptOpts -> ![String] [soCompile] :: ScriptOpts -> !ScriptExecute [soGhcOptions] :: ScriptOpts -> ![String] data ScriptExecute SEInterpret :: ScriptExecute SECompile :: ScriptExecute SEOptimize :: ScriptExecute scriptOptsParser :: Parser ScriptOpts instance GHC.Show.Show Stack.Options.ScriptParser.ScriptOpts instance GHC.Show.Show Stack.Options.ScriptParser.ScriptExecute module Stack.Script -- | Run a Stack Script scriptCmd :: ScriptOpts -> GlobalOpts -> IO () module Stack.Options.HpcReportParser -- | Parser for stack hpc report. hpcReportOptsParser :: Parser HpcReportOpts pvpBoundsOption :: Parser PvpBounds module Stack.Options.SDistParser -- | Parser for arguments to `stack sdist` and `stack upload` sdistOptsParser :: Bool -> Parser SDistOpts module Stack.Options.ExecParser -- | Parser for exec command execOptsParser :: Maybe SpecialExecCmd -> Parser ExecOpts evalOptsParser :: String -> Parser EvalOpts -- | Parser for extra options to exec command execOptsExtraParser :: Parser ExecOptsExtra module Stack.Options.BuildParser -- | Parser for CLI-only build arguments buildOptsParser :: BuildCommand -> Parser BuildOptsCLI targetsParser :: Parser [Text] flagsParser :: Parser (Map (Maybe PackageName) (Map FlagName Bool)) module Stack.Options.GhciParser -- | Parser for GHCI options ghciOptsParser :: Parser GhciOpts -- | A wrapper around hoogle. module Stack.Hoogle -- | Hoogle command. hoogleCmd :: ([String], Bool, Bool, Bool) -> GlobalOpts -> IO () module Stack.Options.DotParser -- | Parser for arguments to `stack dot` dotOptsParser :: Bool -> Parser DotOpts -- | Parser for arguments to `stack list-dependencies`. listDepsOptsParser :: Parser ListDepsOpts module Stack.Ls lsCmd :: LsCmdOpts -> GlobalOpts -> IO () lsParser :: Parser LsCmdOpts -- | List the dependencies listDependenciesCmd :: Bool -> ListDepsOpts -> GlobalOpts -> IO () instance GHC.Show.Show Stack.Ls.LsException instance GHC.Classes.Ord Stack.Ls.SnapshotData instance GHC.Classes.Eq Stack.Ls.SnapshotData instance GHC.Show.Show Stack.Ls.SnapshotData instance GHC.Classes.Ord Stack.Ls.Snapshot instance GHC.Classes.Eq Stack.Ls.Snapshot instance GHC.Show.Show Stack.Ls.Snapshot instance GHC.Classes.Ord Stack.Ls.SnapshotOpts instance GHC.Show.Show Stack.Ls.SnapshotOpts instance GHC.Classes.Eq Stack.Ls.SnapshotOpts instance GHC.Classes.Ord Stack.Ls.SnapshotType instance GHC.Classes.Eq Stack.Ls.SnapshotType instance GHC.Show.Show Stack.Ls.SnapshotType instance GHC.Classes.Ord Stack.Ls.LsView instance GHC.Classes.Eq Stack.Ls.LsView instance GHC.Show.Show Stack.Ls.LsView instance GHC.Exception.Type.Exception Stack.Ls.LsException instance Data.Aeson.Types.FromJSON.FromJSON Stack.Ls.SnapshotData instance Data.Aeson.Types.FromJSON.FromJSON Stack.Ls.Snapshot