-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A framework for packaging Haskell software -- -- The Haskell Common Architecture for Building Applications and -- Libraries: a framework defining a common interface for authors to more -- easily build their Haskell applications in a portable way. -- -- The Haskell Cabal is part of a larger infrastructure for distributing, -- organizing, and cataloging Haskell libraries and tools. @package Cabal @version 2.0.0.2 module Distribution.Compat.Binary decodeOrFailIO :: Binary a => ByteString -> IO (Either String a) -- | Lazily reconstruct a value previously written to a file. decodeFileOrFail' :: Binary a => FilePath -> IO (Either String a) module Distribution.Compat.Exception catchIO :: IO a -> (IOException -> IO a) -> IO a catchExit :: IO a -> (ExitCode -> IO a) -> IO a tryIO :: IO a -> IO (Either IOException a) -- | Render this exception value in a human-friendly manner. -- -- Default implementation: show. displayException :: Exception e => e -> String module Distribution.Compat.Map.Strict -- | Compatibility layer for Data.Semigroup module Distribution.Compat.Semigroup -- | The class of semigroups (types with an associative binary operation). class Semigroup a -- | An associative operation. -- --
-- (a <> b) <> c = a <> (b <> c) ---- -- If a is also a Monoid we further require -- --
-- (<>) = mappend --(<>) :: Semigroup a => a -> a -> a -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following laws: -- --
mappend mempty x = x
mappend x mempty = x
mappend x (mappend y z) = mappend (mappend x y) z
mconcat = foldr mappend mempty
-- gmappend a (gmappend b c) = gmappend (gmappend a b) c --gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a -- | Generically generate a Monoid mempty for any -- product-like type implementing Generic. -- -- It is only defined for product types. -- --
-- gmappend gmempty a = a = gmappend a gmempty --gmempty :: (Generic a, GMonoid (Rep a)) => a instance GHC.Generics.Generic (Distribution.Compat.Semigroup.Last' a) instance GHC.Base.Applicative Distribution.Compat.Semigroup.Last' instance GHC.Base.Functor Distribution.Compat.Semigroup.Last' instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Distribution.Compat.Semigroup.Last' a) instance GHC.Show.Show a => GHC.Show.Show (Distribution.Compat.Semigroup.Last' a) instance GHC.Read.Read a => GHC.Read.Read (Distribution.Compat.Semigroup.Last' a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Distribution.Compat.Semigroup.Last' a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Compat.Semigroup.Last' a) instance (Data.Semigroup.Semigroup a, GHC.Base.Monoid a) => Distribution.Compat.Semigroup.GMonoid (GHC.Generics.K1 i a) instance Distribution.Compat.Semigroup.GMonoid f => Distribution.Compat.Semigroup.GMonoid (GHC.Generics.M1 i c f) instance (Distribution.Compat.Semigroup.GMonoid f, Distribution.Compat.Semigroup.GMonoid g) => Distribution.Compat.Semigroup.GMonoid (f GHC.Generics.:*: g) instance Data.Semigroup.Semigroup a => Distribution.Compat.Semigroup.GSemigroup (GHC.Generics.K1 i a) instance Distribution.Compat.Semigroup.GSemigroup f => Distribution.Compat.Semigroup.GSemigroup (GHC.Generics.M1 i c f) instance (Distribution.Compat.Semigroup.GSemigroup f, Distribution.Compat.Semigroup.GSemigroup g) => Distribution.Compat.Semigroup.GSemigroup (f GHC.Generics.:*: g) instance Data.Semigroup.Semigroup (Distribution.Compat.Semigroup.Last' a) instance GHC.Base.Monoid (Distribution.Compat.Semigroup.Last' a) module Distribution.Compat.Stack type WithCallStack a = HasCallStack => a -- | 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 -- --
-- errorWithCallStack :: HasCallStack => String -> a ---- -- as a variant of error that will get its call-site. We can -- access the call-stack inside errorWithCallStack with -- callStack. -- --
-- errorWithCallStack :: HasCallStack => String -> a -- errorWithCallStack msg = error (msg ++ "n" ++ prettyCallStack callStack) ---- -- Thus, if we call errorWithCallStack we will get a formatted -- call-stack alongside our error message. -- --
-- >>> errorWithCallStack "die" -- *** Exception: die -- CallStack (from HasCallStack): -- errorWithCallStack, called at <interactive>:2:1 in interactive:Ghci1 ---- -- GHC solves HasCallStack constraints in three steps: -- --
-- (a <> b) <> c = a <> (b <> c) ---- -- If a is also a Monoid we further require -- --
-- (<>) = mappend --(<>) :: Semigroup a => a -> a -> a -- | Generically generate a Semigroup (<>) operation -- for any type implementing Generic. This operation will append -- two values by point-wise appending their component fields. It is only -- defined for product types. -- --
-- gmappend a (gmappend b c) = gmappend (gmappend a b) c --gmappend :: (Generic a, GSemigroup (Rep a)) => a -> a -> a -- | Generically generate a Monoid mempty for any -- product-like type implementing Generic. -- -- It is only defined for product types. -- --
-- gmappend gmempty a = a = gmappend a gmempty --gmempty :: (Generic a, GMonoid (Rep a)) => a -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable k (a :: k) -- | 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 -- | Representable types of kind *. This class is derivable in GHC with the -- DeriveGeneric flag on. class Generic a -- | A class of types that can be fully evaluated. class NFData a -- | rnf should reduce its argument to normal form (that is, fully -- evaluate all sub-components), and then return '()'. -- --
-- {-# LANGUAGE DeriveGeneric #-} -- -- import GHC.Generics (Generic, Generic1) -- import Control.DeepSeq -- -- data Foo a = Foo a String -- deriving (Eq, Generic, Generic1) -- -- instance NFData a => NFData (Foo a) -- instance NFData1 Foo -- -- data Colour = Red | Green | Blue -- deriving Generic -- -- instance NFData Colour ---- -- Starting with GHC 7.10, the example above can be written more -- concisely by enabling the new DeriveAnyClass extension: -- --
-- {-# LANGUAGE DeriveGeneric, DeriveAnyClass #-} -- -- import GHC.Generics (Generic) -- import Control.DeepSeq -- -- data Foo a = Foo a String -- deriving (Eq, Generic, Generic1, NFData, NFData1) -- -- data Colour = Red | Green | Blue -- deriving (Generic, NFData) ---- --
-- rnf a = seq a () ---- -- However, starting with deepseq-1.4.0.0, the default -- implementation is based on DefaultSignatures allowing for -- more accurate auto-derived NFData instances. If you need the -- previously used exact default rnf method implementation -- semantics, use -- --
-- instance NFData Colour where rnf x = seq x () ---- -- or alternatively -- --
-- instance NFData Colour where rnf = rwhnf ---- -- or -- --
-- {-# LANGUAGE BangPatterns #-} -- instance NFData Colour where rnf !_ = () --rnf :: NFData a => a -> () -- | GHC.Generics-based rnf implementation -- -- This is needed in order to support deepseq < 1.4 which -- didn't have a Generic-based default rnf implementation -- yet. -- -- In order to define instances, use e.g. -- --
-- instance NFData MyType where rnf = genericRnf ---- -- The implementation has been taken from deepseq-1.4.2's -- default rnf implementation. genericRnf :: (Generic a, GNFData (Rep a)) => a -> () -- | The Binary class provides put and get, methods to -- encode and decode a Haskell value to a lazy ByteString. It -- mirrors the Read and Show classes for textual -- representation of Haskell types, and is suitable for serialising -- Haskell values to disk, over the network. -- -- For decoding and generating simple external binary formats (e.g. C -- structures), Binary may be used, but in general is not suitable for -- complex protocols. Instead use the Put and Get -- primitives directly. -- -- Instances of Binary should satisfy the following property: -- --
-- decode . encode == id ---- -- That is, the get and put methods should be the inverse -- of each other. A range of instances are provided for basic Haskell -- types. class Binary t -- | Encode a value in the Put monad. put :: Binary t => t -> Put -- | Decode a value in the Get monad get :: Binary t => Get t -- | Encode a list of values in the Put monad. The default implementation -- may be overridden to be more efficient but must still have the same -- encoding format. putList :: Binary t => [t] -> Put -- | A monoid on applicative functors. -- -- If defined, some and many should be the least solutions -- of the equations: -- -- class Applicative f => Alternative (f :: * -> *) -- | The identity of <|> empty :: Alternative f => f a -- | 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] -- | Monads that also support choice and failure. class (Alternative m, Monad m) => MonadPlus (m :: * -> *) -- | the identity of mplus. It should also satisfy the equations -- --
-- mzero >>= f = mzero -- v >> mzero = mzero --mzero :: MonadPlus m => m a -- | an associative operation mplus :: MonadPlus m => m a -> m a -> m a -- | Class for string-like datastructures; used by the overloaded string -- extension (-XOverloadedStrings in GHC). class IsString a fromString :: IsString a => String -> a type IO a = WithCallStack (IO a) type NoCallStackIO a = IO a -- | A Map from keys k to values a. data Map k a -- | The catMaybes function takes a list of Maybes and -- returns a list of all the Just values. -- --
-- >>> catMaybes [Just 1, Nothing, Just 3] -- [1,3] ---- -- When constructing a list of Maybe values, catMaybes can -- be used to return all of the "success" results (if the list is the -- result of a map, then mapMaybe would be more -- appropriate): -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ] -- [Just 1,Nothing,Just 3] -- -- >>> catMaybes $ [readMaybe x :: Maybe Int | x <- ["1", "Foo", "3"] ] -- [1,3] --catMaybes :: () => [Maybe a] -> [a] -- | The mapMaybe function is a version of map which can -- throw out elements. In particular, the functional argument returns -- something of type Maybe b. If this is Nothing, -- no element is added on to the result list. If it is Just -- b, then b is included in the result list. -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> let readMaybeInt = readMaybe :: String -> Maybe Int -- -- >>> mapMaybe readMaybeInt ["1", "Foo", "3"] -- [1,3] -- -- >>> catMaybes $ map readMaybeInt ["1", "Foo", "3"] -- [1,3] ---- -- If we map the Just constructor, the entire list should be -- returned: -- --
-- >>> mapMaybe Just [1,2,3] -- [1,2,3] --mapMaybe :: () => (a -> Maybe b) -> [a] -> [b] -- | 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. -- --
-- >>> 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. -- --
-- >>> maybeToList (Just 7) -- [7] ---- --
-- >>> maybeToList Nothing -- [] ---- -- One can use maybeToList to avoid pattern matching when combined -- with a function that (safely) works on lists: -- --
-- >>> import Text.Read ( readMaybe ) -- -- >>> sum $ maybeToList (readMaybe "3") -- 3 -- -- >>> sum $ maybeToList (readMaybe "") -- 0 --maybeToList :: () => Maybe a -> [a] -- | The listToMaybe function returns Nothing on an empty -- list or Just a where a is the first element -- of the list. -- --
-- >>> listToMaybe [] -- Nothing ---- --
-- >>> listToMaybe [9] -- Just 9 ---- --
-- >>> listToMaybe [1,2,3] -- Just 1 ---- -- Composing maybeToList with listToMaybe should be the -- identity on singleton/empty lists: -- --
-- >>> maybeToList $ listToMaybe [5] -- [5] -- -- >>> maybeToList $ listToMaybe [] -- [] ---- -- But not on lists with more than one element: -- --
-- >>> maybeToList $ listToMaybe [1,2,3] -- [1] --listToMaybe :: () => [a] -> Maybe a -- | The isNothing function returns True iff its argument is -- Nothing. -- --
-- >>> isNothing (Just 3) -- False ---- --
-- >>> isNothing (Just ()) -- False ---- --
-- >>> isNothing Nothing -- True ---- -- Only the outer constructor is taken into consideration: -- --
-- >>> isNothing (Just Nothing) -- False --isNothing :: () => Maybe a -> Bool -- | The isJust function returns True iff its argument is of -- the form Just _. -- --
-- >>> isJust (Just 3) -- True ---- --
-- >>> isJust (Just ()) -- True ---- --
-- >>> isJust Nothing -- False ---- -- Only the outer constructor is taken into consideration: -- --
-- >>> isJust (Just Nothing) -- True --isJust :: () => Maybe a -> Bool -- | The unfoldr function is a `dual' to foldr: while -- foldr reduces a list to a summary value, unfoldr builds -- a list from a seed value. The function takes the element and returns -- Nothing if it is done producing the list or returns Just -- (a,b), in which case, a is a prepended to the list -- and b is used as the next element in a recursive call. For -- example, -- --
-- iterate f == unfoldr (\x -> Just (x, f x)) ---- -- In some cases, unfoldr can undo a foldr operation: -- --
-- unfoldr f' (foldr f z xs) == xs ---- -- if the following holds: -- --
-- f' (f x y) = Just (x,y) -- f' z = Nothing ---- -- A simple use of unfoldr: -- --
-- unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10 -- [10,9,8,7,6,5,4,3,2,1] --unfoldr :: () => (b -> Maybe (a, b)) -> b -> [a] -- | The isPrefixOf function takes two lists and returns True -- iff the first list is a prefix of the second. isPrefixOf :: Eq a => [a] -> [a] -> Bool -- | The isSuffixOf function takes two lists and returns True -- iff the first list is a suffix of the second. The second list must be -- finite. isSuffixOf :: Eq a => [a] -> [a] -> Bool -- | intercalate xs xss is equivalent to (concat -- (intersperse xs xss)). It inserts the list xs in -- between the lists in xss and concatenates the result. intercalate :: () => [a] -> [[a]] -> [a] -- | The intersperse function takes an element and a list and -- `intersperses' that element between the elements of the list. For -- example, -- --
-- intersperse ',' "abcde" == "a,b,c,d,e" --intersperse :: () => a -> [a] -> [a] -- | The sort function implements a stable sorting algorithm. It is -- a special case of sortBy, which allows the programmer to supply -- their own comparison function. -- -- Elements are arranged from from lowest to highest, keeping duplicates -- in the order they appeared in the input. sort :: Ord a => [a] -> [a] -- | The sortBy function is the non-overloaded version of -- sort. sortBy :: () => (a -> a -> Ordering) -> [a] -> [a] -- | O(n^2). The nub function removes duplicate elements from -- a list. In particular, it keeps only the first occurrence of each -- element. (The name nub means `essence'.) It is a special case -- of nubBy, which allows the programmer to supply their own -- equality test. nub :: Eq a => [a] -> [a] -- | The nubBy function behaves just like nub, except it uses -- a user-supplied equality predicate instead of the overloaded == -- function. nubBy :: () => (a -> a -> Bool) -> [a] -> [a] -- | 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 ---- -- 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 :: * -> *) -- | 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. -- -- In the case of lists, foldl, when applied to a binary operator, -- a starting value (typically the left-identity of the operator), and a -- list, reduces the list using the binary operator, from left to right: -- --
-- foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn ---- -- Note that to produce the outermost application of the operator the -- entire input list must be traversed. This means that foldl' -- will diverge if given an infinite list. -- -- Also note that if you want an efficient left-fold, you probably want -- to use foldl' instead of foldl. The reason for this is -- that latter does not force the "inner" results (e.g. z f -- x1 in the above example) before applying them to the operator -- (e.g. to (f x2)). This results in a thunk chain -- O(n) elements long, which then must be evaluated from the -- outside-in. -- -- 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 -- | 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 -- | A variant of foldr that has no base case, and thus may only be -- applied to non-empty structures. -- --
-- foldr1 f = foldr1 f . toList --foldr1 :: Foldable t => (a -> a -> a) -> t a -> a -- | A variant of foldl that has no base case, and thus may only be -- applied to non-empty structures. -- --
-- foldl1 f = foldl1 f . toList --foldl1 :: Foldable t => (a -> a -> a) -> 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 largest element of a non-empty structure. maximum :: (Foldable t, Ord a) => t a -> a -- | The least element of a non-empty structure. minimum :: (Foldable t, Ord a) => t a -> a -- | 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 -- | Map each element of the structure to a monoid, and combine the -- results. foldMap :: Foldable t => forall m a. 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 => forall a b. () => (a -> b -> b) -> b -> t a -> b -- | 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 => forall a. () => 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 => forall a. () => t a -> Int -- | The find function takes a predicate and a structure and returns -- the leftmost element of the structure matching the predicate, or -- Nothing if there is no such element. find :: Foldable t => (a -> Bool) -> t a -> Maybe a -- | 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 => forall b a. () => (b -> a -> b) -> b -> t a -> b -- | 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 () -- | Functors representing data structures that can be traversed from left -- to right. -- -- A definition of traverse must satisfy the following laws: -- --
-- 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: -- --
-- 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 -- | The reverse of when. unless :: Applicative f => Bool -> f () -> f () -- | 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 () -- | In many situations, the liftM operations can be replaced by -- uses of ap, which promotes function application. -- --
-- return f `ap` x1 `ap` ... `ap` xn ---- -- is equivalent to -- --
-- liftMn f x1 x2 ... xn --ap :: Monad m => m (a -> b) -> m a -> m b -- | void value discards or ignores the result of -- evaluation, such as the return value of an IO action. -- --
-- >>> void Nothing -- Nothing -- -- >>> void (Just 3) -- Just () ---- -- Replace the contents of an Either Int -- Int with unit, resulting in an Either -- Int '()': -- --
-- >>> void (Left 8675309) -- Left 8675309 -- -- >>> void (Right 8675309) -- Right () ---- -- Replace every element of a list with unit: -- --
-- >>> void [1,2,3] -- [(),(),()] ---- -- Replace the second element of a pair with unit: -- --
-- >>> void (1,2) -- (1,()) ---- -- Discard the result of an IO action: -- --
-- >>> mapM print [1,2] -- 1 -- 2 -- [(),()] -- -- >>> void $ mapM print [1,2] -- 1 -- 2 --void :: Functor f => f a -> f () -- | 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 -- | This generalizes the list-based filter function. filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a] -- | Returns True for any Unicode space character, and the control -- characters \t, \n, \r, \f, -- \v. isSpace :: Char -> Bool -- | Selects ASCII digits, i.e. '0'..'9'. isDigit :: Char -> Bool -- | Selects upper-case or title-case alphabetic Unicode characters -- (letters). Title case is used by a small number of letter ligatures -- like the single-character form of Lj. isUpper :: Char -> Bool -- | Selects alphabetic Unicode characters (lower-case, upper-case and -- title-case letters, plus letters of caseless scripts and modifiers -- letters). This function is equivalent to isLetter. isAlpha :: Char -> Bool -- | Selects alphabetic or numeric digit Unicode characters. -- -- Note that numeric digits outside the ASCII range are selected by this -- function but not by isDigit. Such digits may be part of -- identifiers but are not used by the printer and reader to represent -- numbers. isAlphaNum :: Char -> Bool -- | The toEnum method restricted to the type Char. chr :: Int -> Char -- | The fromEnum method restricted to the type Char. ord :: Char -> Int -- | Convert a letter to the corresponding lower-case letter, if any. Any -- other character is returned unchanged. toLower :: Char -> Char -- | Convert a letter to the corresponding upper-case letter, if any. Any -- other character is returned unchanged. toUpper :: Char -> Char -- | 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 -- | 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 -- | New name for <> (<<>>) :: Doc -> Doc -> Doc -- | A data type representing directed graphs, backed by Data.Graph. -- It is strict in the node type. -- -- This is an alternative interface to Data.Graph. In this -- interface, nodes (identified by the IsNode type class) are -- associated with a key and record the keys of their neighbors. This -- interface is more convenient than Graph, which requires -- vertices to be explicitly handled by integer indexes. -- -- The current implementation has somewhat peculiar performance -- characteristics. The asymptotics of all map-like operations mirror -- their counterparts in Data.Map. However, to perform a graph -- operation, we first must build the Data.Graph representation, -- an operation that takes O(V + E log V). However, this operation -- can be amortized across all queries on that particular graph. -- -- Some nodes may be broken, i.e., refer to neighbors which are not -- stored in the graph. In our graph algorithms, we transparently ignore -- such edges; however, you can easily query for the broken vertices of a -- graph using broken (and should, e.g., to ensure that a closure -- of a graph is well-formed.) It's possible to take a closed subset of a -- broken graph and get a well-formed graph. module Distribution.Compat.Graph -- | A graph of nodes a. The nodes are expected to have instance -- of class IsNode. data Graph a -- | The IsNode class is used for datatypes which represent directed -- graph nodes. A node of type a is associated with some unique -- key of type Key a; given a node we can determine its -- key (nodeKey) and the keys of its neighbors -- (nodeNeighbors). class Ord (Key a) => IsNode a where { type family Key a :: *; } nodeKey :: IsNode a => a -> Key a nodeNeighbors :: IsNode a => a -> [Key a] -- | O(1). Is the graph empty? null :: Graph a -> Bool -- | O(1). The number of nodes in the graph. size :: Graph a -> Int -- | O(log V). Check if the key is in the graph. member :: IsNode a => Key a -> Graph a -> Bool -- | O(log V). Lookup the node at a key in the graph. lookup :: IsNode a => Key a -> Graph a -> Maybe a -- | O(1). The empty graph. empty :: IsNode a => Graph a -- | O(log V). Insert a node into a graph. insert :: IsNode a => a -> Graph a -> Graph a -- | O(log V). Delete the node at a key from the graph. deleteKey :: IsNode a => Key a -> Graph a -> Graph a -- | O(log V). Lookup and delete. This function returns the deleted -- value if it existed. deleteLookup :: IsNode a => Key a -> Graph a -> (Maybe a, Graph a) -- | O(V + V'). Left-biased union, preferring entries from the first -- map when conflicts occur. unionLeft :: IsNode a => Graph a -> Graph a -> Graph a -- | O(V + V'). Right-biased union, preferring entries from the -- second map when conflicts occur. nodeKey x = nodeKey -- (f x). unionRight :: IsNode a => Graph a -> Graph a -> Graph a -- | Ω(V + E). Compute the strongly connected components of a graph. -- Requires amortized construction of graph. stronglyConnComp :: Graph a -> [SCC a] -- | Strongly connected component. data SCC vertex -- | A single vertex that is not in any cycle. AcyclicSCC :: vertex -> SCC vertex -- | A maximal set of mutually reachable vertices. CyclicSCC :: [vertex] -> SCC vertex -- | Ω(V + E). Compute the cycles of a graph. Requires amortized -- construction of graph. cycles :: Graph a -> [[a]] -- | O(1). Return a list of nodes paired with their broken neighbors -- (i.e., neighbor keys which are not in the graph). Requires amortized -- construction of graph. broken :: Graph a -> [(a, [Key a])] -- | Lookup the immediate neighbors from a key in the graph. Requires -- amortized construction of graph. neighbors :: Graph a -> Key a -> Maybe [a] -- | Lookup the immediate reverse neighbors from a key in the graph. -- Requires amortized construction of graph. revNeighbors :: Graph a -> Key a -> Maybe [a] -- | Compute the subgraph which is the closure of some set of keys. Returns -- Nothing if one (or more) keys are not present in the graph. -- Requires amortized construction of graph. closure :: Graph a -> [Key a] -> Maybe [a] -- | Compute the reverse closure of a graph from some set of keys. Returns -- Nothing if one (or more) keys are not present in the graph. -- Requires amortized construction of graph. revClosure :: Graph a -> [Key a] -> Maybe [a] -- | Topologically sort the nodes of a graph. Requires amortized -- construction of graph. topSort :: Graph a -> [a] -- | Reverse topologically sort the nodes of a graph. Requires amortized -- construction of graph. revTopSort :: Graph a -> [a] -- | O(1). Convert a graph into a map from keys to nodes. The -- resulting map m is guaranteed to have the property that -- all ((k,n) -> k == nodeKey n) (toList -- m). toMap :: Graph a -> Map (Key a) a -- | O(V log V). Convert a list of nodes (with distinct keys) into a -- graph. fromDistinctList :: (IsNode a, Show (Key a)) => [a] -> Graph a -- | O(V). Convert a graph into a list of nodes. toList :: Graph a -> [a] -- | O(V). Convert a graph into a list of keys. keys :: Graph a -> [Key a] -- | O(V). Convert a graph into a set of keys. keysSet :: Graph a -> Set (Key a) -- | O(1). Convert a graph into a Graph. Requires amortized -- construction of graph. toGraph :: Graph a -> (Graph, Vertex -> a, Key a -> Maybe Vertex) -- | A simple, trivial data type which admits an IsNode instance. data Node k a N :: a -> k -> [k] -> Node k a -- | Get the value from a Node. nodeValue :: Node k a -> a instance (GHC.Classes.Eq k, GHC.Classes.Eq a) => GHC.Classes.Eq (Distribution.Compat.Graph.Node k a) instance (GHC.Show.Show k, GHC.Show.Show a) => GHC.Show.Show (Distribution.Compat.Graph.Node k a) instance GHC.Base.Functor (Distribution.Compat.Graph.Node k) instance GHC.Classes.Ord k => Distribution.Compat.Graph.IsNode (Distribution.Compat.Graph.Node k a) instance GHC.Show.Show a => GHC.Show.Show (Distribution.Compat.Graph.Graph a) instance (Distribution.Compat.Graph.IsNode a, GHC.Read.Read a, GHC.Show.Show (Distribution.Compat.Graph.Key a)) => GHC.Read.Read (Distribution.Compat.Graph.Graph a) instance (Distribution.Compat.Graph.IsNode a, Data.Binary.Class.Binary a, GHC.Show.Show (Distribution.Compat.Graph.Key a)) => Data.Binary.Class.Binary (Distribution.Compat.Graph.Graph a) instance (GHC.Classes.Eq (Distribution.Compat.Graph.Key a), GHC.Classes.Eq a) => GHC.Classes.Eq (Distribution.Compat.Graph.Graph a) instance Data.Foldable.Foldable Distribution.Compat.Graph.Graph instance (Control.DeepSeq.NFData a, Control.DeepSeq.NFData (Distribution.Compat.Graph.Key a)) => Control.DeepSeq.NFData (Distribution.Compat.Graph.Graph a) instance (Distribution.Compat.Graph.IsNode a, Distribution.Compat.Graph.IsNode b, Distribution.Compat.Graph.Key a ~ Distribution.Compat.Graph.Key b) => Distribution.Compat.Graph.IsNode (Data.Either.Either a b) -- | A very simple difference list. module Distribution.Compat.DList -- | Difference list. data DList a runDList :: DList a -> [a] -- | Make DList with containing single element. singleton :: a -> DList a snoc :: DList a -> a -> DList a instance GHC.Base.Monoid (Distribution.Compat.DList.DList a) instance Data.Semigroup.Semigroup (Distribution.Compat.DList.DList a) module Distribution.Compat.CreatePipe createPipe :: IO (Handle, Handle) -- | Common utils used by modules under Distribution.PackageDescription.*. module Distribution.PackageDescription.Utils cabalBug :: String -> a userBug :: String -> a -- | Simple parsing with failure module Distribution.ReadE -- | Parser with simple error reporting newtype ReadE a ReadE :: (String -> Either ErrorMsg a) -> ReadE a [runReadE] :: ReadE a -> String -> Either ErrorMsg a succeedReadE :: (String -> a) -> ReadE a failReadE :: ErrorMsg -> ReadE a parseReadE :: ReadE a -> ReadP r a readEOrFail :: ReadE a -> String -> a readP_to_E :: (String -> ErrorMsg) -> ReadP a a -> ReadE a instance GHC.Base.Functor Distribution.ReadE.ReadE -- | This simple package provides types and functions for interacting with -- C compilers. Currently it's just a type enumerating extant C-like -- languages, which we call dialects. module Distribution.Simple.CCompiler -- | Represents a dialect of C. The Monoid instance expresses backward -- compatibility, in the sense that 'mappend a b' is the least inclusive -- dialect which both a and b can be correctly -- interpreted as. data CDialect C :: CDialect ObjectiveC :: CDialect CPlusPlus :: CDialect ObjectiveCPlusPlus :: CDialect -- | A list of all file extensions which are recognized as possibly -- containing some dialect of C code. Note that this list is only for -- source files, not for header files. cSourceExtensions :: [String] -- | Takes a dialect of C and whether code is intended to be passed through -- the preprocessor, and returns a filename extension for containing that -- code. cDialectFilenameExtension :: CDialect -> Bool -> String -- | Infers from a filename's extension the dialect of C which it contains, -- and whether it is intended to be passed through the preprocessor. filenameCDialect :: String -> Maybe (CDialect, Bool) instance GHC.Show.Show Distribution.Simple.CCompiler.CDialect instance GHC.Classes.Eq Distribution.Simple.CCompiler.CDialect instance GHC.Base.Monoid Distribution.Simple.CCompiler.CDialect instance Data.Semigroup.Semigroup Distribution.Simple.CCompiler.CDialect -- | Remove the "literal" markups from a Haskell source file, including -- ">", "\begin{code}", "\end{code}", and -- "#" module Distribution.Simple.PreProcess.Unlit -- | unlit takes a filename (for error reports), and transforms the -- given string, to eliminate the literate comments from the program -- text. unlit :: FilePath -> String -> Either String String -- | No unliteration. plain :: String -> String -> String -- | Internal utilities used by Distribution.Simple.Program.*. module Distribution.Simple.Program.Internal -- | Extract the version number from the output of 'strip --version'. -- -- Invoking "strip --version" gives very inconsistent results. We ignore -- everything in parentheses (see #2497), look for the first word that -- starts with a number, and try parsing out the first two components of -- it. Non-GNU strip doesn't appear to have a version flag. stripExtractVersion :: String -> String -- | This module defines the detailed test suite interface which makes it -- possible to expose individual tests to Cabal or other test agents. module Distribution.TestSuite data TestInstance TestInstance :: IO Progress -> String -> [String] -> [OptionDescr] -> (String -> String -> Either String TestInstance) -> TestInstance -- | Perform the test. [run] :: TestInstance -> IO Progress -- | A name for the test, unique within a test suite. [name] :: TestInstance -> String -- | Users can select groups of tests by their tags. [tags] :: TestInstance -> [String] -- | Descriptions of the options recognized by this test. [options] :: TestInstance -> [OptionDescr] -- | Try to set the named option to the given value. Returns an error -- message if the option is not supported or the value could not be -- correctly parsed; otherwise, a TestInstance with the option set -- to the given value is returned. [setOption] :: TestInstance -> String -> String -> Either String TestInstance data OptionDescr OptionDescr :: String -> String -> OptionType -> Maybe String -> OptionDescr [optionName] :: OptionDescr -> String -- | A human-readable description of the option to guide the user setting -- it. [optionDescription] :: OptionDescr -> String [optionType] :: OptionDescr -> OptionType [optionDefault] :: OptionDescr -> Maybe String data OptionType OptionFile :: Bool -> Bool -> [String] -> OptionType [optionFileMustExist] :: OptionType -> Bool [optionFileIsDir] :: OptionType -> Bool [optionFileExtensions] :: OptionType -> [String] OptionString :: Bool -> OptionType [optionStringMultiline] :: OptionType -> Bool OptionNumber :: Bool -> (Maybe String, Maybe String) -> OptionType [optionNumberIsInt] :: OptionType -> Bool [optionNumberBounds] :: OptionType -> (Maybe String, Maybe String) OptionBool :: OptionType OptionEnum :: [String] -> OptionType OptionSet :: [String] -> OptionType OptionRngSeed :: OptionType data Test Test :: TestInstance -> Test Group :: String -> Bool -> [Test] -> Test [groupName] :: Test -> String -- | If true, then children of this group may be run in parallel. Note that -- this setting is not inherited by children. In particular, consider a -- group F with "concurrently = False" that has some children, including -- a group T with "concurrently = True". The children of group T may be -- run concurrently with each other, as long as none are run at the same -- time as any of the direct children of group F. [concurrently] :: Test -> Bool [groupTests] :: Test -> [Test] ExtraOptions :: [OptionDescr] -> Test -> Test type Options = [(String, String)] data Progress Finished :: Result -> Progress Progress :: String -> (IO Progress) -> Progress data Result Pass :: Result Fail :: String -> Result Error :: String -> Result -- | Create a named group of tests, which are assumed to be safe to run in -- parallel. testGroup :: String -> [Test] -> Test instance GHC.Show.Show Distribution.TestSuite.Result instance GHC.Read.Read Distribution.TestSuite.Result instance GHC.Classes.Eq Distribution.TestSuite.Result instance GHC.Show.Show Distribution.TestSuite.OptionDescr instance GHC.Read.Read Distribution.TestSuite.OptionDescr instance GHC.Classes.Eq Distribution.TestSuite.OptionDescr instance GHC.Show.Show Distribution.TestSuite.OptionType instance GHC.Read.Read Distribution.TestSuite.OptionType instance GHC.Classes.Eq Distribution.TestSuite.OptionType -- | This defines a Text class which is a bit like the Read -- and Show classes. The difference is that is uses a modern -- pretty printer and parser system and the format is not expected to be -- Haskell concrete syntax but rather the external human readable -- representation used by Cabal. module Distribution.Text class Text a disp :: Text a => a -> Doc parse :: Text a => ReadP r a -- | The default rendering style used in Cabal for console output. It has a -- fixed page width and adds line breaks automatically. defaultStyle :: Style -- | Pretty-prints with the default style. display :: Text a => a -> String -- | A style for rendering all on one line. flatStyle :: Style simpleParse :: Text a => String -> Maybe a stdParse :: Text ver => (ver -> String -> res) -> ReadP r res instance Distribution.Text.Text GHC.Types.Bool instance Distribution.Text.Text GHC.Types.Int instance Distribution.Text.Text Data.Version.Version -- | Cabal often needs to do slightly different things on specific -- platforms. You probably know about the os however using that is -- very inconvenient because it is a string and different Haskell -- implementations do not agree on using the same strings for the same -- platforms! (In particular see the controversy over "windows" vs -- "mingw32"). So to make it more consistent and easy to use we have an -- OS enumeration. module Distribution.System -- | These are the known OS names: Linux, Windows, OSX ,FreeBSD, OpenBSD, -- NetBSD, DragonFly ,Solaris, AIX, HPUX, IRIX ,HaLVM ,Hurd ,IOS, -- Android,Ghcjs -- -- The following aliases can also be used:, * Windows aliases: mingw32, -- win32, cygwin32 * OSX alias: darwin * Hurd alias: gnu * FreeBSD alias: -- kfreebsdgnu * Solaris alias: solaris2 data OS Linux :: OS Windows :: OS OSX :: OS FreeBSD :: OS OpenBSD :: OS NetBSD :: OS DragonFly :: OS Solaris :: OS AIX :: OS HPUX :: OS IRIX :: OS HaLVM :: OS Hurd :: OS IOS :: OS Android :: OS Ghcjs :: OS OtherOS :: String -> OS buildOS :: OS -- | These are the known Arches: I386, X86_64, PPC, PPC64, Sparc ,Arm, -- Mips, SH, IA64, S39, Alpha, Hppa, Rs6000, M68k, Vax and JavaScript. -- -- The following aliases can also be used: * PPC alias: powerpc * PPC64 -- alias : powerpc64 * Sparc aliases: sparc64, sun4 * Mips aliases: -- mipsel, mipseb * Arm aliases: armeb, armel data Arch I386 :: Arch X86_64 :: Arch PPC :: Arch PPC64 :: Arch Sparc :: Arch Arm :: Arch Mips :: Arch SH :: Arch IA64 :: Arch S390 :: Arch Alpha :: Arch Hppa :: Arch Rs6000 :: Arch M68k :: Arch Vax :: Arch JavaScript :: Arch OtherArch :: String -> Arch buildArch :: Arch data Platform Platform :: Arch -> OS -> Platform -- | The platform Cabal was compiled on. In most cases, -- LocalBuildInfo.hostPlatform should be used instead (the -- platform we're targeting). buildPlatform :: Platform platformFromTriple :: String -> Maybe Platform knownOSs :: [OS] knownArches :: [Arch] -- | How strict to be when classifying strings into the OS and -- Arch enums. -- -- The reason we have multiple ways to do the classification is because -- there are two situations where we need to do it. -- -- For parsing OS and arch names in .cabal files we really want everyone -- to be referring to the same or or arch by the same name. Variety is -- not a virtue in this case. We don't mind about case though. -- -- For the System.Info.os/arch different Haskell implementations use -- different names for the same or/arch. Also they tend to distinguish -- versions of an OS/arch which we just don't care about. -- -- The Compat classification allows us to recognise aliases that -- are already in common use but it allows us to distinguish them from -- the canonical name which enables us to warn about such deprecated -- aliases. data ClassificationStrictness Permissive :: ClassificationStrictness Compat :: ClassificationStrictness Strict :: ClassificationStrictness classifyOS :: ClassificationStrictness -> String -> OS classifyArch :: ClassificationStrictness -> String -> Arch instance Data.Data.Data Distribution.System.Platform instance GHC.Read.Read Distribution.System.Platform instance GHC.Show.Show Distribution.System.Platform instance GHC.Classes.Ord Distribution.System.Platform instance GHC.Generics.Generic Distribution.System.Platform instance GHC.Classes.Eq Distribution.System.Platform instance Data.Data.Data Distribution.System.Arch instance GHC.Read.Read Distribution.System.Arch instance GHC.Show.Show Distribution.System.Arch instance GHC.Classes.Ord Distribution.System.Arch instance GHC.Generics.Generic Distribution.System.Arch instance GHC.Classes.Eq Distribution.System.Arch instance Data.Data.Data Distribution.System.OS instance GHC.Read.Read Distribution.System.OS instance GHC.Show.Show Distribution.System.OS instance GHC.Classes.Ord Distribution.System.OS instance GHC.Generics.Generic Distribution.System.OS instance GHC.Classes.Eq Distribution.System.OS instance Data.Binary.Class.Binary Distribution.System.Platform instance Distribution.Text.Text Distribution.System.Platform instance Data.Binary.Class.Binary Distribution.System.Arch instance Distribution.Text.Text Distribution.System.Arch instance Data.Binary.Class.Binary Distribution.System.OS instance Distribution.Text.Text Distribution.System.OS module Distribution.Types.BuildType -- | The type of build system used by this package. data BuildType -- | calls Distribution.Simple.defaultMain Simple :: BuildType -- | calls Distribution.Simple.defaultMainWithHooks -- defaultUserHooks, which invokes configure to generate -- additional build information used by later phases. Configure :: BuildType -- | calls Distribution.Make.defaultMain Make :: BuildType -- | uses user-supplied Setup.hs or Setup.lhs (default) Custom :: BuildType -- | a package that uses an unknown build type cannot actually be built. -- Doing it this way rather than just giving a parse error means we get -- better error messages and allows you to inspect the rest of the -- package description. UnknownBuildType :: String -> BuildType knownBuildTypes :: [BuildType] instance Data.Data.Data Distribution.Types.BuildType.BuildType instance GHC.Classes.Eq Distribution.Types.BuildType.BuildType instance GHC.Read.Read Distribution.Types.BuildType.BuildType instance GHC.Show.Show Distribution.Types.BuildType.BuildType instance GHC.Generics.Generic Distribution.Types.BuildType.BuildType instance Data.Binary.Class.Binary Distribution.Types.BuildType.BuildType instance Distribution.Text.Text Distribution.Types.BuildType.BuildType module Distribution.Types.Condition -- | A boolean expression parameterized over the variable type used. data Condition c Var :: c -> Condition c Lit :: Bool -> Condition c CNot :: (Condition c) -> Condition c COr :: (Condition c) -> (Condition c) -> Condition c CAnd :: (Condition c) -> (Condition c) -> Condition c -- | Boolean negation of a Condition value. cNot :: Condition a -> Condition a -- | Boolean AND of two Condtion values. cAnd :: Condition a -> Condition a -> Condition a -- | Boolean OR of two Condition values. cOr :: Eq v => Condition v -> Condition v -> Condition v -- | Simplify the condition and return its free variables. simplifyCondition :: Condition c -> (c -> Either d Bool) -> (Condition d, [d]) instance GHC.Generics.Generic (Distribution.Types.Condition.Condition c) instance Data.Data.Data c => Data.Data.Data (Distribution.Types.Condition.Condition c) instance GHC.Classes.Eq c => GHC.Classes.Eq (Distribution.Types.Condition.Condition c) instance GHC.Show.Show c => GHC.Show.Show (Distribution.Types.Condition.Condition c) instance GHC.Base.Functor Distribution.Types.Condition.Condition instance Data.Foldable.Foldable Distribution.Types.Condition.Condition instance Data.Traversable.Traversable Distribution.Types.Condition.Condition instance GHC.Base.Applicative Distribution.Types.Condition.Condition instance GHC.Base.Monad Distribution.Types.Condition.Condition instance GHC.Base.Monoid (Distribution.Types.Condition.Condition a) instance Data.Semigroup.Semigroup (Distribution.Types.Condition.Condition a) instance GHC.Base.Alternative Distribution.Types.Condition.Condition instance GHC.Base.MonadPlus Distribution.Types.Condition.Condition instance Data.Binary.Class.Binary c => Data.Binary.Class.Binary (Distribution.Types.Condition.Condition c) module Distribution.Types.CondTree -- | A CondTree is used to represent the conditional structure of a -- Cabal file, reflecting a syntax element subject to constraints, and -- then any number of sub-elements which may be enabled subject to some -- condition. Both a and c are usually Monoids. -- -- To be more concrete, consider the following fragment of a -- Cabal file: -- --
-- build-depends: base >= 4.0 -- if flag(extra) -- build-depends: base >= 4.2 ---- -- One way to represent this is to have CondTree -- ConfVar [Dependency] BuildInfo. Here, -- condTreeData represents the actual fields which are not behind -- any conditional, while condTreeComponents recursively records -- any further fields which are behind a conditional. -- condTreeConstraints records the constraints (in this case, -- base >= 4.0) which would be applied if you use this -- syntax; in general, this is derived off of targetBuildInfo -- (perhaps a good refactoring would be to convert this into an opaque -- type, with a smart constructor that pre-computes the dependencies.) data CondTree v c a CondNode :: a -> c -> [CondBranch v c a] -> CondTree v c a [condTreeData] :: CondTree v c a -> a [condTreeConstraints] :: CondTree v c a -> c [condTreeComponents] :: CondTree v c a -> [CondBranch v c a] -- | A CondBranch represents a conditional branch, e.g., if -- flag(foo) on some syntax a. It also has an optional -- false branch. data CondBranch v c a CondBranch :: Condition v -> CondTree v c a -> Maybe (CondTree v c a) -> CondBranch v c a [condBranchCondition] :: CondBranch v c a -> Condition v [condBranchIfTrue] :: CondBranch v c a -> CondTree v c a [condBranchIfFalse] :: CondBranch v c a -> Maybe (CondTree v c a) condIfThen :: Condition v -> CondTree v c a -> CondBranch v c a condIfThenElse :: Condition v -> CondTree v c a -> CondTree v c a -> CondBranch v c a mapCondTree :: (a -> b) -> (c -> d) -> (Condition v -> Condition w) -> CondTree v c a -> CondTree w d b mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a mapTreeConds :: (Condition v -> Condition w) -> CondTree v c a -> CondTree w c a mapTreeData :: (a -> b) -> CondTree v c a -> CondTree v c b -- | Extract the condition matched by the given predicate from a cond tree. -- -- We use this mainly for extracting buildable conditions (see the Note -- above), but the function is in fact more general. extractCondition :: Eq v => (a -> Bool) -> CondTree v c a -> Condition v -- | Flattens a CondTree using a partial flag assignment. When a condition -- cannot be evaluated, both branches are ignored. simplifyCondTree :: (Monoid a, Monoid d) => (v -> Either v Bool) -> CondTree v d a -> (d, a) -- | Flatten a CondTree. This will resolve the CondTree by taking all -- possible paths into account. Note that since branches represent -- exclusive choices this may not result in a "sane" result. ignoreConditions :: (Monoid a, Monoid c) => CondTree v c a -> (a, c) instance Data.Traversable.Traversable (Distribution.Types.CondTree.CondTree v c) instance Data.Foldable.Foldable (Distribution.Types.CondTree.CondTree v c) instance GHC.Base.Functor (Distribution.Types.CondTree.CondTree v c) instance GHC.Generics.Generic (Distribution.Types.CondTree.CondTree v c a) instance (Data.Data.Data a, Data.Data.Data c, Data.Data.Data v) => Data.Data.Data (Distribution.Types.CondTree.CondTree v c a) instance (GHC.Classes.Eq v, GHC.Classes.Eq c, GHC.Classes.Eq a) => GHC.Classes.Eq (Distribution.Types.CondTree.CondTree v c a) instance (GHC.Show.Show v, GHC.Show.Show c, GHC.Show.Show a) => GHC.Show.Show (Distribution.Types.CondTree.CondTree v c a) instance Data.Traversable.Traversable (Distribution.Types.CondTree.CondBranch v c) instance GHC.Base.Functor (Distribution.Types.CondTree.CondBranch v c) instance GHC.Generics.Generic (Distribution.Types.CondTree.CondBranch v c a) instance (Data.Data.Data a, Data.Data.Data c, Data.Data.Data v) => Data.Data.Data (Distribution.Types.CondTree.CondBranch v c a) instance (GHC.Classes.Eq a, GHC.Classes.Eq c, GHC.Classes.Eq v) => GHC.Classes.Eq (Distribution.Types.CondTree.CondBranch v c a) instance (GHC.Show.Show a, GHC.Show.Show c, GHC.Show.Show v) => GHC.Show.Show (Distribution.Types.CondTree.CondBranch v c a) instance (Data.Binary.Class.Binary v, Data.Binary.Class.Binary c, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (Distribution.Types.CondTree.CondTree v c a) instance Data.Foldable.Foldable (Distribution.Types.CondTree.CondBranch v c) instance (Data.Binary.Class.Binary v, Data.Binary.Class.Binary c, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (Distribution.Types.CondTree.CondBranch v c a) module Distribution.Types.ExecutableScope data ExecutableScope ExecutableScopeUnknown :: ExecutableScope ExecutablePublic :: ExecutableScope ExecutablePrivate :: ExecutableScope instance Data.Data.Data Distribution.Types.ExecutableScope.ExecutableScope instance GHC.Classes.Eq Distribution.Types.ExecutableScope.ExecutableScope instance GHC.Read.Read Distribution.Types.ExecutableScope.ExecutableScope instance GHC.Show.Show Distribution.Types.ExecutableScope.ExecutableScope instance GHC.Generics.Generic Distribution.Types.ExecutableScope.ExecutableScope instance Distribution.Text.Text Distribution.Types.ExecutableScope.ExecutableScope instance Data.Binary.Class.Binary Distribution.Types.ExecutableScope.ExecutableScope instance GHC.Base.Monoid Distribution.Types.ExecutableScope.ExecutableScope instance Data.Semigroup.Semigroup Distribution.Types.ExecutableScope.ExecutableScope module Distribution.Types.ForeignLibOption data ForeignLibOption -- | Merge in all dependent libraries (i.e., use ghc -shared -- -static rather than just record the dependencies, ala ghc -- -shared -dynamic). This option is compulsory on Windows and -- unsupported on other platforms. ForeignLibStandalone :: ForeignLibOption instance Data.Data.Data Distribution.Types.ForeignLibOption.ForeignLibOption instance GHC.Classes.Eq Distribution.Types.ForeignLibOption.ForeignLibOption instance GHC.Read.Read Distribution.Types.ForeignLibOption.ForeignLibOption instance GHC.Show.Show Distribution.Types.ForeignLibOption.ForeignLibOption instance GHC.Generics.Generic Distribution.Types.ForeignLibOption.ForeignLibOption instance Distribution.Text.Text Distribution.Types.ForeignLibOption.ForeignLibOption instance Data.Binary.Class.Binary Distribution.Types.ForeignLibOption.ForeignLibOption module Distribution.Types.ForeignLibType -- | What kind of foreign library is to be built? data ForeignLibType -- | A native shared library (.so on Linux, .dylib on -- OSX, or .dll on Windows). ForeignLibNativeShared :: ForeignLibType -- | A native static library (not currently supported.) ForeignLibNativeStatic :: ForeignLibType ForeignLibTypeUnknown :: ForeignLibType knownForeignLibTypes :: [ForeignLibType] foreignLibTypeIsShared :: ForeignLibType -> Bool instance Data.Data.Data Distribution.Types.ForeignLibType.ForeignLibType instance GHC.Classes.Eq Distribution.Types.ForeignLibType.ForeignLibType instance GHC.Read.Read Distribution.Types.ForeignLibType.ForeignLibType instance GHC.Show.Show Distribution.Types.ForeignLibType.ForeignLibType instance GHC.Generics.Generic Distribution.Types.ForeignLibType.ForeignLibType instance Distribution.Text.Text Distribution.Types.ForeignLibType.ForeignLibType instance Data.Binary.Class.Binary Distribution.Types.ForeignLibType.ForeignLibType instance Data.Semigroup.Semigroup Distribution.Types.ForeignLibType.ForeignLibType instance GHC.Base.Monoid Distribution.Types.ForeignLibType.ForeignLibType module Distribution.Types.SourceRepo -- | Information about the source revision control system for a package. -- -- When specifying a repo it is useful to know the meaning or intention -- of the information as doing so enables automation. There are two -- obvious common purposes: one is to find the repo for the latest -- development version, the other is to find the repo for this specific -- release. The ReopKind specifies which one we mean (or another -- custom one). -- -- A package can specify one or the other kind or both. Most will specify -- just a head repo but some may want to specify a repo to reconstruct -- the sources for this package release. -- -- The required information is the RepoType which tells us if it's -- using Darcs, Git for example. The repoLocation -- and other details are interpreted according to the repo type. data SourceRepo SourceRepo :: RepoKind -> Maybe RepoType -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe FilePath -> SourceRepo -- | The kind of repo. This field is required. [repoKind] :: SourceRepo -> RepoKind -- | The type of the source repository system for this repo, eg -- Darcs or Git. This field is required. [repoType] :: SourceRepo -> Maybe RepoType -- | The location of the repository. For most RepoTypes this is a -- URL. This field is required. [repoLocation] :: SourceRepo -> Maybe String -- | CVS can put multiple "modules" on one server and requires a -- module name in addition to the location to identify a particular repo. -- Logically this is part of the location but unfortunately has to be -- specified separately. This field is required for the CVS -- RepoType and should not be given otherwise. [repoModule] :: SourceRepo -> Maybe String -- | The name or identifier of the branch, if any. Many source control -- systems have the notion of multiple branches in a repo that exist in -- the same location. For example Git and CVS use this -- while systems like Darcs use different locations for different -- branches. This field is optional but should be used if necessary to -- identify the sources, especially for the RepoThis repo kind. [repoBranch] :: SourceRepo -> Maybe String -- | The tag identify a particular state of the repository. This should be -- given for the RepoThis repo kind and not for RepoHead -- kind. [repoTag] :: SourceRepo -> Maybe String -- | Some repositories contain multiple projects in different -- subdirectories This field specifies the subdirectory where this -- packages sources can be found, eg the subdirectory containing the -- .cabal file. It is interpreted relative to the root of the -- repository. This field is optional. If not given the default is "." ie -- no subdirectory. [repoSubdir] :: SourceRepo -> Maybe FilePath -- | What this repo info is for, what it represents. data RepoKind -- | The repository for the "head" or development version of the project. -- This repo is where we should track the latest development activity or -- the usual repo people should get to contribute patches. RepoHead :: RepoKind -- | The repository containing the sources for this exact package version -- or release. For this kind of repo a tag should be given to give enough -- information to re-create the exact sources. RepoThis :: RepoKind RepoKindUnknown :: String -> RepoKind -- | An enumeration of common source control systems. The fields used in -- the SourceRepo depend on the type of repo. The tools and -- methods used to obtain and track the repo depend on the repo type. data RepoType Darcs :: RepoType Git :: RepoType SVN :: RepoType CVS :: RepoType Mercurial :: RepoType GnuArch :: RepoType Bazaar :: RepoType Monotone :: RepoType OtherRepoType :: String -> RepoType knownRepoTypes :: [RepoType] emptySourceRepo :: RepoKind -> SourceRepo classifyRepoType :: String -> RepoType classifyRepoKind :: String -> RepoKind instance Data.Data.Data Distribution.Types.SourceRepo.SourceRepo instance GHC.Show.Show Distribution.Types.SourceRepo.SourceRepo instance GHC.Read.Read Distribution.Types.SourceRepo.SourceRepo instance GHC.Generics.Generic Distribution.Types.SourceRepo.SourceRepo instance GHC.Classes.Eq Distribution.Types.SourceRepo.SourceRepo instance Data.Data.Data Distribution.Types.SourceRepo.RepoType instance GHC.Show.Show Distribution.Types.SourceRepo.RepoType instance GHC.Read.Read Distribution.Types.SourceRepo.RepoType instance GHC.Classes.Ord Distribution.Types.SourceRepo.RepoType instance GHC.Generics.Generic Distribution.Types.SourceRepo.RepoType instance GHC.Classes.Eq Distribution.Types.SourceRepo.RepoType instance Data.Data.Data Distribution.Types.SourceRepo.RepoKind instance GHC.Show.Show Distribution.Types.SourceRepo.RepoKind instance GHC.Read.Read Distribution.Types.SourceRepo.RepoKind instance GHC.Classes.Ord Distribution.Types.SourceRepo.RepoKind instance GHC.Generics.Generic Distribution.Types.SourceRepo.RepoKind instance GHC.Classes.Eq Distribution.Types.SourceRepo.RepoKind instance Data.Binary.Class.Binary Distribution.Types.SourceRepo.SourceRepo instance Data.Binary.Class.Binary Distribution.Types.SourceRepo.RepoType instance Distribution.Text.Text Distribution.Types.SourceRepo.RepoType instance Data.Binary.Class.Binary Distribution.Types.SourceRepo.RepoKind instance Distribution.Text.Text Distribution.Types.SourceRepo.RepoKind module Distribution.Utils.MapAccum -- | Monadic variant of mapAccumL. mapAccumM :: (Monad m, Traversable t) => (a -> b -> m (a, c)) -> a -> t b -> m (a, t c) instance GHC.Base.Functor m => GHC.Base.Functor (Distribution.Utils.MapAccum.StateM s m) instance GHC.Base.Monad m => GHC.Base.Applicative (Distribution.Utils.MapAccum.StateM s m) -- | A progress monad, which we use to report failure and logging from -- otherwise pure code. module Distribution.Utils.Progress -- | A type to represent the unfolding of an expensive long running -- calculation that may fail (or maybe not expensive, but complicated!) -- We may get intermediate steps before the final result which may be -- used to indicate progress and/or logging messages. -- -- TODO: Apply Codensity to avoid left-associativity problem. See -- http://comonad.com/reader/2011/free-monads-for-less/ and -- http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/ data Progress step fail done -- | Emit a step and then continue. stepProgress :: step -> Progress step fail () -- | Fail the computation. failProgress :: fail -> Progress step fail done -- | Consume a Progress calculation. Much like foldr for -- lists but with two base cases, one for a final result and one for -- failure. -- -- Eg to convert into a simple Either result use: -- --
-- foldProgress (flip const) Left Right --foldProgress :: (step -> a -> a) -> (fail -> a) -> (done -> a) -> Progress step fail done -> a instance GHC.Base.Functor (Distribution.Utils.Progress.Progress step fail) instance GHC.Base.Monad (Distribution.Utils.Progress.Progress step fail) instance GHC.Base.Applicative (Distribution.Utils.Progress.Progress step fail) instance GHC.Base.Monoid fail => GHC.Base.Alternative (Distribution.Utils.Progress.Progress step fail) module Distribution.Utils.ShortText -- | Compact representation of short Strings -- -- The data is stored internally as UTF8 in an ShortByteString -- when compiled against bytestring >= 0.10.4, and otherwise -- the fallback is to use plain old non-compat '[Char]'. -- -- Note: This type is for internal uses (such as e.g. -- PackageName) and shall not be exposed in Cabal's API data ShortText -- | Construct ShortText from String toShortText :: String -> ShortText -- | Convert ShortText to String fromShortText :: ShortText -> String -- | Decode String from UTF8-encoded octets. -- -- Invalid data will be decoded as the replacement character -- (U+FFFD) -- -- See also encodeStringUtf8 decodeStringUtf8 :: [Word8] -> String -- | Encode String to a list of UTF8-encoded octets -- -- See also decodeUtf8 encodeStringUtf8 :: String -> [Word8] instance Data.Data.Data Distribution.Utils.ShortText.ShortText instance GHC.Generics.Generic Distribution.Utils.ShortText.ShortText instance GHC.Classes.Ord Distribution.Utils.ShortText.ShortText instance GHC.Classes.Eq Distribution.Utils.ShortText.ShortText instance Data.Binary.Class.Binary Distribution.Utils.ShortText.ShortText instance Control.DeepSeq.NFData Distribution.Utils.ShortText.ShortText instance GHC.Show.Show Distribution.Utils.ShortText.ShortText instance GHC.Read.Read Distribution.Utils.ShortText.ShortText instance Data.Semigroup.Semigroup Distribution.Utils.ShortText.ShortText instance GHC.Base.Monoid Distribution.Utils.ShortText.ShortText instance Data.String.IsString Distribution.Utils.ShortText.ShortText module Distribution.Types.PkgconfigName -- | A pkg-config library name -- -- This is parsed as any valid argument to the pkg-config utility. data PkgconfigName -- | Convert PkgconfigName to String unPkgconfigName :: PkgconfigName -> String -- | Construct a PkgconfigName from a String -- -- mkPkgconfigName is the inverse to unPkgconfigName -- -- Note: No validations are performed to ensure that the resulting -- PkgconfigName is valid mkPkgconfigName :: String -> PkgconfigName instance Data.Data.Data Distribution.Types.PkgconfigName.PkgconfigName instance GHC.Classes.Ord Distribution.Types.PkgconfigName.PkgconfigName instance GHC.Classes.Eq Distribution.Types.PkgconfigName.PkgconfigName instance GHC.Show.Show Distribution.Types.PkgconfigName.PkgconfigName instance GHC.Read.Read Distribution.Types.PkgconfigName.PkgconfigName instance GHC.Generics.Generic Distribution.Types.PkgconfigName.PkgconfigName instance Data.String.IsString Distribution.Types.PkgconfigName.PkgconfigName instance Data.Binary.Class.Binary Distribution.Types.PkgconfigName.PkgconfigName instance Distribution.Text.Text Distribution.Types.PkgconfigName.PkgconfigName instance Control.DeepSeq.NFData Distribution.Types.PkgconfigName.PkgconfigName module Distribution.Types.ComponentId -- | A ComponentId uniquely identifies the transitive source code -- closure of a component (i.e. libraries, executables). -- -- For non-Backpack components, this corresponds one to one with the -- UnitId, which serves as the basis for install paths, linker -- symbols, etc. -- -- Use mkComponentId and unComponentId to convert from/to a -- String. -- -- This type is opaque since Cabal-2.0 data ComponentId -- | Convert ComponentId to String unComponentId :: ComponentId -> String -- | Construct a ComponentId from a String -- -- mkComponentId is the inverse to unComponentId -- -- Note: No validations are performed to ensure that the resulting -- ComponentId is valid mkComponentId :: String -> ComponentId instance Data.Data.Data Distribution.Types.ComponentId.ComponentId instance GHC.Classes.Ord Distribution.Types.ComponentId.ComponentId instance GHC.Classes.Eq Distribution.Types.ComponentId.ComponentId instance GHC.Show.Show Distribution.Types.ComponentId.ComponentId instance GHC.Read.Read Distribution.Types.ComponentId.ComponentId instance GHC.Generics.Generic Distribution.Types.ComponentId.ComponentId instance Data.String.IsString Distribution.Types.ComponentId.ComponentId instance Data.Binary.Class.Binary Distribution.Types.ComponentId.ComponentId instance Distribution.Text.Text Distribution.Types.ComponentId.ComponentId instance Control.DeepSeq.NFData Distribution.Types.ComponentId.ComponentId module Distribution.Types.AbiHash -- | ABI Hashes -- -- Use mkAbiHash and unAbiHash to convert from/to a -- String. -- -- This type is opaque since Cabal-2.0 data AbiHash -- | Construct a AbiHash from a String -- -- mkAbiHash is the inverse to unAbiHash -- -- Note: No validations are performed to ensure that the resulting -- AbiHash is valid unAbiHash :: AbiHash -> String -- | Convert AbiHash to String mkAbiHash :: String -> AbiHash instance GHC.Generics.Generic Distribution.Types.AbiHash.AbiHash instance GHC.Read.Read Distribution.Types.AbiHash.AbiHash instance GHC.Show.Show Distribution.Types.AbiHash.AbiHash instance GHC.Classes.Eq Distribution.Types.AbiHash.AbiHash instance Data.String.IsString Distribution.Types.AbiHash.AbiHash instance Data.Binary.Class.Binary Distribution.Types.AbiHash.AbiHash instance Distribution.Text.Text Distribution.Types.AbiHash.AbiHash -- | Data type for Haskell module names. module Distribution.ModuleName -- | A valid Haskell module name. newtype ModuleName ModuleName :: ShortTextLst -> ModuleName fromString :: IsString a => String -> a -- | Construct a ModuleName from valid module components, i.e. parts -- separated by dots. fromComponents :: [String] -> ModuleName -- | The individual components of a hierarchical module name. For example -- --
-- components (fromString "A.B.C") = ["A", "B", "C"] --components :: ModuleName -> [String] -- | Convert a module name to a file path, but without any file extension. -- For example: -- --
-- toFilePath (fromString "A.B.C") = "A/B/C" --toFilePath :: ModuleName -> FilePath -- | The module name Main. main :: ModuleName -- | Deprecated: use ModuleName.fromString instead simple :: String -> ModuleName validModuleComponent :: String -> Bool instance Data.Data.Data Distribution.ModuleName.ModuleName instance GHC.Show.Show Distribution.ModuleName.ModuleName instance GHC.Read.Read Distribution.ModuleName.ModuleName instance GHC.Classes.Ord Distribution.ModuleName.ModuleName instance GHC.Generics.Generic Distribution.ModuleName.ModuleName instance GHC.Classes.Eq Distribution.ModuleName.ModuleName instance Data.Data.Data Distribution.ModuleName.ShortTextLst instance GHC.Classes.Ord Distribution.ModuleName.ShortTextLst instance GHC.Generics.Generic Distribution.ModuleName.ShortTextLst instance GHC.Classes.Eq Distribution.ModuleName.ShortTextLst instance Data.Binary.Class.Binary Distribution.ModuleName.ModuleName instance Control.DeepSeq.NFData Distribution.ModuleName.ModuleName instance Distribution.Text.Text Distribution.ModuleName.ModuleName instance Data.String.IsString Distribution.ModuleName.ModuleName instance Control.DeepSeq.NFData Distribution.ModuleName.ShortTextLst instance GHC.Show.Show Distribution.ModuleName.ShortTextLst instance GHC.Read.Read Distribution.ModuleName.ShortTextLst instance Data.Binary.Class.Binary Distribution.ModuleName.ShortTextLst module Distribution.Types.ModuleRenaming -- | Renaming applied to the modules provided by a package. The boolean -- indicates whether or not to also include all of the original names of -- modules. Thus, ModuleRenaming False [] is "don't expose any -- modules, and ModuleRenaming True [(Data.Bool, -- Bool)] is, "expose all modules, but also expose -- Data.Bool as Bool". If a renaming is omitted you get -- the DefaultRenaming. -- -- (NB: This is a list not a map so that we can preserve order.) data ModuleRenaming -- | A module renaming/thinning; e.g., (A as B, C as C) brings -- B and C into scope. ModuleRenaming :: [(ModuleName, ModuleName)] -> ModuleRenaming -- | The default renaming, bringing all exported modules into scope. DefaultRenaming :: ModuleRenaming -- | Hiding renaming, e.g., hiding (A, B), bringing all exported -- modules into scope except the hidden ones. HidingRenaming :: [ModuleName] -> ModuleRenaming -- | The default renaming, if something is specified in -- build-depends only. defaultRenaming :: ModuleRenaming -- | Tests if its the default renaming; we can use a more compact syntax in -- IncludeRenaming in this case. isDefaultRenaming :: ModuleRenaming -> Bool instance GHC.Generics.Generic Distribution.Types.ModuleRenaming.ModuleRenaming instance Data.Data.Data Distribution.Types.ModuleRenaming.ModuleRenaming instance GHC.Classes.Ord Distribution.Types.ModuleRenaming.ModuleRenaming instance GHC.Classes.Eq Distribution.Types.ModuleRenaming.ModuleRenaming instance GHC.Read.Read Distribution.Types.ModuleRenaming.ModuleRenaming instance GHC.Show.Show Distribution.Types.ModuleRenaming.ModuleRenaming instance Data.Binary.Class.Binary Distribution.Types.ModuleRenaming.ModuleRenaming instance Distribution.Text.Text Distribution.Types.ModuleRenaming.ModuleRenaming module Distribution.Types.IncludeRenaming -- | A renaming on an include: (provides renaming, requires renaming) data IncludeRenaming IncludeRenaming :: ModuleRenaming -> ModuleRenaming -> IncludeRenaming [includeProvidesRn] :: IncludeRenaming -> ModuleRenaming [includeRequiresRn] :: IncludeRenaming -> ModuleRenaming -- | The defaultIncludeRenaming applied when you only -- build-depends on a package. defaultIncludeRenaming :: IncludeRenaming -- | Is an IncludeRenaming the default one? isDefaultIncludeRenaming :: IncludeRenaming -> Bool instance GHC.Generics.Generic Distribution.Types.IncludeRenaming.IncludeRenaming instance Data.Data.Data Distribution.Types.IncludeRenaming.IncludeRenaming instance GHC.Classes.Ord Distribution.Types.IncludeRenaming.IncludeRenaming instance GHC.Classes.Eq Distribution.Types.IncludeRenaming.IncludeRenaming instance GHC.Read.Read Distribution.Types.IncludeRenaming.IncludeRenaming instance GHC.Show.Show Distribution.Types.IncludeRenaming.IncludeRenaming instance Data.Binary.Class.Binary Distribution.Types.IncludeRenaming.IncludeRenaming instance Distribution.Text.Text Distribution.Types.IncludeRenaming.IncludeRenaming -- | A large and somewhat miscellaneous collection of utility functions -- used throughout the rest of the Cabal lib and in other tools that use -- the Cabal lib like cabal-install. It has a very simple set of -- logging actions. It has low level functions for running programs, a -- bunch of wrappers for various directory and file functions that do -- extra logging. module Distribution.Utils.Generic -- | Gets the contents of a file, but guarantee that it gets closed. -- -- The file is read lazily but if it is not fully consumed by the action -- then the remaining input is truncated and the file is closed. withFileContents :: FilePath -> (String -> NoCallStackIO a) -> NoCallStackIO a -- | Writes a file atomically. -- -- The file is either written successfully or an IO exception is raised -- and the original file is left unchanged. -- -- On windows it is not possible to delete a file that is open by a -- process. This case will give an IO exception but the atomic property -- is not affected. writeFileAtomic :: FilePath -> ByteString -> NoCallStackIO () fromUTF8 :: String -> String fromUTF8BS :: ByteString -> String fromUTF8LBS :: ByteString -> String toUTF8 :: String -> String -- | Reads a UTF8 encoded text file as a Unicode String -- -- Reads lazily using ordinary readFile. readUTF8File :: FilePath -> NoCallStackIO String -- | Reads a UTF8 encoded text file as a Unicode String -- -- Same behaviour as withFileContents. withUTF8FileContents :: FilePath -> (String -> IO a) -> IO a -- | Writes a Unicode String as a UTF8 encoded text file. -- -- Uses writeFileAtomic, so provides the same guarantees. writeUTF8File :: FilePath -> String -> NoCallStackIO () -- | Fix different systems silly line ending conventions normaliseLineEndings :: String -> String -- | Whether BOM is at the beginning of the input startsWithBOM :: String -> Bool -- | Check whether a file has Unicode byte order mark (BOM). fileHasBOM :: FilePath -> NoCallStackIO Bool -- | Ignore a Unicode byte order mark (BOM) at the beginning of the input ignoreBOM :: String -> String -- | dropWhileEndLE p is equivalent to reverse . dropWhile p . -- reverse, but quite a bit faster. The difference between -- "Data.List.dropWhileEnd" and this version is that the one in -- Data.List is strict in elements, but spine-lazy, while this one -- is spine-strict but lazy in elements. That's what LE stands -- for - "lazy in elements". -- -- Example: -- --
-- > tail $ Data.List.dropWhileEnd (<3) [undefined, 5, 4, 3, 2, 1] -- *** Exception: Prelude.undefined -- > tail $ dropWhileEndLE (<3) [undefined, 5, 4, 3, 2, 1] -- [5,4,3] -- > take 3 $ Data.List.dropWhileEnd (<3) [5, 4, 3, 2, 1, undefined] -- [5,4,3] -- > take 3 $ dropWhileEndLE (<3) [5, 4, 3, 2, 1, undefined] -- *** Exception: Prelude.undefined --dropWhileEndLE :: (a -> Bool) -> [a] -> [a] -- | takeWhileEndLE p is equivalent to reverse . takeWhile p . -- reverse, but is usually faster (as well as being easier to read). takeWhileEndLE :: (a -> Bool) -> [a] -> [a] equating :: Eq a => (b -> a) -> b -> b -> Bool -- |
-- 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 -- | The isInfixOf function takes two lists and returns True -- iff the first list is contained, wholly and intact, anywhere within -- the second. -- -- Example: -- --
-- isInfixOf "Haskell" "I really like Haskell." == True -- isInfixOf "Ial" "I really like Haskell." == False --isInfixOf :: Eq a => [a] -> [a] -> Bool -- | intercalate xs xss is equivalent to (concat -- (intersperse xs xss)). It inserts the list xs in -- between the lists in xss and concatenates the result. intercalate :: () => [a] -> [[a]] -> [a] lowercase :: String -> String -- | Like "Data.List.union", but has O(n log n) complexity instead -- of O(n^2). listUnion :: (Ord a) => [a] -> [a] -> [a] -- | A right-biased version of listUnion. -- -- Example: -- --
-- > listUnion [1,2,3,4,3] [2,1,1] -- [1,2,3,4,3] -- > listUnionRight [1,2,3,4,3] [2,1,1] -- [4,3,2,1,1] --listUnionRight :: (Ord a) => [a] -> [a] -> [a] -- | Like nub, but has O(n log n) complexity instead of -- O(n^2). Code for ordNub and listUnion taken -- from Niklas Hambüchen's ordnub package. ordNub :: Ord a => [a] -> [a] -- | Like ordNub and nubBy. Selects a key for each element -- and takes the nub based on that key. ordNubBy :: Ord b => (a -> b) -> [a] -> [a] -- | A right-biased version of ordNub. -- -- Example: -- --
-- > ordNub [1,2,1] -- [1,2] -- > ordNubRight [1,2,1] -- [2,1] --ordNubRight :: (Ord a) => [a] -> [a] -- | A total variant of tail. safeTail :: [a] -> [a] unintersperse :: Char -> String -> [String] -- | Wraps text to the default line width. Existing newlines are preserved. wrapText :: String -> String -- | Wraps a list of words to a list of lines of words of a particular -- width. wrapLine :: Int -> [String] -> [[String]] -- | isAbsoluteOnAnyPlatform and isRelativeOnAnyPlatform are -- like isAbsolute and isRelative but have platform -- independent heuristics. The System.FilePath exists in two versions, -- Windows and Posix. The two versions don't agree on what is a relative -- path and we don't know if we're given Windows or Posix paths. This -- results in false positives when running on Posix and inspecting -- Windows paths, like the hackage server does. -- System.FilePath.Posix.isAbsolute "C:\hello" == False -- System.FilePath.Windows.isAbsolute "/hello" == False This means that -- we would treat paths that start with "/" to be absolute. On Posix they -- are indeed absolute, while on Windows they are not. -- -- The portable versions should be used when we might deal with paths -- that are from another OS than the host OS. For example, the Hackage -- Server deals with both Windows and Posix paths while performing the -- PackageDescription checks. In contrast, when we run 'cabal configure' -- we do expect the paths to be correct for our OS and we should not have -- to use the platform independent heuristics. isAbsoluteOnAnyPlatform :: FilePath -> Bool -- |
-- isRelativeOnAnyPlatform = not . isAbsoluteOnAnyPlatform --isRelativeOnAnyPlatform :: FilePath -> Bool -- | A Verbosity type with associated utilities. -- -- There are 4 standard verbosity levels from silent, -- normal, verbose up to deafening. This is used for -- deciding what logging messages to print. -- -- Verbosity also is equipped with some internal settings which can be -- used to control at a fine granularity the verbosity of specific -- settings (e.g., so that you can trace only particular things you are -- interested in.) It's important to note that the instances for -- Verbosity assume that this does not exist. module Distribution.Verbosity data Verbosity silent :: Verbosity normal :: Verbosity verbose :: Verbosity deafening :: Verbosity moreVerbose :: Verbosity -> Verbosity lessVerbose :: Verbosity -> Verbosity -- | Test if we had called lessVerbose on the verbosity isVerboseQuiet :: Verbosity -> Bool intToVerbosity :: Int -> Maybe Verbosity flagToVerbosity :: ReadE Verbosity showForCabal :: Verbosity -> String showForGHC :: Verbosity -> String verboseNoFlags :: Verbosity -> Verbosity verboseHasFlags :: Verbosity -> Bool -- | Turn on verbose call-site printing when we log. verboseCallSite :: Verbosity -> Verbosity -- | Turn on verbose call-stack printing when we log. verboseCallStack :: Verbosity -> Verbosity -- | Test if we should output call sites when we log. isVerboseCallSite :: Verbosity -> Bool -- | Test if we should output call stacks when we log. isVerboseCallStack :: Verbosity -> Bool -- | Turn on -----BEGIN CABAL OUTPUT----- markers for output from -- Cabal (as opposed to GHC, or system dependent). verboseMarkOutput :: Verbosity -> Verbosity -- | Test if we should output markets. isVerboseMarkOutput :: Verbosity -> Bool -- | Turn off marking; useful for suppressing nondeterministic output. verboseUnmarkOutput :: Verbosity -> Verbosity -- | Disable line-wrapping for log messages. verboseNoWrap :: Verbosity -> Verbosity -- | Test if line-wrapping is disabled for log messages. isVerboseNoWrap :: Verbosity -> Bool instance GHC.Generics.Generic Distribution.Verbosity.Verbosity instance GHC.Enum.Bounded Distribution.Verbosity.VerbosityFlag instance GHC.Enum.Enum Distribution.Verbosity.VerbosityFlag instance GHC.Classes.Ord Distribution.Verbosity.VerbosityFlag instance GHC.Classes.Eq Distribution.Verbosity.VerbosityFlag instance GHC.Read.Read Distribution.Verbosity.VerbosityFlag instance GHC.Show.Show Distribution.Verbosity.VerbosityFlag instance GHC.Generics.Generic Distribution.Verbosity.VerbosityFlag instance GHC.Enum.Bounded Distribution.Verbosity.VerbosityLevel instance GHC.Enum.Enum Distribution.Verbosity.VerbosityLevel instance GHC.Classes.Ord Distribution.Verbosity.VerbosityLevel instance GHC.Classes.Eq Distribution.Verbosity.VerbosityLevel instance GHC.Read.Read Distribution.Verbosity.VerbosityLevel instance GHC.Show.Show Distribution.Verbosity.VerbosityLevel instance GHC.Generics.Generic Distribution.Verbosity.VerbosityLevel instance GHC.Show.Show Distribution.Verbosity.Verbosity instance GHC.Read.Read Distribution.Verbosity.Verbosity instance GHC.Classes.Eq Distribution.Verbosity.Verbosity instance GHC.Classes.Ord Distribution.Verbosity.Verbosity instance GHC.Enum.Enum Distribution.Verbosity.Verbosity instance GHC.Enum.Bounded Distribution.Verbosity.Verbosity instance Data.Binary.Class.Binary Distribution.Verbosity.Verbosity instance Data.Binary.Class.Binary Distribution.Verbosity.VerbosityFlag instance Data.Binary.Class.Binary Distribution.Verbosity.VerbosityLevel -- | Exports the Version type along with a parser and pretty -- printer. A version is something like "1.3.3". It also defines -- the VersionRange data types. Version ranges are like ">= -- 1.2 && < 2". module Distribution.Version -- | A Version represents the version of a software entity. -- -- Instances of Eq and Ord are provided, which gives exact -- equality and lexicographic ordering of the version number components -- (i.e. 2.1 > 2.0, 1.2.3 > 1.2.2, etc.). -- -- This type is opaque and distinct from the Version type in -- Data.Version since Cabal-2.0. The difference extends -- to the Binary instance using a different (and more compact) -- encoding. data Version -- | Construct Version from list of version number components. -- -- For instance, mkVersion [3,2,1] constructs a Version -- representing the version 3.2.1. -- -- All version components must be non-negative. mkVersion [] -- currently represents the special null version; see also -- nullVersion. mkVersion :: [Int] -> Version -- | Variant of Version which converts a Data.Version -- Version into Cabal's Version type. mkVersion' :: Version -> Version -- | Unpack Version into list of version number components. -- -- This is the inverse to mkVersion, so the following holds: -- --
-- (versionNumbers . mkVersion) vs == vs --versionNumbers :: Version -> [Int] -- | Constant representing the special null Version -- -- The nullVersion compares (via Ord) as less than every -- proper Version value. nullVersion :: Version -- | Apply function to list of version number components -- --
-- alterVersion f == mkVersion . f . versionNumbers --alterVersion :: ([Int] -> [Int]) -> Version -> Version showVersion :: Version -> String data VersionRange -- | Deprecated: Use anyVersion, foldVersionRange or -- asVersionIntervals AnyVersion :: VersionRange -- | Deprecated: Use thisVersion, foldVersionRange or -- asVersionIntervals ThisVersion :: Version -> VersionRange -- | Deprecated: Use laterVersion, foldVersionRange or -- asVersionIntervals LaterVersion :: Version -> VersionRange -- | Deprecated: Use earlierVersion, foldVersionRange or -- asVersionIntervals EarlierVersion :: Version -> VersionRange -- | Deprecated: Use anyVersion, foldVersionRange or -- asVersionIntervals WildcardVersion :: Version -> VersionRange MajorBoundVersion :: Version -> VersionRange -- | Deprecated: Use unionVersionRanges, foldVersionRange -- or asVersionIntervals UnionVersionRanges :: VersionRange -> VersionRange -> VersionRange -- | Deprecated: Use intersectVersionRanges, -- foldVersionRange or asVersionIntervals IntersectVersionRanges :: VersionRange -> VersionRange -> VersionRange VersionRangeParens :: VersionRange -> VersionRange -- | The version range -any. That is, a version range containing -- all versions. -- --
-- withinRange v anyVersion = True --anyVersion :: VersionRange -- | The empty version range, that is a version range containing no -- versions. -- -- This can be constructed using any unsatisfiable version range -- expression, for example > 1 && < 1. -- --
-- withinRange v noVersion = False --noVersion :: VersionRange -- | The version range == v -- --
-- withinRange v' (thisVersion v) = v' == v --thisVersion :: Version -> VersionRange -- | The version range || v -- --
-- withinRange v' (notThisVersion v) = v' /= v --notThisVersion :: Version -> VersionRange -- | The version range > v -- --
-- withinRange v' (laterVersion v) = v' > v --laterVersion :: Version -> VersionRange -- | The version range < v -- --
-- withinRange v' (earlierVersion v) = v' < v --earlierVersion :: Version -> VersionRange -- | The version range >= v -- --
-- withinRange v' (orLaterVersion v) = v' >= v --orLaterVersion :: Version -> VersionRange -- | The version range <= v -- --
-- withinRange v' (orEarlierVersion v) = v' <= v --orEarlierVersion :: Version -> VersionRange -- | The version range vr1 || vr2 -- --
-- withinRange v' (unionVersionRanges vr1 vr2) -- = withinRange v' vr1 || withinRange v' vr2 --unionVersionRanges :: VersionRange -> VersionRange -> VersionRange -- | The version range vr1 && vr2 -- --
-- withinRange v' (intersectVersionRanges vr1 vr2) -- = withinRange v' vr1 && withinRange v' vr2 --intersectVersionRanges :: VersionRange -> VersionRange -> VersionRange -- | The difference of two version ranges -- --
-- withinRange v' (differenceVersionRanges vr1 vr2) -- = withinRange v' vr1 && not (withinRange v' vr2) --differenceVersionRanges :: VersionRange -> VersionRange -> VersionRange -- | The inverse of a version range -- --
-- withinRange v' (invertVersionRange vr) -- = not (withinRange v' vr) --invertVersionRange :: VersionRange -> VersionRange -- | The version range == v.*. -- -- For example, for version 1.2, the version range == -- 1.2.* is the same as >= 1.2 && < 1.3 -- --
-- withinRange v' (laterVersion v) = v' >= v && v' < upper v -- where -- upper (Version lower t) = Version (init lower ++ [last lower + 1]) t --withinVersion :: Version -> VersionRange -- | The version range ^>= v. -- -- For example, for version 1.2.3.4, the version range -- ^>= 1.2.3.4 is the same as >= 1.2.3.4 && -- < 1.3. -- -- Note that ^>= 1 is equivalent to >= 1 && -- < 1.1. -- --
-- since 2.0 --majorBoundVersion :: Version -> VersionRange -- | Deprecated: In practice this is not very useful because we normally -- use inclusive lower bounds and exclusive upper bounds betweenVersionsInclusive :: Version -> Version -> VersionRange -- | Does this version fall within the given range? -- -- This is the evaluation function for the VersionRange type. withinRange :: Version -> VersionRange -> Bool -- | Does this VersionRange place any restriction on the -- Version or is it in fact equivalent to AnyVersion. -- -- Note this is a semantic check, not simply a syntactic check. So for -- example the following is True (for all v). -- --
-- isAnyVersion (EarlierVersion v `UnionVersionRanges` orLaterVersion v) --isAnyVersion :: VersionRange -> Bool -- | This is the converse of isAnyVersion. It check if the version -- range is empty, if there is no possible version that satisfies the -- version range. -- -- For example this is True (for all v): -- --
-- isNoVersion (EarlierVersion v `IntersectVersionRanges` LaterVersion v) --isNoVersion :: VersionRange -> Bool -- | Is this version range in fact just a specific version? -- -- For example the version range ">= 3 && <= 3" -- contains only the version 3. isSpecificVersion :: VersionRange -> Maybe Version -- | Simplify a VersionRange expression. For non-empty version -- ranges this produces a canonical form. Empty or inconsistent version -- ranges are left as-is because that provides more information. -- -- If you need a canonical form use fromVersionIntervals . -- toVersionIntervals -- -- It satisfies the following properties: -- --
-- withinRange v (simplifyVersionRange r) = withinRange v r ---- --
-- withinRange v r = withinRange v r' -- ==> simplifyVersionRange r = simplifyVersionRange r' -- || isNoVersion r -- || isNoVersion r' --simplifyVersionRange :: VersionRange -> VersionRange -- | Fold over the basic syntactic structure of a VersionRange. -- -- This provides a syntactic view of the expression defining the version -- range. The syntactic sugar ">= v", "<= v" and -- "== v.*" is presented in terms of the other basic syntax. -- -- For a semantic view use asVersionIntervals. foldVersionRange :: a -> (Version -> a) -> (Version -> a) -> (Version -> a) -> (a -> a -> a) -> (a -> a -> a) -> VersionRange -> a -- | An extended variant of foldVersionRange that also provides a -- view of the expression in which the syntactic sugar ">= -- v", "<= v" and "== v.*" is presented -- explicitly rather than in terms of the other basic syntax. foldVersionRange' :: a -> (Version -> a) -> (Version -> a) -> (Version -> a) -> (Version -> a) -> (Version -> a) -> (Version -> Version -> a) -> (Version -> Version -> a) -> (a -> a -> a) -> (a -> a -> a) -> (a -> a) -> VersionRange -> a -- | Does the version range have an upper bound? hasUpperBound :: VersionRange -> Bool -- | Does the version range have an explicit lower bound? -- -- Note: this function only considers the user-specified lower bounds, -- but not the implicit >=0 lower bound. hasLowerBound :: VersionRange -> Bool -- | Given a version range, remove the highest upper bound. Example: -- (>= 1 && < 3) || (>= 4 && < 5) is -- converted to (>= 1 && || (= 4). removeUpperBound :: VersionRange -> VersionRange -- | Given a version range, remove the lowest lower bound. Example: -- (>= 1 && || (= 4 && < 5) is -- converted to (>= 0 && || (= 4 && < -- 5). removeLowerBound :: VersionRange -> VersionRange -- | View a VersionRange as a union of intervals. -- -- This provides a canonical view of the semantics of a -- VersionRange as opposed to the syntax of the expression used to -- define it. For the syntactic view use foldVersionRange. -- -- Each interval is non-empty. The sequence is in increasing order and no -- intervals overlap or touch. Therefore only the first and last can be -- unbounded. The sequence can be empty if the range is empty (e.g. a -- range expression like && 2). -- -- Other checks are trivial to implement using this view. For example: -- --
-- isNoVersion vr | [] <- asVersionIntervals vr = True -- | otherwise = False ---- --
-- isSpecificVersion vr -- | [(LowerBound v InclusiveBound -- ,UpperBound v' InclusiveBound)] <- asVersionIntervals vr -- , v == v' = Just v -- | otherwise = Nothing --asVersionIntervals :: VersionRange -> [VersionInterval] type VersionInterval = (LowerBound, UpperBound) data LowerBound LowerBound :: Version -> !Bound -> LowerBound data UpperBound NoUpperBound :: UpperBound UpperBound :: Version -> !Bound -> UpperBound data Bound ExclusiveBound :: Bound InclusiveBound :: Bound -- | A complementary representation of a VersionRange. Instead of a -- boolean version predicate it uses an increasing sequence of -- non-overlapping, non-empty intervals. -- -- The key point is that this representation gives a canonical -- representation for the semantics of VersionRanges. This makes -- it easier to check things like whether a version range is empty, -- covers all versions, or requires a certain minimum or maximum version. -- It also makes it easy to check equality or containment. It also makes -- it easier to identify 'simple' version predicates for translation into -- foreign packaging systems that do not support complex version range -- expressions. data VersionIntervals -- | Convert a VersionRange to a sequence of version intervals. toVersionIntervals :: VersionRange -> VersionIntervals -- | Convert a VersionIntervals value back into a -- VersionRange expression representing the version intervals. fromVersionIntervals :: VersionIntervals -> VersionRange -- | Test if a version falls within the version intervals. -- -- It exists mostly for completeness and testing. It satisfies the -- following properties: -- --
-- withinIntervals v (toVersionIntervals vr) = withinRange v vr -- withinIntervals v ivs = withinRange v (fromVersionIntervals ivs) --withinIntervals :: Version -> VersionIntervals -> Bool -- | Inspect the list of version intervals. versionIntervals :: VersionIntervals -> [VersionInterval] -- | Directly construct a VersionIntervals from a list of intervals. -- -- Each interval must be non-empty. The sequence must be in increasing -- order and no intervals may overlap or touch. If any of these -- conditions are not satisfied the function returns Nothing. mkVersionIntervals :: [VersionInterval] -> Maybe VersionIntervals unionVersionIntervals :: VersionIntervals -> VersionIntervals -> VersionIntervals intersectVersionIntervals :: VersionIntervals -> VersionIntervals -> VersionIntervals invertVersionIntervals :: VersionIntervals -> VersionIntervals instance GHC.Show.Show Distribution.Version.VersionIntervals instance GHC.Classes.Eq Distribution.Version.VersionIntervals instance GHC.Show.Show Distribution.Version.LowerBound instance GHC.Classes.Eq Distribution.Version.LowerBound instance GHC.Show.Show Distribution.Version.UpperBound instance GHC.Classes.Eq Distribution.Version.UpperBound instance GHC.Show.Show Distribution.Version.Bound instance GHC.Classes.Eq Distribution.Version.Bound instance GHC.Show.Show Distribution.Version.VersionRange instance GHC.Read.Read Distribution.Version.VersionRange instance GHC.Generics.Generic Distribution.Version.VersionRange instance GHC.Classes.Eq Distribution.Version.VersionRange instance Data.Data.Data Distribution.Version.VersionRange instance GHC.Generics.Generic Distribution.Version.Version instance GHC.Classes.Eq Distribution.Version.Version instance Data.Data.Data Distribution.Version.Version instance GHC.Classes.Ord Distribution.Version.LowerBound instance GHC.Classes.Ord Distribution.Version.UpperBound instance Data.Binary.Class.Binary Distribution.Version.VersionRange instance Control.DeepSeq.NFData Distribution.Version.VersionRange instance Distribution.Text.Text Distribution.Version.VersionRange instance GHC.Classes.Ord Distribution.Version.Version instance GHC.Show.Show Distribution.Version.Version instance GHC.Read.Read Distribution.Version.Version instance Data.Binary.Class.Binary Distribution.Version.Version instance Control.DeepSeq.NFData Distribution.Version.Version instance Distribution.Text.Text Distribution.Version.Version module Distribution.Types.TestType -- | The "test-type" field in the test suite stanza. data TestType -- | "type: exitcode-stdio-x.y" TestTypeExe :: Version -> TestType -- | "type: detailed-x.y" TestTypeLib :: Version -> TestType -- | Some unknown test type e.g. "type: foo" TestTypeUnknown :: String -> Version -> TestType knownTestTypes :: [TestType] instance Data.Data.Data Distribution.Types.TestType.TestType instance GHC.Classes.Eq Distribution.Types.TestType.TestType instance GHC.Read.Read Distribution.Types.TestType.TestType instance GHC.Show.Show Distribution.Types.TestType.TestType instance GHC.Generics.Generic Distribution.Types.TestType.TestType instance Data.Binary.Class.Binary Distribution.Types.TestType.TestType instance Distribution.Text.Text Distribution.Types.TestType.TestType module Distribution.Types.TestSuiteInterface -- | The test suite interfaces that are currently defined. Each test suite -- must specify which interface it supports. -- -- More interfaces may be defined in future, either new revisions or -- totally new interfaces. data TestSuiteInterface -- | Test interface "exitcode-stdio-1.0". The test-suite takes the form of -- an executable. It returns a zero exit code for success, non-zero for -- failure. The stdout and stderr channels may be logged. It takes no -- command line parameters and nothing on stdin. TestSuiteExeV10 :: Version -> FilePath -> TestSuiteInterface -- | Test interface "detailed-0.9". The test-suite takes the form of a -- library containing a designated module that exports "tests :: [Test]". TestSuiteLibV09 :: Version -> ModuleName -> TestSuiteInterface -- | A test suite that does not conform to one of the above interfaces for -- the given reason (e.g. unknown test type). TestSuiteUnsupported :: TestType -> TestSuiteInterface instance Data.Data.Data Distribution.Types.TestSuiteInterface.TestSuiteInterface instance GHC.Show.Show Distribution.Types.TestSuiteInterface.TestSuiteInterface instance GHC.Read.Read Distribution.Types.TestSuiteInterface.TestSuiteInterface instance GHC.Generics.Generic Distribution.Types.TestSuiteInterface.TestSuiteInterface instance GHC.Classes.Eq Distribution.Types.TestSuiteInterface.TestSuiteInterface instance Data.Binary.Class.Binary Distribution.Types.TestSuiteInterface.TestSuiteInterface instance GHC.Base.Monoid Distribution.Types.TestSuiteInterface.TestSuiteInterface instance Data.Semigroup.Semigroup Distribution.Types.TestSuiteInterface.TestSuiteInterface module Distribution.Types.PkgconfigDependency -- | Describes a dependency on a pkg-config library data PkgconfigDependency PkgconfigDependency :: PkgconfigName -> VersionRange -> PkgconfigDependency instance Data.Data.Data Distribution.Types.PkgconfigDependency.PkgconfigDependency instance GHC.Classes.Eq Distribution.Types.PkgconfigDependency.PkgconfigDependency instance GHC.Show.Show Distribution.Types.PkgconfigDependency.PkgconfigDependency instance GHC.Read.Read Distribution.Types.PkgconfigDependency.PkgconfigDependency instance GHC.Generics.Generic Distribution.Types.PkgconfigDependency.PkgconfigDependency instance Data.Binary.Class.Binary Distribution.Types.PkgconfigDependency.PkgconfigDependency instance Control.DeepSeq.NFData Distribution.Types.PkgconfigDependency.PkgconfigDependency instance Distribution.Text.Text Distribution.Types.PkgconfigDependency.PkgconfigDependency module Distribution.Types.BenchmarkType -- | The "benchmark-type" field in the benchmark stanza. data BenchmarkType -- | "type: exitcode-stdio-x.y" BenchmarkTypeExe :: Version -> BenchmarkType -- | Some unknown benchmark type e.g. "type: foo" BenchmarkTypeUnknown :: String -> Version -> BenchmarkType knownBenchmarkTypes :: [BenchmarkType] instance Data.Data.Data Distribution.Types.BenchmarkType.BenchmarkType instance GHC.Classes.Eq Distribution.Types.BenchmarkType.BenchmarkType instance GHC.Read.Read Distribution.Types.BenchmarkType.BenchmarkType instance GHC.Show.Show Distribution.Types.BenchmarkType.BenchmarkType instance GHC.Generics.Generic Distribution.Types.BenchmarkType.BenchmarkType instance Data.Binary.Class.Binary Distribution.Types.BenchmarkType.BenchmarkType instance Distribution.Text.Text Distribution.Types.BenchmarkType.BenchmarkType module Distribution.Types.BenchmarkInterface -- | The benchmark interfaces that are currently defined. Each benchmark -- must specify which interface it supports. -- -- More interfaces may be defined in future, either new revisions or -- totally new interfaces. data BenchmarkInterface -- | Benchmark interface "exitcode-stdio-1.0". The benchmark takes the form -- of an executable. It returns a zero exit code for success, non-zero -- for failure. The stdout and stderr channels may be logged. It takes no -- command line parameters and nothing on stdin. BenchmarkExeV10 :: Version -> FilePath -> BenchmarkInterface -- | A benchmark that does not conform to one of the above interfaces for -- the given reason (e.g. unknown benchmark type). BenchmarkUnsupported :: BenchmarkType -> BenchmarkInterface instance Data.Data.Data Distribution.Types.BenchmarkInterface.BenchmarkInterface instance GHC.Show.Show Distribution.Types.BenchmarkInterface.BenchmarkInterface instance GHC.Read.Read Distribution.Types.BenchmarkInterface.BenchmarkInterface instance GHC.Generics.Generic Distribution.Types.BenchmarkInterface.BenchmarkInterface instance GHC.Classes.Eq Distribution.Types.BenchmarkInterface.BenchmarkInterface instance Data.Binary.Class.Binary Distribution.Types.BenchmarkInterface.BenchmarkInterface instance GHC.Base.Monoid Distribution.Types.BenchmarkInterface.BenchmarkInterface instance Data.Semigroup.Semigroup Distribution.Types.BenchmarkInterface.BenchmarkInterface -- | Package descriptions contain fields for specifying the name of a -- software license and the name of the file containing the text of that -- license. While package authors may choose any license they like, Cabal -- provides an enumeration of a small set of common free and open source -- software licenses. This is done so that Hackage can recognise -- licenses, so that tools can detect licensing conflicts, and to -- deter license proliferation. -- -- It is recommended that all package authors use the -- license-file or license-files fields in their -- package descriptions. Further information about these fields can be -- found in the Cabal users guide. -- --
-- import "network" Network.Socket ---- -- PackageImports :: KnownExtension -- | (deprecated) Allow a type variable to be instantiated at a -- polymorphic type. -- -- ImpredicativeTypes :: KnownExtension -- | (deprecated) Change the syntax for qualified infix operators. -- --
-- import safe Network.Socket ---- -- SafeImports :: KnownExtension -- | Compile a module in the Safe, Safe Haskell mode -- a restricted form -- of the Haskell language to ensure type safety. -- -- Safe :: KnownExtension -- | Compile a module in the Trustworthy, Safe Haskell mode -- no -- restrictions apply but the module is marked as trusted as long as the -- package the module resides in is trusted. -- -- Trustworthy :: KnownExtension -- | Compile a module in the Unsafe, Safe Haskell mode so that modules -- compiled using Safe, Safe Haskell mode can't import it. -- -- Unsafe :: KnownExtension -- | Allow type classimplicit parameterequality constraints to be -- used as types with the special kind constraint. Also generalise the -- (ctxt => ty) syntax so that any type of kind constraint -- can occur before the arrow. -- -- ConstraintKinds :: KnownExtension -- | Enable kind polymorphism. -- -- PolyKinds :: KnownExtension -- | Enable datatype promotion. -- -- DataKinds :: KnownExtension -- | Enable parallel arrays syntax ([:, :]) for Data -- Parallel Haskell. -- -- ParallelArrays :: KnownExtension -- | Enable explicit role annotations, like in (type role Foo -- representational representational). -- -- RoleAnnotations :: KnownExtension -- | Enable overloading of list literals, arithmetic sequences and list -- patterns using the IsList type class. -- --
-- case compilerFlavor comp of -- GHC -> GHC.getInstalledPackages verbosity packageDb progdb -- JHC -> JHC.getInstalledPackages verbosity packageDb progdb ---- -- Obviously it would be better to use the proper Compiler -- abstraction because that would keep all the compiler-specific code -- together. Unfortunately we cannot make this change yet without -- breaking the UserHooks api, which would break all custom -- Setup.hs files, so for the moment we just have to live with -- this deficiency. If you're interested, see ticket #57. module Distribution.Compiler data CompilerFlavor GHC :: CompilerFlavor GHCJS :: CompilerFlavor NHC :: CompilerFlavor YHC :: CompilerFlavor Hugs :: CompilerFlavor HBC :: CompilerFlavor Helium :: CompilerFlavor JHC :: CompilerFlavor LHC :: CompilerFlavor UHC :: CompilerFlavor HaskellSuite :: String -> CompilerFlavor OtherCompiler :: String -> CompilerFlavor buildCompilerId :: CompilerId buildCompilerFlavor :: CompilerFlavor -- | The default compiler flavour to pick when compiling stuff. This -- defaults to the compiler used to build the Cabal lib. -- -- However if it's not a recognised compiler then it's Nothing and -- the user will have to specify which compiler they want. defaultCompilerFlavor :: Maybe CompilerFlavor -- | Like classifyCompilerFlavor but compatible with the old ReadS -- parser. -- -- It is compatible in the sense that it accepts only the same strings, -- eg GHC but not "ghc". However other strings get mapped to -- OtherCompiler. The point of this is that we do not allow extra -- valid values that would upset older Cabal versions that had a stricter -- parser however we cope with new values more gracefully so that we'll -- be able to introduce new value in future without breaking things so -- much. parseCompilerFlavorCompat :: ReadP r CompilerFlavor classifyCompilerFlavor :: String -> CompilerFlavor data CompilerId CompilerId :: CompilerFlavor -> Version -> CompilerId -- | Compiler information used for resolving configurations. Some fields -- can be set to Nothing to indicate that the information is unknown. data CompilerInfo CompilerInfo :: CompilerId -> AbiTag -> Maybe [CompilerId] -> Maybe [Language] -> Maybe [Extension] -> CompilerInfo -- | Compiler flavour and version. [compilerInfoId] :: CompilerInfo -> CompilerId -- | Tag for distinguishing incompatible ABI's on the same architecture/os. [compilerInfoAbiTag] :: CompilerInfo -> AbiTag -- | Other implementations that this compiler claims to be compatible with, -- if known. [compilerInfoCompat] :: CompilerInfo -> Maybe [CompilerId] -- | Supported language standards, if known. [compilerInfoLanguages] :: CompilerInfo -> Maybe [Language] -- | Supported extensions, if known. [compilerInfoExtensions] :: CompilerInfo -> Maybe [Extension] -- | Make a CompilerInfo of which only the known information is its -- CompilerId, its AbiTag and that it does not claim to be compatible -- with other compiler id's. unknownCompilerInfo :: CompilerId -> AbiTag -> CompilerInfo data AbiTag NoAbiTag :: AbiTag AbiTag :: String -> AbiTag abiTagString :: AbiTag -> String instance GHC.Read.Read Distribution.Compiler.CompilerInfo instance GHC.Show.Show Distribution.Compiler.CompilerInfo instance GHC.Generics.Generic Distribution.Compiler.CompilerInfo instance GHC.Read.Read Distribution.Compiler.AbiTag instance GHC.Show.Show Distribution.Compiler.AbiTag instance GHC.Generics.Generic Distribution.Compiler.AbiTag instance GHC.Classes.Eq Distribution.Compiler.AbiTag instance GHC.Show.Show Distribution.Compiler.CompilerId instance GHC.Read.Read Distribution.Compiler.CompilerId instance GHC.Classes.Ord Distribution.Compiler.CompilerId instance GHC.Generics.Generic Distribution.Compiler.CompilerId instance GHC.Classes.Eq Distribution.Compiler.CompilerId instance Data.Data.Data Distribution.Compiler.CompilerFlavor instance GHC.Classes.Ord Distribution.Compiler.CompilerFlavor instance GHC.Classes.Eq Distribution.Compiler.CompilerFlavor instance GHC.Read.Read Distribution.Compiler.CompilerFlavor instance GHC.Show.Show Distribution.Compiler.CompilerFlavor instance GHC.Generics.Generic Distribution.Compiler.CompilerFlavor instance Data.Binary.Class.Binary Distribution.Compiler.CompilerInfo instance Data.Binary.Class.Binary Distribution.Compiler.AbiTag instance Distribution.Text.Text Distribution.Compiler.AbiTag instance Data.Binary.Class.Binary Distribution.Compiler.CompilerId instance Distribution.Text.Text Distribution.Compiler.CompilerId instance Data.Binary.Class.Binary Distribution.Compiler.CompilerFlavor instance Distribution.Text.Text Distribution.Compiler.CompilerFlavor module Distribution.Types.PackageName -- | A package name. -- -- Use mkPackageName and unPackageName to convert from/to a -- String. -- -- This type is opaque since Cabal-2.0 data PackageName -- | Convert PackageName to String unPackageName :: PackageName -> String -- | Construct a PackageName from a String -- -- mkPackageName is the inverse to unPackageName -- -- Note: No validations are performed to ensure that the resulting -- PackageName is valid mkPackageName :: String -> PackageName instance Data.Data.Data Distribution.Types.PackageName.PackageName instance GHC.Classes.Ord Distribution.Types.PackageName.PackageName instance GHC.Classes.Eq Distribution.Types.PackageName.PackageName instance GHC.Show.Show Distribution.Types.PackageName.PackageName instance GHC.Read.Read Distribution.Types.PackageName.PackageName instance GHC.Generics.Generic Distribution.Types.PackageName.PackageName instance Data.String.IsString Distribution.Types.PackageName.PackageName instance Data.Binary.Class.Binary Distribution.Types.PackageName.PackageName instance Distribution.Text.Text Distribution.Types.PackageName.PackageName instance Control.DeepSeq.NFData Distribution.Types.PackageName.PackageName module Distribution.Types.UnqualComponentName -- | An unqualified component name, for any kind of component. -- -- This is distinguished from a ComponentName and -- ComponentId. The former also states which of a library, -- executable, etc the name refers too. The later uniquely identifiers a -- component and its closure. data UnqualComponentName -- | Convert UnqualComponentName to String unUnqualComponentName :: UnqualComponentName -> String -- | Construct a UnqualComponentName from a String -- -- mkUnqualComponentName is the inverse to -- unUnqualComponentName -- -- Note: No validations are performed to ensure that the resulting -- UnqualComponentName is valid mkUnqualComponentName :: String -> UnqualComponentName -- | Converts a package name to an unqualified component name -- -- Useful in legacy situations where a package name may refer to an -- internal component, if one is defined with that name. packageNameToUnqualComponentName :: PackageName -> UnqualComponentName -- | Converts an unqualified component name to a package name -- -- packageNameToUnqualComponentName is the inverse of -- unqualComponentNameToPackageName. -- -- Useful in legacy situations where a package name may refer to an -- internal component, if one is defined with that name. unqualComponentNameToPackageName :: UnqualComponentName -> PackageName instance GHC.Base.Monoid Distribution.Types.UnqualComponentName.UnqualComponentName instance Data.Semigroup.Semigroup Distribution.Types.UnqualComponentName.UnqualComponentName instance Data.Data.Data Distribution.Types.UnqualComponentName.UnqualComponentName instance GHC.Classes.Ord Distribution.Types.UnqualComponentName.UnqualComponentName instance GHC.Classes.Eq Distribution.Types.UnqualComponentName.UnqualComponentName instance GHC.Show.Show Distribution.Types.UnqualComponentName.UnqualComponentName instance GHC.Read.Read Distribution.Types.UnqualComponentName.UnqualComponentName instance GHC.Generics.Generic Distribution.Types.UnqualComponentName.UnqualComponentName instance Data.String.IsString Distribution.Types.UnqualComponentName.UnqualComponentName instance Data.Binary.Class.Binary Distribution.Types.UnqualComponentName.UnqualComponentName instance Distribution.Text.Text Distribution.Types.UnqualComponentName.UnqualComponentName instance Control.DeepSeq.NFData Distribution.Types.UnqualComponentName.UnqualComponentName module Distribution.Types.ComponentName data ComponentName CLibName :: ComponentName CSubLibName :: UnqualComponentName -> ComponentName CFLibName :: UnqualComponentName -> ComponentName CExeName :: UnqualComponentName -> ComponentName CTestName :: UnqualComponentName -> ComponentName CBenchName :: UnqualComponentName -> ComponentName defaultLibName :: ComponentName -- | Convert the UnqualComponentName of a library into a -- ComponentName. libraryComponentName :: Maybe UnqualComponentName -> ComponentName showComponentName :: ComponentName -> String componentNameStanza :: ComponentName -> String -- | This gets the underlying unqualified component name. In fact, it is -- guaranteed to uniquely identify a component, returning -- Nothing if the ComponentName was for the public -- library. componentNameString :: ComponentName -> Maybe UnqualComponentName instance GHC.Show.Show Distribution.Types.ComponentName.ComponentName instance GHC.Read.Read Distribution.Types.ComponentName.ComponentName instance GHC.Classes.Ord Distribution.Types.ComponentName.ComponentName instance GHC.Generics.Generic Distribution.Types.ComponentName.ComponentName instance GHC.Classes.Eq Distribution.Types.ComponentName.ComponentName instance Data.Binary.Class.Binary Distribution.Types.ComponentName.ComponentName instance Distribution.Text.Text Distribution.Types.ComponentName.ComponentName module Distribution.Types.PackageId -- | The name and version of a package. data PackageIdentifier PackageIdentifier :: PackageName -> Version -> PackageIdentifier -- | The name of this package, eg. foo [pkgName] :: PackageIdentifier -> PackageName -- | the version of this package, eg 1.2 [pkgVersion] :: PackageIdentifier -> Version -- | Type alias so we can use the shorter name PackageId. type PackageId = PackageIdentifier instance Data.Data.Data Distribution.Types.PackageId.PackageIdentifier instance GHC.Classes.Ord Distribution.Types.PackageId.PackageIdentifier instance GHC.Classes.Eq Distribution.Types.PackageId.PackageIdentifier instance GHC.Show.Show Distribution.Types.PackageId.PackageIdentifier instance GHC.Read.Read Distribution.Types.PackageId.PackageIdentifier instance GHC.Generics.Generic Distribution.Types.PackageId.PackageIdentifier instance Data.Binary.Class.Binary Distribution.Types.PackageId.PackageIdentifier instance Distribution.Text.Text Distribution.Types.PackageId.PackageIdentifier instance Control.DeepSeq.NFData Distribution.Types.PackageId.PackageIdentifier module Distribution.Types.UnitId -- | A unit identifier identifies a (possibly instantiated) -- package/component that can be installed the installed package -- database. There are several types of components that can be installed: -- --
-- build-depends: base >= 4.0 -- if flag(extra) -- build-depends: base >= 4.2 ---- -- One way to represent this is to have CondTree -- ConfVar [Dependency] BuildInfo. Here, -- condTreeData represents the actual fields which are not behind -- any conditional, while condTreeComponents recursively records -- any further fields which are behind a conditional. -- condTreeConstraints records the constraints (in this case, -- base >= 4.0) which would be applied if you use this -- syntax; in general, this is derived off of targetBuildInfo -- (perhaps a good refactoring would be to convert this into an opaque -- type, with a smart constructor that pre-computes the dependencies.) data CondTree v c a CondNode :: a -> c -> [CondBranch v c a] -> CondTree v c a [condTreeData] :: CondTree v c a -> a [condTreeConstraints] :: CondTree v c a -> c [condTreeComponents] :: CondTree v c a -> [CondBranch v c a] -- | A ConfVar represents the variable type used. data ConfVar OS :: OS -> ConfVar Arch :: Arch -> ConfVar Flag :: FlagName -> ConfVar Impl :: CompilerFlavor -> VersionRange -> ConfVar -- | A boolean expression parameterized over the variable type used. data Condition c Var :: c -> Condition c Lit :: Bool -> Condition c CNot :: (Condition c) -> Condition c COr :: (Condition c) -> (Condition c) -> Condition c CAnd :: (Condition c) -> (Condition c) -> Condition c -- | Boolean negation of a Condition value. cNot :: Condition a -> Condition a -- | Boolean AND of two Condtion values. cAnd :: Condition a -> Condition a -> Condition a -- | Boolean OR of two Condition values. cOr :: Eq v => Condition v -> Condition v -> Condition v -- | Information about the source revision control system for a package. -- -- When specifying a repo it is useful to know the meaning or intention -- of the information as doing so enables automation. There are two -- obvious common purposes: one is to find the repo for the latest -- development version, the other is to find the repo for this specific -- release. The ReopKind specifies which one we mean (or another -- custom one). -- -- A package can specify one or the other kind or both. Most will specify -- just a head repo but some may want to specify a repo to reconstruct -- the sources for this package release. -- -- The required information is the RepoType which tells us if it's -- using Darcs, Git for example. The repoLocation -- and other details are interpreted according to the repo type. data SourceRepo SourceRepo :: RepoKind -> Maybe RepoType -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe FilePath -> SourceRepo -- | The kind of repo. This field is required. [repoKind] :: SourceRepo -> RepoKind -- | The type of the source repository system for this repo, eg -- Darcs or Git. This field is required. [repoType] :: SourceRepo -> Maybe RepoType -- | The location of the repository. For most RepoTypes this is a -- URL. This field is required. [repoLocation] :: SourceRepo -> Maybe String -- | CVS can put multiple "modules" on one server and requires a -- module name in addition to the location to identify a particular repo. -- Logically this is part of the location but unfortunately has to be -- specified separately. This field is required for the CVS -- RepoType and should not be given otherwise. [repoModule] :: SourceRepo -> Maybe String -- | The name or identifier of the branch, if any. Many source control -- systems have the notion of multiple branches in a repo that exist in -- the same location. For example Git and CVS use this -- while systems like Darcs use different locations for different -- branches. This field is optional but should be used if necessary to -- identify the sources, especially for the RepoThis repo kind. [repoBranch] :: SourceRepo -> Maybe String -- | The tag identify a particular state of the repository. This should be -- given for the RepoThis repo kind and not for RepoHead -- kind. [repoTag] :: SourceRepo -> Maybe String -- | Some repositories contain multiple projects in different -- subdirectories This field specifies the subdirectory where this -- packages sources can be found, eg the subdirectory containing the -- .cabal file. It is interpreted relative to the root of the -- repository. This field is optional. If not given the default is "." ie -- no subdirectory. [repoSubdir] :: SourceRepo -> Maybe FilePath -- | What this repo info is for, what it represents. data RepoKind -- | The repository for the "head" or development version of the project. -- This repo is where we should track the latest development activity or -- the usual repo people should get to contribute patches. RepoHead :: RepoKind -- | The repository containing the sources for this exact package version -- or release. For this kind of repo a tag should be given to give enough -- information to re-create the exact sources. RepoThis :: RepoKind RepoKindUnknown :: String -> RepoKind -- | An enumeration of common source control systems. The fields used in -- the SourceRepo depend on the type of repo. The tools and -- methods used to obtain and track the repo depend on the repo type. data RepoType Darcs :: RepoType Git :: RepoType SVN :: RepoType CVS :: RepoType Mercurial :: RepoType GnuArch :: RepoType Bazaar :: RepoType Monotone :: RepoType OtherRepoType :: String -> RepoType knownRepoTypes :: [RepoType] emptySourceRepo :: RepoKind -> SourceRepo data SetupBuildInfo SetupBuildInfo :: [Dependency] -> Bool -> SetupBuildInfo [setupDepends] :: SetupBuildInfo -> [Dependency] -- | Is this a default 'custom-setup' section added by the cabal-install -- code (as opposed to user-provided)? This field is only used -- internally, and doesn't correspond to anything in the .cabal file. See -- #3199. [defaultSetupDepends] :: SetupBuildInfo -> Bool -- | This modules provides functions for working with both the legacy -- "build-tools" field, and its replacement, "build-tool-depends". Prefer -- using the functions contained to access those fields directly. module Distribution.Simple.BuildToolDepends -- | Desugar a "build-tools" entry into proper a executable dependency if -- possible. -- -- An entry can be so desguared in two cases: -- --
-- xargs (32*1024) (rawSystemExit verbosity) prog fixedArgs bigArgs --xargs :: Int -> ([String] -> IO ()) -> [String] -> [String] -> IO () -- | Look for a program on the path. -- | Deprecated: No longer used within Cabal, try -- findProgramOnSearchPath findProgramLocation :: Verbosity -> FilePath -> IO (Maybe FilePath) -- | Look for a program and try to find it's version number. It can accept -- either an absolute path or the name of a program binary, in which case -- we will look for the program on the path. findProgramVersion :: String -> (String -> String) -> Verbosity -> FilePath -> IO (Maybe Version) -- | Deprecated: Use findModuleFiles and copyFiles or -- installOrdinaryFiles smartCopySources :: Verbosity -> [FilePath] -> FilePath -> [ModuleName] -> [String] -> IO () -- | Same as createDirectoryIfMissing but logs at higher verbosity -- levels. createDirectoryIfMissingVerbose :: Verbosity -> Bool -> FilePath -> IO () -- | Copies a file without copying file permissions. The target file is -- created with default permissions. Any existing target file is -- replaced. -- -- At higher verbosity levels it logs an info message. copyFileVerbose :: Verbosity -> FilePath -> FilePath -> IO () -- | Deprecated: You probably want installDirectoryContents instead copyDirectoryRecursiveVerbose :: Verbosity -> FilePath -> FilePath -> IO () -- | Copies a bunch of files to a target directory, preserving the -- directory structure in the target location. The target directories are -- created if they do not exist. -- -- The files are identified by a pair of base directory and a path -- relative to that base. It is only the relative part that is preserved -- in the destination. -- -- For example: -- --
-- copyFiles normal "dist/src" -- [("", "src/Foo.hs"), ("dist/build/", "src/Bar.hs")] ---- -- This would copy "src/Foo.hs" to "dist/src/src/Foo.hs" and copy -- "dist/build/src/Bar.hs" to "dist/src/src/Bar.hs". -- -- This operation is not atomic. Any IO failure during the copy -- (including any missing source files) leaves the target in an unknown -- state so it is best to use it with a freshly created directory so that -- it can be simply deleted if anything goes wrong. copyFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO () -- | Given a relative path to a file, copy it to the given directory, -- preserving the relative path and creating the parent directories if -- needed. copyFileTo :: Verbosity -> FilePath -> FilePath -> IO () -- | Install an ordinary file. This is like a file copy but the permissions -- are set appropriately for an installed file. On Unix it is -- "-rw-r--r--" while on Windows it uses the default permissions for the -- target directory. installOrdinaryFile :: Verbosity -> FilePath -> FilePath -> IO () -- | Install an executable file. This is like a file copy but the -- permissions are set appropriately for an installed file. On Unix it is -- "-rwxr-xr-x" while on Windows it uses the default permissions for the -- target directory. installExecutableFile :: Verbosity -> FilePath -> FilePath -> IO () -- | Install a file that may or not be executable, preserving permissions. installMaybeExecutableFile :: Verbosity -> FilePath -> FilePath -> IO () -- | This is like copyFiles but uses installOrdinaryFile. installOrdinaryFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO () -- | This is like copyFiles but uses installExecutableFile. installExecutableFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO () -- | This is like copyFiles but uses -- installMaybeExecutableFile. installMaybeExecutableFiles :: Verbosity -> FilePath -> [(FilePath, FilePath)] -> IO () -- | This installs all the files in a directory to a target location, -- preserving the directory layout. All the files are assumed to be -- ordinary rather than executable files. installDirectoryContents :: Verbosity -> FilePath -> FilePath -> IO () -- | Recursively copy the contents of one directory to another path. copyDirectoryRecursive :: Verbosity -> FilePath -> FilePath -> IO () -- | Like doesFileExist, but also checks that the file is -- executable. doesExecutableExist :: FilePath -> NoCallStackIO Bool setFileOrdinary :: FilePath -> NoCallStackIO () setFileExecutable :: FilePath -> NoCallStackIO () -- | The path name that represents the current directory. In Unix, it's -- ".", but this is system-specific. (E.g. AmigaOS uses the -- empty string "" for the current directory.) currentDir :: FilePath shortRelativePath :: FilePath -> FilePath -> FilePath -- | Drop the extension if it's one of exeExtensions, or return the -- path unchanged. dropExeExtension :: FilePath -> FilePath -- | List of possible executable file extensions on the current platform. exeExtensions :: [String] -- | Find a file by looking in a search path. The file path must match -- exactly. findFile :: [FilePath] -> FilePath -> IO FilePath findFirstFile :: (a -> FilePath) -> [a] -> NoCallStackIO (Maybe a) -- | Find a file by looking in a search path with one of a list of possible -- file extensions. The file base name should be given and it will be -- tried with each of the extensions in each element of the search path. findFileWithExtension :: [String] -> [FilePath] -> FilePath -> NoCallStackIO (Maybe FilePath) -- | Like findFileWithExtension but returns which element of the -- search path the file was found in, and the file path relative to that -- base directory. findFileWithExtension' :: [String] -> [FilePath] -> FilePath -> NoCallStackIO (Maybe (FilePath, FilePath)) findAllFilesWithExtension :: [String] -> [FilePath] -> FilePath -> NoCallStackIO [FilePath] -- | Find the file corresponding to a Haskell module name. -- -- This is similar to findFileWithExtension' but specialised to a -- module name. The function fails if the file corresponding to the -- module is missing. findModuleFile :: [FilePath] -> [String] -> ModuleName -> IO (FilePath, FilePath) -- | Finds the files corresponding to a list of Haskell module names. -- -- As findModuleFile but for a list of module names. findModuleFiles :: [FilePath] -> [String] -> [ModuleName] -> IO [(FilePath, FilePath)] -- | List all the files in a directory and all subdirectories. -- -- The order places files in sub-directories after all the files in their -- parent directories. The list is generated lazily so is not well -- defined if the source directory structure changes before the list is -- used. getDirectoryContentsRecursive :: FilePath -> IO [FilePath] -- | Is this directory in the system search path? isInSearchPath :: FilePath -> NoCallStackIO Bool addLibraryPath :: OS -> [FilePath] -> [(String, String)] -> [(String, String)] matchFileGlob :: FilePath -> IO [FilePath] matchDirFileGlob :: FilePath -> FilePath -> IO [FilePath] parseFileGlob :: FilePath -> Maybe FileGlob data FileGlob -- | No glob at all, just an ordinary file NoGlob :: FilePath -> FileGlob -- | dir prefix and extension, like "foo/bar/*.baz" corresponds to -- FileGlob "foo/bar" ".baz" FileGlob :: FilePath -> String -> FileGlob -- | Compare the modification times of two files to see if the first is -- newer than the second. The first file must exist but the second need -- not. The expected use case is when the second file is generated using -- the first. In this use case, if the result is True then the second -- file is out of date. moreRecentFile :: FilePath -> FilePath -> NoCallStackIO Bool -- | Like moreRecentFile, but also checks that the first file -- exists. existsAndIsMoreRecentThan :: FilePath -> FilePath -> NoCallStackIO Bool -- | Advanced options for withTempFile and withTempDirectory. data TempFileOptions TempFileOptions :: Bool -> TempFileOptions -- | Keep temporary files? [optKeepTempFiles] :: TempFileOptions -> Bool defaultTempFileOptions :: TempFileOptions -- | Use a temporary filename that doesn't already exist. withTempFile :: FilePath -> String -> (FilePath -> Handle -> IO a) -> IO a -- | A version of withTempFile that additionally takes a -- TempFileOptions argument. withTempFileEx :: TempFileOptions -> FilePath -> String -> (FilePath -> Handle -> IO a) -> IO 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 verbosity "src" "sdist." $ \tmpDir -> do ... ---- -- The tmpDir will be a new subdirectory of the given directory, -- e.g. src/sdist.342. withTempDirectory :: Verbosity -> FilePath -> String -> (FilePath -> IO a) -> IO a -- | A version of withTempDirectory that additionally takes a -- TempFileOptions argument. withTempDirectoryEx :: Verbosity -> TempFileOptions -> FilePath -> String -> (FilePath -> IO a) -> IO a -- | Package description file (pkgname.cabal) defaultPackageDesc :: Verbosity -> IO FilePath -- | Find a package description file in the given directory. Looks for -- .cabal files. findPackageDesc :: FilePath -> NoCallStackIO (Either String FilePath) -- | Like findPackageDesc, but calls die in case of error. tryFindPackageDesc :: FilePath -> IO FilePath -- | Optional auxiliary package information file -- (pkgname.buildinfo) defaultHookedPackageDesc :: IO (Maybe FilePath) -- | Find auxiliary package information in the given directory. Looks for -- .buildinfo files. findHookedPackageDesc :: FilePath -> IO (Maybe FilePath) -- | Gets the contents of a file, but guarantee that it gets closed. -- -- The file is read lazily but if it is not fully consumed by the action -- then the remaining input is truncated and the file is closed. withFileContents :: FilePath -> (String -> NoCallStackIO a) -> NoCallStackIO a -- | Writes a file atomically. -- -- The file is either written successfully or an IO exception is raised -- and the original file is left unchanged. -- -- On windows it is not possible to delete a file that is open by a -- process. This case will give an IO exception but the atomic property -- is not affected. writeFileAtomic :: FilePath -> ByteString -> NoCallStackIO () -- | See rewriteFileEx -- -- This function is provided for backwards-compatibility rewriteFile :: FilePath -> String -> IO () -- | Write a file but only if it would have new content. If we would be -- writing the same as the existing content then leave the file as is so -- that we do not update the file's modification time. -- -- NB: the file is assumed to be ASCII-encoded. rewriteFileEx :: Verbosity -> FilePath -> String -> IO () fromUTF8 :: String -> String fromUTF8BS :: ByteString -> String fromUTF8LBS :: ByteString -> String toUTF8 :: String -> String -- | Reads a UTF8 encoded text file as a Unicode String -- -- Reads lazily using ordinary readFile. readUTF8File :: FilePath -> NoCallStackIO String -- | Reads a UTF8 encoded text file as a Unicode String -- -- Same behaviour as withFileContents. withUTF8FileContents :: FilePath -> (String -> IO a) -> IO a -- | Writes a Unicode String as a UTF8 encoded text file. -- -- Uses writeFileAtomic, so provides the same guarantees. writeUTF8File :: FilePath -> String -> NoCallStackIO () -- | Fix different systems silly line ending conventions normaliseLineEndings :: String -> String -- | Whether BOM is at the beginning of the input startsWithBOM :: String -> Bool -- | Check whether a file has Unicode byte order mark (BOM). fileHasBOM :: FilePath -> NoCallStackIO Bool -- | Ignore a Unicode byte order mark (BOM) at the beginning of the input ignoreBOM :: String -> String -- | dropWhileEndLE p is equivalent to reverse . dropWhile p . -- reverse, but quite a bit faster. The difference between -- "Data.List.dropWhileEnd" and this version is that the one in -- Data.List is strict in elements, but spine-lazy, while this one -- is spine-strict but lazy in elements. That's what LE stands -- for - "lazy in elements". -- -- Example: -- --
-- > tail $ Data.List.dropWhileEnd (<3) [undefined, 5, 4, 3, 2, 1] -- *** Exception: Prelude.undefined -- > tail $ dropWhileEndLE (<3) [undefined, 5, 4, 3, 2, 1] -- [5,4,3] -- > take 3 $ Data.List.dropWhileEnd (<3) [5, 4, 3, 2, 1, undefined] -- [5,4,3] -- > take 3 $ dropWhileEndLE (<3) [5, 4, 3, 2, 1, undefined] -- *** Exception: Prelude.undefined --dropWhileEndLE :: (a -> Bool) -> [a] -> [a] -- | takeWhileEndLE p is equivalent to reverse . takeWhile p . -- reverse, but is usually faster (as well as being easier to read). takeWhileEndLE :: (a -> Bool) -> [a] -> [a] equating :: Eq a => (b -> a) -> b -> b -> Bool -- |
-- 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 -- | The isInfixOf function takes two lists and returns True -- iff the first list is contained, wholly and intact, anywhere within -- the second. -- -- Example: -- --
-- isInfixOf "Haskell" "I really like Haskell." == True -- isInfixOf "Ial" "I really like Haskell." == False --isInfixOf :: Eq a => [a] -> [a] -> Bool -- | intercalate xs xss is equivalent to (concat -- (intersperse xs xss)). It inserts the list xs in -- between the lists in xss and concatenates the result. intercalate :: () => [a] -> [[a]] -> [a] lowercase :: String -> String -- | Like "Data.List.union", but has O(n log n) complexity instead -- of O(n^2). listUnion :: (Ord a) => [a] -> [a] -> [a] -- | A right-biased version of listUnion. -- -- Example: -- --
-- > listUnion [1,2,3,4,3] [2,1,1] -- [1,2,3,4,3] -- > listUnionRight [1,2,3,4,3] [2,1,1] -- [4,3,2,1,1] --listUnionRight :: (Ord a) => [a] -> [a] -> [a] -- | Like nub, but has O(n log n) complexity instead of -- O(n^2). Code for ordNub and listUnion taken -- from Niklas Hambüchen's ordnub package. ordNub :: Ord a => [a] -> [a] -- | Like ordNub and nubBy. Selects a key for each element -- and takes the nub based on that key. ordNubBy :: Ord b => (a -> b) -> [a] -> [a] -- | A right-biased version of ordNub. -- -- Example: -- --
-- > ordNub [1,2,1] -- [1,2] -- > ordNubRight [1,2,1] -- [2,1] --ordNubRight :: (Ord a) => [a] -> [a] -- | A total variant of tail. safeTail :: [a] -> [a] unintersperse :: Char -> String -> [String] -- | Wraps text to the default line width. Existing newlines are preserved. wrapText :: String -> String -- | Wraps a list of words to a list of lines of words of a particular -- width. wrapLine :: Int -> [String] -> [[String]] -- | isAbsoluteOnAnyPlatform and isRelativeOnAnyPlatform are -- like isAbsolute and isRelative but have platform -- independent heuristics. The System.FilePath exists in two versions, -- Windows and Posix. The two versions don't agree on what is a relative -- path and we don't know if we're given Windows or Posix paths. This -- results in false positives when running on Posix and inspecting -- Windows paths, like the hackage server does. -- System.FilePath.Posix.isAbsolute "C:\hello" == False -- System.FilePath.Windows.isAbsolute "/hello" == False This means that -- we would treat paths that start with "/" to be absolute. On Posix they -- are indeed absolute, while on Windows they are not. -- -- The portable versions should be used when we might deal with paths -- that are from another OS than the host OS. For example, the Hackage -- Server deals with both Windows and Posix paths while performing the -- PackageDescription checks. In contrast, when we run 'cabal configure' -- we do expect the paths to be correct for our OS and we should not have -- to use the platform independent heuristics. isAbsoluteOnAnyPlatform :: FilePath -> Bool -- |
-- isRelativeOnAnyPlatform = not . isAbsoluteOnAnyPlatform --isRelativeOnAnyPlatform :: FilePath -> Bool instance GHC.Classes.Eq Distribution.Simple.Utils.TraceWhen module Distribution.Utils.NubList -- | NubList : A de-duplicated list that maintains the original order. data NubList a -- | Smart constructor for the NubList type. toNubList :: Ord a => [a] -> NubList a fromNubList :: NubList a -> [a] -- | Lift a function over lists to a function over NubLists. overNubList :: Ord a => ([a] -> [a]) -> NubList a -> NubList a -- | NubListR : A right-biased version of NubList. That is -- toNubListR ["-XNoFoo", "-XFoo", "-XNoFoo"] will result in -- ["-XFoo", "-XNoFoo"], unlike the normal NubList, which -- is left-biased. Built on top of ordNubRight and -- listUnionRight. data NubListR a -- | Smart constructor for the NubListR type. toNubListR :: Ord a => [a] -> NubListR a fromNubListR :: NubListR a -> [a] -- | Lift a function over lists to a function over NubListRs. overNubListR :: Ord a => ([a] -> [a]) -> NubListR a -> NubListR a instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Utils.NubList.NubListR a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Utils.NubList.NubList a) instance GHC.Classes.Ord a => GHC.Base.Monoid (Distribution.Utils.NubList.NubListR a) instance GHC.Classes.Ord a => Data.Semigroup.Semigroup (Distribution.Utils.NubList.NubListR a) instance GHC.Show.Show a => GHC.Show.Show (Distribution.Utils.NubList.NubListR a) instance (GHC.Classes.Ord a, GHC.Read.Read a) => GHC.Read.Read (Distribution.Utils.NubList.NubListR a) instance GHC.Classes.Ord a => GHC.Base.Monoid (Distribution.Utils.NubList.NubList a) instance GHC.Classes.Ord a => Data.Semigroup.Semigroup (Distribution.Utils.NubList.NubList a) instance GHC.Show.Show a => GHC.Show.Show (Distribution.Utils.NubList.NubList a) instance (GHC.Classes.Ord a, GHC.Read.Read a) => GHC.Read.Read (Distribution.Utils.NubList.NubList a) instance (GHC.Classes.Ord a, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (Distribution.Utils.NubList.NubList a) module Distribution.Utils.LogProgress -- | The Progress monad with specialized logging and error messages. data LogProgress a -- | Run LogProgress, outputting traces according to -- Verbosity, die if there is an error. runLogProgress :: Verbosity -> LogProgress a -> NoCallStackIO a -- | Output a warning trace message in LogProgress. warnProgress :: Doc -> LogProgress () -- | Output an informational trace message in LogProgress. infoProgress :: Doc -> LogProgress () -- | Fail the computation with an error message. dieProgress :: Doc -> LogProgress a -- | Add a message to the error/warning context. addProgressCtx :: CtxMsg -> LogProgress a -> LogProgress a instance GHC.Base.Functor Distribution.Utils.LogProgress.LogProgress instance GHC.Base.Applicative Distribution.Utils.LogProgress.LogProgress instance GHC.Base.Monad Distribution.Utils.LogProgress.LogProgress -- | A somewhat extended notion of the normal program search path concept. -- -- Usually when finding executables we just want to look in the usual -- places using the OS's usual method for doing so. In Haskell the normal -- OS-specific method is captured by findExecutable. On all common -- OSs that makes use of a PATH environment variable, (though on -- Windows it is not just the PATH). -- -- However it is sometimes useful to be able to look in additional -- locations without having to change the process-global PATH -- environment variable. So we need an extension of the usual -- findExecutable that can look in additional locations, either -- before, after or instead of the normal OS locations. module Distribution.Simple.Program.Find -- | A search path to use when locating executables. This is analogous to -- the unix $PATH or win32 %PATH% but with the ability -- to use the system default method for finding executables -- (findExecutable which on unix is simply looking on the -- $PATH but on win32 is a bit more complicated). -- -- The default to use is [ProgSearchPathDefault] but you can add -- extra dirs either before, after or instead of the default, e.g. here -- we add an extra dir to search after the usual ones. -- --
-- ['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir] --type ProgramSearchPath = [ProgramSearchPathEntry] data ProgramSearchPathEntry -- | A specific dir ProgramSearchPathDir :: FilePath -> ProgramSearchPathEntry -- | The system default ProgramSearchPathDefault :: ProgramSearchPathEntry defaultProgramSearchPath :: ProgramSearchPath findProgramOnSearchPath :: Verbosity -> ProgramSearchPath -> FilePath -> IO (Maybe (FilePath, [FilePath])) -- | Interpret a ProgramSearchPath to construct a new $PATH -- env var. Note that this is close but not perfect because on Windows -- the search algorithm looks at more than just the %PATH%. programSearchPathAsPATHVar :: ProgramSearchPath -> NoCallStackIO String -- | Get the system search path. On Unix systems this is just the -- $PATH env var, but on windows it's a bit more complicated. getSystemSearchPath :: NoCallStackIO [FilePath] instance GHC.Generics.Generic Distribution.Simple.Program.Find.ProgramSearchPathEntry instance GHC.Classes.Eq Distribution.Simple.Program.Find.ProgramSearchPathEntry instance Data.Binary.Class.Binary Distribution.Simple.Program.Find.ProgramSearchPathEntry -- | This provides an abstraction which deals with configuring and running -- programs. A Program is a static notion of a known program. A -- ConfiguredProgram is a Program that has been found on -- the current machine and is ready to be run (possibly with some -- user-supplied default args). Configuring a program involves finding -- its location and if necessary finding its version. There's reasonable -- default behavior for trying to find "foo" in PATH, being able to -- override its location, etc. module Distribution.Simple.Program.Types -- | Represents a program which can be configured. -- -- Note: rather than constructing this directly, start with -- simpleProgram and override any extra fields. data Program Program :: String -> (Verbosity -> ProgramSearchPath -> IO (Maybe (FilePath, [FilePath]))) -> (Verbosity -> FilePath -> IO (Maybe Version)) -> (Verbosity -> ConfiguredProgram -> IO ConfiguredProgram) -> Program -- | The simple name of the program, eg. ghc [programName] :: Program -> String -- | A function to search for the program if its location was not specified -- by the user. Usually this will just be a call to -- findProgramOnSearchPath. -- -- It is supplied with the prevailing search path which will typically -- just be used as-is, but can be extended or ignored as needed. -- -- For the purpose of change monitoring, in addition to the location -- where the program was found, it returns all the other places that were -- tried. [programFindLocation] :: Program -> Verbosity -> ProgramSearchPath -> IO (Maybe (FilePath, [FilePath])) -- | Try to find the version of the program. For many programs this is not -- possible or is not necessary so it's OK to return Nothing. [programFindVersion] :: Program -> Verbosity -> FilePath -> IO (Maybe Version) -- | A function to do any additional configuration after we have located -- the program (and perhaps identified its version). For example it could -- add args, or environment vars. [programPostConf] :: Program -> Verbosity -> ConfiguredProgram -> IO ConfiguredProgram -- | A search path to use when locating executables. This is analogous to -- the unix $PATH or win32 %PATH% but with the ability -- to use the system default method for finding executables -- (findExecutable which on unix is simply looking on the -- $PATH but on win32 is a bit more complicated). -- -- The default to use is [ProgSearchPathDefault] but you can add -- extra dirs either before, after or instead of the default, e.g. here -- we add an extra dir to search after the usual ones. -- --
-- ['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir] --type ProgramSearchPath = [ProgramSearchPathEntry] data ProgramSearchPathEntry -- | A specific dir ProgramSearchPathDir :: FilePath -> ProgramSearchPathEntry -- | The system default ProgramSearchPathDefault :: ProgramSearchPathEntry -- | Make a simple named program. -- -- By default we'll just search for it in the path and not try to find -- the version name. You can override these behaviours if necessary, eg: -- --
-- (simpleProgram "foo") { programFindLocation = ... , programFindVersion ... } --simpleProgram :: String -> Program -- | Represents a program which has been configured and is thus ready to be -- run. -- -- These are usually made by configuring a Program, but if you -- have to construct one directly then start with -- simpleConfiguredProgram and override any extra fields. data ConfiguredProgram ConfiguredProgram :: String -> Maybe Version -> [String] -> [String] -> [(String, Maybe String)] -> Map String String -> ProgramLocation -> [FilePath] -> ConfiguredProgram -- | Just the name again [programId] :: ConfiguredProgram -> String -- | The version of this program, if it is known. [programVersion] :: ConfiguredProgram -> Maybe Version -- | Default command-line args for this program. These flags will appear -- first on the command line, so they can be overridden by subsequent -- flags. [programDefaultArgs] :: ConfiguredProgram -> [String] -- | Override command-line args for this program. These flags will appear -- last on the command line, so they override all earlier flags. [programOverrideArgs] :: ConfiguredProgram -> [String] -- | Override environment variables for this program. These env vars will -- extend/override the prevailing environment of the current to form the -- environment for the new process. [programOverrideEnv] :: ConfiguredProgram -> [(String, Maybe String)] -- | A key-value map listing various properties of the program, useful for -- feature detection. Populated during the configuration step, key names -- depend on the specific program. [programProperties] :: ConfiguredProgram -> Map String String -- | Location of the program. eg. /usr/bin/ghc-6.4 [programLocation] :: ConfiguredProgram -> ProgramLocation -- | In addition to the programLocation where the program was found, -- these are additional locations that were looked at. The combination of -- ths found location and these not-found locations can be used to -- monitor to detect when the re-configuring the program might give a -- different result (e.g. found in a different location). [programMonitorFiles] :: ConfiguredProgram -> [FilePath] -- | The full path of a configured program. programPath :: ConfiguredProgram -> FilePath -- | Suppress any extra arguments added by the user. suppressOverrideArgs :: ConfiguredProgram -> ConfiguredProgram type ProgArg = String -- | Where a program was found. Also tells us whether it's specified by -- user or not. This includes not just the path, but the program as well. data ProgramLocation -- | The user gave the path to this program, eg. -- --ghc-path=/usr/bin/ghc-6.6 UserSpecified :: FilePath -> ProgramLocation [locationPath] :: ProgramLocation -> FilePath -- | The program was found automatically. FoundOnSystem :: FilePath -> ProgramLocation [locationPath] :: ProgramLocation -> FilePath -- | Make a simple ConfiguredProgram. -- --
-- simpleConfiguredProgram "foo" (FoundOnSystem path) --simpleConfiguredProgram :: String -> ProgramLocation -> ConfiguredProgram instance GHC.Show.Show Distribution.Simple.Program.Types.ConfiguredProgram instance GHC.Read.Read Distribution.Simple.Program.Types.ConfiguredProgram instance GHC.Generics.Generic Distribution.Simple.Program.Types.ConfiguredProgram instance GHC.Classes.Eq Distribution.Simple.Program.Types.ConfiguredProgram instance GHC.Show.Show Distribution.Simple.Program.Types.ProgramLocation instance GHC.Read.Read Distribution.Simple.Program.Types.ProgramLocation instance GHC.Generics.Generic Distribution.Simple.Program.Types.ProgramLocation instance GHC.Classes.Eq Distribution.Simple.Program.Types.ProgramLocation instance GHC.Show.Show Distribution.Simple.Program.Types.Program instance Data.Binary.Class.Binary Distribution.Simple.Program.Types.ConfiguredProgram instance Data.Binary.Class.Binary Distribution.Simple.Program.Types.ProgramLocation -- | This module provides a data type for program invocations and functions -- to run them. module Distribution.Simple.Program.Run -- | Represents a specific invocation of a specific program. -- -- This is used as an intermediate type between deciding how to call a -- program and actually doing it. This provides the opportunity to the -- caller to adjust how the program will be called. These invocations can -- either be run directly or turned into shell or batch scripts. data ProgramInvocation ProgramInvocation :: FilePath -> [String] -> [(String, Maybe String)] -> [FilePath] -> Maybe FilePath -> Maybe String -> IOEncoding -> IOEncoding -> ProgramInvocation [progInvokePath] :: ProgramInvocation -> FilePath [progInvokeArgs] :: ProgramInvocation -> [String] [progInvokeEnv] :: ProgramInvocation -> [(String, Maybe String)] [progInvokePathEnv] :: ProgramInvocation -> [FilePath] [progInvokeCwd] :: ProgramInvocation -> Maybe FilePath [progInvokeInput] :: ProgramInvocation -> Maybe String [progInvokeInputEncoding] :: ProgramInvocation -> IOEncoding [progInvokeOutputEncoding] :: ProgramInvocation -> IOEncoding data IOEncoding IOEncodingText :: IOEncoding IOEncodingUTF8 :: IOEncoding emptyProgramInvocation :: ProgramInvocation simpleProgramInvocation :: FilePath -> [String] -> ProgramInvocation programInvocation :: ConfiguredProgram -> [String] -> ProgramInvocation -- | Like the unix xargs program. Useful for when we've got very long -- command lines that might overflow an OS limit on command line length -- and so you need to invoke a command multiple times to get all the args -- in. -- -- It takes four template invocations corresponding to the simple, -- initial, middle and last invocations. If the number of args given is -- small enough that we can get away with just a single invocation then -- the simple one is used: -- --
-- $ simple args ---- -- If the number of args given means that we need to use multiple -- invocations then the templates for the initial, middle and last -- invocations are used: -- --
-- $ initial args_0 -- $ middle args_1 -- $ middle args_2 -- ... -- $ final args_n --multiStageProgramInvocation :: ProgramInvocation -> (ProgramInvocation, ProgramInvocation, ProgramInvocation) -> [String] -> [ProgramInvocation] runProgramInvocation :: Verbosity -> ProgramInvocation -> IO () getProgramInvocationOutput :: Verbosity -> ProgramInvocation -> IO String -- | Return the current environment extended with the given overrides. If -- an entry is specified twice in overrides, the second entry -- takes precedence. getEffectiveEnvironment :: [(String, Maybe String)] -> NoCallStackIO (Maybe [(String, String)]) -- | This module provides an library interface to the hc-pkg -- program. Currently only GHC and LHC have hc-pkg programs. module Distribution.Simple.Program.Script -- | Generate a system script, either POSIX shell script or Windows batch -- file as appropriate for the given system. invocationAsSystemScript :: OS -> ProgramInvocation -> String -- | Generate a POSIX shell script that invokes a program. invocationAsShellScript :: ProgramInvocation -> String -- | Generate a Windows batch file that invokes a program. invocationAsBatchFile :: ProgramInvocation -> String -- | This module provides an library interface to the ld linker -- program. module Distribution.Simple.Program.Ld -- | Call ld -r to link a bunch of object files together. combineObjectFiles :: Verbosity -> ConfiguredProgram -> FilePath -> [FilePath] -> IO () -- | This module provides an library interface to the hpc program. module Distribution.Simple.Program.Hpc -- | Invoke hpc with the given parameters. -- -- Prior to HPC version 0.7 (packaged with GHC 7.8), hpc did not handle -- multiple .mix paths correctly, so we print a warning, and only pass it -- the first path in the list. This means that e.g. test suites that -- import their library as a dependency can still work, but those that -- include the library modules directly (in other-modules) don't. markup :: ConfiguredProgram -> Version -> Verbosity -> FilePath -> [FilePath] -> FilePath -> [ModuleName] -> IO () union :: ConfiguredProgram -> Verbosity -> [FilePath] -> FilePath -> [ModuleName] -> IO () -- | The module defines all the known built-in Programs. -- -- Where possible we try to find their version numbers. module Distribution.Simple.Program.Builtin -- | The default list of programs. These programs are typically used -- internally to Cabal. builtinPrograms :: [Program] ghcProgram :: Program ghcPkgProgram :: Program runghcProgram :: Program ghcjsProgram :: Program ghcjsPkgProgram :: Program lhcProgram :: Program lhcPkgProgram :: Program hmakeProgram :: Program jhcProgram :: Program haskellSuiteProgram :: Program haskellSuitePkgProgram :: Program uhcProgram :: Program gccProgram :: Program arProgram :: Program stripProgram :: Program happyProgram :: Program alexProgram :: Program hsc2hsProgram :: Program c2hsProgram :: Program cpphsProgram :: Program hscolourProgram :: Program doctestProgram :: Program haddockProgram :: Program greencardProgram :: Program ldProgram :: Program tarProgram :: Program cppProgram :: Program pkgConfigProgram :: Program hpcProgram :: Program -- | This provides a ProgramDb type which holds configured and -- not-yet configured programs. It is the parameter to lots of actions -- elsewhere in Cabal that need to look up and run programs. If we had a -- Cabal monad, the ProgramDb would probably be a reader or state -- component of it. -- -- One nice thing about using it is that any program that is registered -- with Cabal will get some "configure" and ".cabal" helpers like -- --with-foo-args --foo-path= and extra-foo-args. -- -- There's also a hook for adding programs in a Setup.lhs script. See -- hookedPrograms in UserHooks. This gives a hook user the ability -- to get the above flags and such so that they don't have to write all -- the PATH logic inside Setup.lhs. module Distribution.Simple.Program.Db -- | The configuration is a collection of information about programs. It -- contains information both about configured programs and also about -- programs that we are yet to configure. -- -- The idea is that we start from a collection of unconfigured programs -- and one by one we try to configure them at which point we move them -- into the configured collection. For unconfigured programs we record -- not just the Program but also any user-provided arguments and -- location for the program. data ProgramDb emptyProgramDb :: ProgramDb defaultProgramDb :: ProgramDb -- | The 'Read'\/'Show' and Binary instances do not preserve all the -- unconfigured Programs because Program is not in -- 'Read'\/'Show' because it contains functions. So to fully restore a -- deserialised ProgramDb use this function to add back all the -- known Programs. -- --
-- ['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir] --type ProgramSearchPath = [ProgramSearchPathEntry] data ProgramSearchPathEntry -- | A specific dir ProgramSearchPathDir :: FilePath -> ProgramSearchPathEntry -- | The system default ProgramSearchPathDefault :: ProgramSearchPathEntry -- | Make a simple named program. -- -- By default we'll just search for it in the path and not try to find -- the version name. You can override these behaviours if necessary, eg: -- --
-- (simpleProgram "foo") { programFindLocation = ... , programFindVersion ... } --simpleProgram :: String -> Program findProgramOnSearchPath :: Verbosity -> ProgramSearchPath -> FilePath -> IO (Maybe (FilePath, [FilePath])) defaultProgramSearchPath :: ProgramSearchPath -- | Look for a program and try to find it's version number. It can accept -- either an absolute path or the name of a program binary, in which case -- we will look for the program on the path. findProgramVersion :: String -> (String -> String) -> Verbosity -> FilePath -> IO (Maybe Version) -- | Represents a program which has been configured and is thus ready to be -- run. -- -- These are usually made by configuring a Program, but if you -- have to construct one directly then start with -- simpleConfiguredProgram and override any extra fields. data ConfiguredProgram ConfiguredProgram :: String -> Maybe Version -> [String] -> [String] -> [(String, Maybe String)] -> Map String String -> ProgramLocation -> [FilePath] -> ConfiguredProgram -- | Just the name again [programId] :: ConfiguredProgram -> String -- | The version of this program, if it is known. [programVersion] :: ConfiguredProgram -> Maybe Version -- | Default command-line args for this program. These flags will appear -- first on the command line, so they can be overridden by subsequent -- flags. [programDefaultArgs] :: ConfiguredProgram -> [String] -- | Override command-line args for this program. These flags will appear -- last on the command line, so they override all earlier flags. [programOverrideArgs] :: ConfiguredProgram -> [String] -- | Override environment variables for this program. These env vars will -- extend/override the prevailing environment of the current to form the -- environment for the new process. [programOverrideEnv] :: ConfiguredProgram -> [(String, Maybe String)] -- | A key-value map listing various properties of the program, useful for -- feature detection. Populated during the configuration step, key names -- depend on the specific program. [programProperties] :: ConfiguredProgram -> Map String String -- | Location of the program. eg. /usr/bin/ghc-6.4 [programLocation] :: ConfiguredProgram -> ProgramLocation -- | In addition to the programLocation where the program was found, -- these are additional locations that were looked at. The combination of -- ths found location and these not-found locations can be used to -- monitor to detect when the re-configuring the program might give a -- different result (e.g. found in a different location). [programMonitorFiles] :: ConfiguredProgram -> [FilePath] -- | The full path of a configured program. programPath :: ConfiguredProgram -> FilePath type ProgArg = String -- | Where a program was found. Also tells us whether it's specified by -- user or not. This includes not just the path, but the program as well. data ProgramLocation -- | The user gave the path to this program, eg. -- --ghc-path=/usr/bin/ghc-6.6 UserSpecified :: FilePath -> ProgramLocation [locationPath] :: ProgramLocation -> FilePath -- | The program was found automatically. FoundOnSystem :: FilePath -> ProgramLocation [locationPath] :: ProgramLocation -> FilePath -- | Runs the given configured program. runProgram :: Verbosity -> ConfiguredProgram -> [ProgArg] -> IO () -- | Runs the given configured program and gets the output. getProgramOutput :: Verbosity -> ConfiguredProgram -> [ProgArg] -> IO String -- | Suppress any extra arguments added by the user. suppressOverrideArgs :: ConfiguredProgram -> ConfiguredProgram -- | Represents a specific invocation of a specific program. -- -- This is used as an intermediate type between deciding how to call a -- program and actually doing it. This provides the opportunity to the -- caller to adjust how the program will be called. These invocations can -- either be run directly or turned into shell or batch scripts. data ProgramInvocation ProgramInvocation :: FilePath -> [String] -> [(String, Maybe String)] -> [FilePath] -> Maybe FilePath -> Maybe String -> IOEncoding -> IOEncoding -> ProgramInvocation [progInvokePath] :: ProgramInvocation -> FilePath [progInvokeArgs] :: ProgramInvocation -> [String] [progInvokeEnv] :: ProgramInvocation -> [(String, Maybe String)] [progInvokePathEnv] :: ProgramInvocation -> [FilePath] [progInvokeCwd] :: ProgramInvocation -> Maybe FilePath [progInvokeInput] :: ProgramInvocation -> Maybe String [progInvokeInputEncoding] :: ProgramInvocation -> IOEncoding [progInvokeOutputEncoding] :: ProgramInvocation -> IOEncoding emptyProgramInvocation :: ProgramInvocation simpleProgramInvocation :: FilePath -> [String] -> ProgramInvocation programInvocation :: ConfiguredProgram -> [String] -> ProgramInvocation runProgramInvocation :: Verbosity -> ProgramInvocation -> IO () getProgramInvocationOutput :: Verbosity -> ProgramInvocation -> IO String -- | The default list of programs. These programs are typically used -- internally to Cabal. builtinPrograms :: [Program] -- | The configuration is a collection of information about programs. It -- contains information both about configured programs and also about -- programs that we are yet to configure. -- -- The idea is that we start from a collection of unconfigured programs -- and one by one we try to configure them at which point we move them -- into the configured collection. For unconfigured programs we record -- not just the Program but also any user-provided arguments and -- location for the program. data ProgramDb defaultProgramDb :: ProgramDb emptyProgramDb :: ProgramDb -- | The 'Read'\/'Show' and Binary instances do not preserve all the -- unconfigured Programs because Program is not in -- 'Read'\/'Show' because it contains functions. So to fully restore a -- deserialised ProgramDb use this function to add back all the -- known Programs. -- --
-- if compilerCompatFlavor GHC compiler then ... else ... --compilerCompatFlavor :: CompilerFlavor -> Compiler -> Bool -- | Is this compiler compatible with the compiler flavour we're interested -- in, and if so what version does it claim to be compatible with. -- -- For example this checks if the compiler is actually GHC-7.x or is -- another compiler that claims to be compatible with some GHC-7.x -- version. -- --
-- case compilerCompatVersion GHC compiler of -- Just (Version (7:_)) -> ... -- _ -> ... --compilerCompatVersion :: CompilerFlavor -> Compiler -> Maybe Version compilerInfo :: Compiler -> CompilerInfo -- | Some compilers have a notion of a database of available packages. For -- some there is just one global db of packages, other compilers support -- a per-user or an arbitrary db specified at some location in the file -- system. This can be used to build isloated environments of packages, -- for example to build a collection of related packages without -- installing them globally. data PackageDB GlobalPackageDB :: PackageDB UserPackageDB :: PackageDB SpecificPackageDB :: FilePath -> PackageDB -- | We typically get packages from several databases, and stack them -- together. This type lets us be explicit about that stacking. For -- example typical stacks include: -- --
-- [GlobalPackageDB] -- [GlobalPackageDB, UserPackageDB] -- [GlobalPackageDB, SpecificPackageDB "package.conf.inplace"] ---- -- Note that the GlobalPackageDB is invariably at the bottom since -- it contains the rts, base and other special compiler-specific -- packages. -- -- We are not restricted to using just the above combinations. In -- particular we can use several custom package dbs and the user package -- db together. -- -- When it comes to writing, the top most (last) package is used. type PackageDBStack = [PackageDB] -- | Return the package that we should register into. This is the package -- db at the top of the stack. registrationPackageDB :: PackageDBStack -> PackageDB -- | Make package paths absolute absolutePackageDBPaths :: PackageDBStack -> NoCallStackIO PackageDBStack absolutePackageDBPath :: PackageDB -> NoCallStackIO PackageDB -- | Some compilers support optimising. Some have different levels. For -- compilers that do not the level is just capped to the level they do -- support. data OptimisationLevel NoOptimisation :: OptimisationLevel NormalOptimisation :: OptimisationLevel MaximumOptimisation :: OptimisationLevel flagToOptimisationLevel :: Maybe String -> OptimisationLevel -- | Some compilers support emitting debug info. Some have different -- levels. For compilers that do not the level is just capped to the -- level they do support. data DebugInfoLevel NoDebugInfo :: DebugInfoLevel MinimalDebugInfo :: DebugInfoLevel NormalDebugInfo :: DebugInfoLevel MaximalDebugInfo :: DebugInfoLevel flagToDebugInfoLevel :: Maybe String -> DebugInfoLevel type Flag = String languageToFlags :: Compiler -> Maybe Language -> [Flag] unsupportedLanguages :: Compiler -> [Language] -> [Language] -- | For the given compiler, return the flags for the supported extensions. extensionsToFlags :: Compiler -> [Extension] -> [Flag] -- | For the given compiler, return the extensions it does not support. unsupportedExtensions :: Compiler -> [Extension] -> [Extension] -- | Does this compiler support parallel --make mode? parmakeSupported :: Compiler -> Bool -- | Does this compiler support reexported-modules? reexportedModulesSupported :: Compiler -> Bool -- | Does this compiler support thinning/renaming on package flags? renamingPackageFlagsSupported :: Compiler -> Bool -- | Does this compiler have unified IPIDs (so no package keys) unifiedIPIDRequired :: Compiler -> Bool -- | Does this compiler support package keys? packageKeySupported :: Compiler -> Bool -- | Does this compiler support unit IDs? unitIdSupported :: Compiler -> Bool -- | Does this compiler support Haskell program coverage? coverageSupported :: Compiler -> Bool -- | Does this compiler support profiling? profilingSupported :: Compiler -> Bool -- | Does this compiler support Backpack? backpackSupported :: Compiler -> Bool -- | Does this compiler support a package database entry with: -- "dynamic-library-dirs"? libraryDynDirSupported :: Compiler -> Bool -- | Some compilers (notably GHC) support profiling and can instrument -- programs so the system can account costs to different functions. There -- are different levels of detail that can be used for this accounting. -- For compilers that do not support this notion or the particular detail -- levels, this is either ignored or just capped to some similar level -- they do support. data ProfDetailLevel ProfDetailNone :: ProfDetailLevel ProfDetailDefault :: ProfDetailLevel ProfDetailExportedFunctions :: ProfDetailLevel ProfDetailToplevelFunctions :: ProfDetailLevel ProfDetailAllFunctions :: ProfDetailLevel ProfDetailOther :: String -> ProfDetailLevel knownProfDetailLevels :: [(String, [String], ProfDetailLevel)] flagToProfDetailLevel :: String -> ProfDetailLevel showProfDetailLevel :: ProfDetailLevel -> String instance GHC.Show.Show Distribution.Simple.Compiler.ProfDetailLevel instance GHC.Read.Read Distribution.Simple.Compiler.ProfDetailLevel instance GHC.Generics.Generic Distribution.Simple.Compiler.ProfDetailLevel instance GHC.Classes.Eq Distribution.Simple.Compiler.ProfDetailLevel instance GHC.Read.Read Distribution.Simple.Compiler.Compiler instance GHC.Show.Show Distribution.Simple.Compiler.Compiler instance GHC.Generics.Generic Distribution.Simple.Compiler.Compiler instance GHC.Classes.Eq Distribution.Simple.Compiler.Compiler instance GHC.Show.Show Distribution.Simple.Compiler.DebugInfoLevel instance GHC.Read.Read Distribution.Simple.Compiler.DebugInfoLevel instance GHC.Generics.Generic Distribution.Simple.Compiler.DebugInfoLevel instance GHC.Classes.Eq Distribution.Simple.Compiler.DebugInfoLevel instance GHC.Enum.Enum Distribution.Simple.Compiler.DebugInfoLevel instance GHC.Enum.Bounded Distribution.Simple.Compiler.DebugInfoLevel instance GHC.Show.Show Distribution.Simple.Compiler.OptimisationLevel instance GHC.Read.Read Distribution.Simple.Compiler.OptimisationLevel instance GHC.Generics.Generic Distribution.Simple.Compiler.OptimisationLevel instance GHC.Classes.Eq Distribution.Simple.Compiler.OptimisationLevel instance GHC.Enum.Enum Distribution.Simple.Compiler.OptimisationLevel instance GHC.Enum.Bounded Distribution.Simple.Compiler.OptimisationLevel instance GHC.Read.Read Distribution.Simple.Compiler.PackageDB instance GHC.Show.Show Distribution.Simple.Compiler.PackageDB instance GHC.Classes.Ord Distribution.Simple.Compiler.PackageDB instance GHC.Generics.Generic Distribution.Simple.Compiler.PackageDB instance GHC.Classes.Eq Distribution.Simple.Compiler.PackageDB instance Data.Binary.Class.Binary Distribution.Simple.Compiler.ProfDetailLevel instance Data.Binary.Class.Binary Distribution.Simple.Compiler.Compiler instance Data.Binary.Class.Binary Distribution.Simple.Compiler.DebugInfoLevel instance Data.Binary.Class.Binary Distribution.Simple.Compiler.OptimisationLevel instance Data.Binary.Class.Binary Distribution.Simple.Compiler.PackageDB -- | This module provides an library interface to the hc-pkg -- program. Currently only GHC, GHCJS and LHC have hc-pkg programs. module Distribution.Simple.Program.HcPkg -- | Information about the features and capabilities of an hc-pkg -- program. data HcPkgInfo HcPkgInfo :: ConfiguredProgram -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> HcPkgInfo [hcPkgProgram] :: HcPkgInfo -> ConfiguredProgram -- | no package DB stack supported [noPkgDbStack] :: HcPkgInfo -> Bool -- | hc-pkg does not support verbosity flags [noVerboseFlag] :: HcPkgInfo -> Bool -- | use package-conf option instead of package-db [flagPackageConf] :: HcPkgInfo -> Bool -- | supports directory style package databases [supportsDirDbs] :: HcPkgInfo -> Bool -- | requires directory style package databases [requiresDirDbs] :: HcPkgInfo -> Bool -- | supports --enable-multi-instance flag [nativeMultiInstance] :: HcPkgInfo -> Bool -- | supports multi-instance via recache [recacheMultiInstance] :: HcPkgInfo -> Bool -- | supports --force-files or equivalent [suppressFilesCheck] :: HcPkgInfo -> Bool -- | Additional variations in the behaviour for register. data RegisterOptions RegisterOptions :: Bool -> Bool -> Bool -> RegisterOptions -- | Allows re-registering / overwriting an existing package [registerAllowOverwrite] :: RegisterOptions -> Bool -- | Insist on the ability to register multiple instances of a single -- version of a single package. This will fail if the hc-pkg -- does not support it, see nativeMultiInstance and -- recacheMultiInstance. [registerMultiInstance] :: RegisterOptions -> Bool -- | Require that no checks are performed on the existence of package files -- mentioned in the registration info. This must be used if registering -- prior to putting the files in their final place. This will fail if the -- hc-pkg does not support it, see suppressFilesCheck. [registerSuppressFilesCheck] :: RegisterOptions -> Bool -- | Defaults are True, False and False defaultRegisterOptions :: RegisterOptions -- | Call hc-pkg to initialise a package database at the location -- {path}. -- --
-- hc-pkg init {path} --init :: HcPkgInfo -> Verbosity -> Bool -> FilePath -> IO () -- | Run hc-pkg using a given package DB stack, directly -- forwarding the provided command-line arguments to it. invoke :: HcPkgInfo -> Verbosity -> PackageDBStack -> [String] -> IO () -- | Call hc-pkg to register a package. -- --
-- hc-pkg register {filename | -} [--user | --global | --package-db] --register :: HcPkgInfo -> Verbosity -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> IO () -- | Call hc-pkg to unregister a package -- --
-- hc-pkg unregister [pkgid] [--user | --global | --package-db] --unregister :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO () -- | Call hc-pkg to recache the registered packages. -- --
-- hc-pkg recache [--user | --global | --package-db] --recache :: HcPkgInfo -> Verbosity -> PackageDB -> IO () -- | Call hc-pkg to expose a package. -- --
-- hc-pkg expose [pkgid] [--user | --global | --package-db] --expose :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO () -- | Call hc-pkg to hide a package. -- --
-- hc-pkg hide [pkgid] [--user | --global | --package-db] --hide :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> IO () -- | Call hc-pkg to get all the details of all the packages in the -- given package database. dump :: HcPkgInfo -> Verbosity -> PackageDB -> IO [InstalledPackageInfo] -- | Call hc-pkg to retrieve a specific package -- --
-- hc-pkg describe [pkgid] [--user | --global | --package-db] --describe :: HcPkgInfo -> Verbosity -> PackageDBStack -> PackageId -> IO [InstalledPackageInfo] -- | Call hc-pkg to get the source package Id of all the packages -- in the given package database. -- -- This is much less information than with dump, but also rather -- quicker. Note in particular that it does not include the -- UnitId, just the source PackageId which is not -- necessarily unique in any package db. list :: HcPkgInfo -> Verbosity -> PackageDB -> IO [PackageId] initInvocation :: HcPkgInfo -> Verbosity -> FilePath -> ProgramInvocation registerInvocation :: HcPkgInfo -> Verbosity -> PackageDBStack -> InstalledPackageInfo -> RegisterOptions -> ProgramInvocation unregisterInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation recacheInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation exposeInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation hideInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> PackageId -> ProgramInvocation dumpInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation describeInvocation :: HcPkgInfo -> Verbosity -> PackageDBStack -> PackageId -> ProgramInvocation listInvocation :: HcPkgInfo -> Verbosity -> PackageDB -> ProgramInvocation -- | This is to do with command line handling. The Cabal command line is -- organised into a number of named sub-commands (much like darcs). The -- CommandUI abstraction represents one of these sub-commands, -- with a name, description, a set of flags. Commands can be associated -- with actions and run. It handles some common stuff automatically, like -- the --help and command line completion flags. It is designed -- to allow other tools make derived commands. This feature is used -- heavily in cabal-install. module Distribution.Simple.Command data CommandUI flags CommandUI :: String -> String -> (String -> String) -> Maybe (String -> String) -> Maybe (String -> String) -> flags -> (ShowOrParseArgs -> [OptionField flags]) -> CommandUI flags -- | The name of the command as it would be entered on the command line. -- For example "build". [commandName] :: CommandUI flags -> String -- | A short, one line description of the command to use in help texts. [commandSynopsis] :: CommandUI flags -> String -- | A function that maps a program name to a usage summary for this -- command. [commandUsage] :: CommandUI flags -> String -> String -- | Additional explanation of the command to use in help texts. [commandDescription] :: CommandUI flags -> Maybe (String -> String) -- | Post-Usage notes and examples in help texts [commandNotes] :: CommandUI flags -> Maybe (String -> String) -- | Initial / empty flags [commandDefaultFlags] :: CommandUI flags -> flags -- | All the Option fields for this command [commandOptions] :: CommandUI flags -> ShowOrParseArgs -> [OptionField flags] -- | Show flags in the standard long option command line format commandShowOptions :: CommandUI flags -> flags -> [String] data CommandParse flags CommandHelp :: (String -> String) -> CommandParse flags CommandList :: [String] -> CommandParse flags CommandErrors :: [String] -> CommandParse flags CommandReadyToGo :: flags -> CommandParse flags -- | Parse a bunch of command line arguments commandParseArgs :: CommandUI flags -> Bool -> [String] -> CommandParse (flags -> flags, [String]) -- | Helper function for creating globalCommand description getNormalCommandDescriptions :: [Command action] -> [(String, String)] helpCommandUI :: CommandUI () data ShowOrParseArgs ShowArgs :: ShowOrParseArgs ParseArgs :: ShowOrParseArgs -- | Default "usage" documentation text for commands. usageDefault :: String -> String -> String -- | Create "usage" documentation from a list of parameter configurations. usageAlternatives :: String -> [String] -> String -> String -- | Make a Command from standard GetOpt options. mkCommandUI :: String -> String -> [String] -> flags -> (ShowOrParseArgs -> [OptionField flags]) -> CommandUI flags -- | Mark command as hidden. Hidden commands don't show up in the 'progname -- help' or 'progname --help' output. hiddenCommand :: Command action -> Command action data Command action commandAddAction :: CommandUI flags -> (flags -> [String] -> action) -> Command action -- | Utility function, many commands do not accept additional flags. This -- action fails with a helpful error message if the user supplies any -- extra. noExtraFlags :: [String] -> IO () data CommandType NormalCommand :: CommandType HiddenCommand :: CommandType -- | wraps a CommandUI together with a function that turns it into -- a Command. By hiding the type of flags for the UI allows -- construction of a list of all UIs at the top level of the program. -- That list can then be used for generation of manual page as well as -- for executing the selected command. data CommandSpec action CommandSpec :: (CommandUI flags) -> (CommandUI flags -> Command action) -> CommandType -> CommandSpec action commandFromSpec :: CommandSpec a -> Command a commandsRun :: CommandUI a -> [Command action] -> [String] -> CommandParse (a, CommandParse action) -- | We usually have a data type for storing configuration values, where -- every field stores a configuration option, and the user sets the value -- either via command line flags or a configuration file. An individual -- OptionField models such a field, and we usually build a list of -- options associated to a configuration data type. data OptionField a OptionField :: Name -> [OptDescr a] -> OptionField a [optionName] :: OptionField a -> Name [optionDescr] :: OptionField a -> [OptDescr a] type Name = String -- | Create an option taking a single OptDescr. No explicit Name is given -- for the Option, the name is the first LFlag given. option :: SFlags -> LFlags -> Description -> get -> set -> MkOptDescr get set a -> OptionField a -- | Create an option taking several OptDescrs. You will have to give the -- flags and description individually to the OptDescr constructor. multiOption :: Name -> get -> set -> [get -> set -> OptDescr a] -> OptionField a liftOption :: (b -> a) -> (a -> (b -> b)) -> OptionField a -> OptionField b -- | to view as a FieldDescr, we sort the list of interfaces (Req > Bool -- > Choice > Opt) and consider only the first one. viewAsFieldDescr :: OptionField a -> FieldDescr a -- | An OptionField takes one or more OptDescrs, describing the command -- line interface for the field. data OptDescr a ReqArg :: Description -> OptFlags -> ArgPlaceHolder -> (ReadE (a -> a)) -> (a -> [String]) -> OptDescr a OptArg :: Description -> OptFlags -> ArgPlaceHolder -> (ReadE (a -> a)) -> (a -> a) -> (a -> [Maybe String]) -> OptDescr a ChoiceOpt :: [(Description, OptFlags, a -> a, a -> Bool)] -> OptDescr a BoolOpt :: Description -> OptFlags -> OptFlags -> (Bool -> a -> a) -> (a -> Maybe Bool) -> OptDescr a type Description = String -- | Short command line option strings type SFlags = [Char] -- | Long command line option strings type LFlags = [String] type OptFlags = (SFlags, LFlags) type ArgPlaceHolder = String type MkOptDescr get set a = SFlags -> LFlags -> Description -> get -> set -> OptDescr a -- | Create a string-valued command line interface. reqArg :: Monoid b => ArgPlaceHolder -> ReadE b -> (b -> [String]) -> MkOptDescr (a -> b) (b -> a -> a) a -- | (String -> a) variant of "reqArg" reqArg' :: Monoid b => ArgPlaceHolder -> (String -> b) -> (b -> [String]) -> MkOptDescr (a -> b) (b -> a -> a) a -- | Create a string-valued command line interface with a default value. optArg :: Monoid b => ArgPlaceHolder -> ReadE b -> b -> (b -> [Maybe String]) -> MkOptDescr (a -> b) (b -> a -> a) a -- | (String -> a) variant of "optArg" optArg' :: Monoid b => ArgPlaceHolder -> (Maybe String -> b) -> (b -> [Maybe String]) -> MkOptDescr (a -> b) (b -> a -> a) a noArg :: (Eq b) => b -> MkOptDescr (a -> b) (b -> a -> a) a boolOpt :: (b -> Maybe Bool) -> (Bool -> b) -> SFlags -> SFlags -> MkOptDescr (a -> b) (b -> a -> a) a boolOpt' :: (b -> Maybe Bool) -> (Bool -> b) -> OptFlags -> OptFlags -> MkOptDescr (a -> b) (b -> a -> a) a -- | create a Choice option choiceOpt :: Eq b => [(b, OptFlags, Description)] -> MkOptDescr (a -> b) (b -> a -> a) a -- | create a Choice option out of an enumeration type. As long flags, the -- Show output is used. As short flags, the first character which does -- not conflict with a previous one is used. choiceOptFromEnum :: (Bounded b, Enum b, Show b, Eq b) => MkOptDescr (a -> b) (b -> a -> a) a instance GHC.Base.Functor Distribution.Simple.Command.CommandParse -- | This is a big module, but not very complicated. The code is very -- regular and repetitive. It defines the command line interface for all -- the Cabal commands. For each command (like configure, -- build etc) it defines a type that holds all the flags, the -- default set of flags and a CommandUI that maps command line -- flags to and from the corresponding flags type. -- -- All the flags types are instances of Monoid, see -- http://www.haskell.org/pipermail/cabal-devel/2007-December/001509.html -- for an explanation. -- -- The types defined here get used in the front end and especially in -- cabal-install which has to do quite a bit of manipulating -- sets of command line flags. -- -- This is actually relatively nice, it works quite well. The main change -- it needs is to unify it with the code for managing sets of fields that -- can be read and written from files. This would allow us to save -- configure flags in config files. module Distribution.Simple.Setup -- | Flags that apply at the top level, not to any sub-command. data GlobalFlags GlobalFlags :: Flag Bool -> Flag Bool -> GlobalFlags [globalVersion] :: GlobalFlags -> Flag Bool [globalNumericVersion] :: GlobalFlags -> Flag Bool emptyGlobalFlags :: GlobalFlags defaultGlobalFlags :: GlobalFlags globalCommand :: [Command action] -> CommandUI GlobalFlags -- | Flags to configure command. -- -- IMPORTANT: every time a new flag is added, filterConfigureFlags -- should be updated. IMPORTANT: every time a new flag is added, it -- should be added to the Eq instance data ConfigFlags ConfigFlags :: [String] -> Last' ProgramDb -> [(String, FilePath)] -> [(String, [String])] -> NubList FilePath -> Flag CompilerFlavor -> Flag FilePath -> Flag FilePath -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> Flag ProfDetailLevel -> Flag ProfDetailLevel -> [String] -> Flag OptimisationLevel -> Flag PathTemplate -> Flag PathTemplate -> InstallDirs (Flag PathTemplate) -> Flag FilePath -> [FilePath] -> [FilePath] -> [FilePath] -> Flag String -> Flag ComponentId -> Flag Bool -> Flag FilePath -> Flag FilePath -> Flag Verbosity -> Flag Bool -> [Maybe PackageDB] -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> [Dependency] -> [(PackageName, ComponentId)] -> [(ModuleName, Module)] -> FlagAssignment -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> Flag Bool -> Flag String -> Flag Bool -> Flag DebugInfoLevel -> Maybe AllowOlder -> Maybe AllowNewer -> ConfigFlags [configArgs] :: ConfigFlags -> [String] -- | All programs that cabal may run [configPrograms_] :: ConfigFlags -> Last' ProgramDb -- | user specified programs paths [configProgramPaths] :: ConfigFlags -> [(String, FilePath)] -- | user specified programs args [configProgramArgs] :: ConfigFlags -> [(String, [String])] -- | Extend the $PATH [configProgramPathExtra] :: ConfigFlags -> NubList FilePath -- | The "flavor" of the compiler, such as GHC or JHC. [configHcFlavor] :: ConfigFlags -> Flag CompilerFlavor -- | given compiler location [configHcPath] :: ConfigFlags -> Flag FilePath -- | given hc-pkg location [configHcPkg] :: ConfigFlags -> Flag FilePath -- | Enable vanilla library [configVanillaLib] :: ConfigFlags -> Flag Bool -- | Enable profiling in the library [configProfLib] :: ConfigFlags -> Flag Bool -- | Build shared library [configSharedLib] :: ConfigFlags -> Flag Bool -- | Enable dynamic linking of the executables. [configDynExe] :: ConfigFlags -> Flag Bool -- | Enable profiling in the executables. [configProfExe] :: ConfigFlags -> Flag Bool -- | Enable profiling in the library and executables. [configProf] :: ConfigFlags -> Flag Bool -- | Profiling detail level in the library and executables. [configProfDetail] :: ConfigFlags -> Flag ProfDetailLevel -- | Profiling detail level in the library [configProfLibDetail] :: ConfigFlags -> Flag ProfDetailLevel -- | Extra arguments to configure [configConfigureArgs] :: ConfigFlags -> [String] -- | Enable optimization. [configOptimization] :: ConfigFlags -> Flag OptimisationLevel -- | Installed executable prefix. [configProgPrefix] :: ConfigFlags -> Flag PathTemplate -- | Installed executable suffix. [configProgSuffix] :: ConfigFlags -> Flag PathTemplate -- | Installation paths [configInstallDirs] :: ConfigFlags -> InstallDirs (Flag PathTemplate) [configScratchDir] :: ConfigFlags -> Flag FilePath -- | path to search for extra libraries [configExtraLibDirs] :: ConfigFlags -> [FilePath] -- | path to search for extra frameworks (OS X only) [configExtraFrameworkDirs] :: ConfigFlags -> [FilePath] -- | path to search for header files [configExtraIncludeDirs] :: ConfigFlags -> [FilePath] -- | explicit IPID to be used [configIPID] :: ConfigFlags -> Flag String -- | explicit CID to be used [configCID] :: ConfigFlags -> Flag ComponentId -- | be as deterministic as possible (e.g., invariant over GHC, database, -- etc). Used by the test suite [configDeterministic] :: ConfigFlags -> Flag Bool -- | "dist" prefix [configDistPref] :: ConfigFlags -> Flag FilePath -- | Cabal file to use [configCabalFilePath] :: ConfigFlags -> Flag FilePath -- | verbosity level [configVerbosity] :: ConfigFlags -> Flag Verbosity -- | The --user/--global flag [configUserInstall] :: ConfigFlags -> Flag Bool -- | Which package DBs to use [configPackageDBs] :: ConfigFlags -> [Maybe PackageDB] -- | Enable compiling library for GHCi [configGHCiLib] :: ConfigFlags -> Flag Bool -- | Enable -split-objs with GHC [configSplitObjs] :: ConfigFlags -> Flag Bool -- | Enable executable stripping [configStripExes] :: ConfigFlags -> Flag Bool -- | Enable library stripping [configStripLibs] :: ConfigFlags -> Flag Bool -- | Additional constraints for dependencies. [configConstraints] :: ConfigFlags -> [Dependency] -- | The packages depended on. [configDependencies] :: ConfigFlags -> [(PackageName, ComponentId)] -- | The requested Backpack instantiation. If empty, either this package -- does not use Backpack, or we just want to typecheck the indefinite -- package. [configInstantiateWith] :: ConfigFlags -> [(ModuleName, Module)] [configConfigurationsFlags] :: ConfigFlags -> FlagAssignment -- | Enable test suite compilation [configTests] :: ConfigFlags -> Flag Bool -- | Enable benchmark compilation [configBenchmarks] :: ConfigFlags -> Flag Bool -- | Enable program coverage [configCoverage] :: ConfigFlags -> Flag Bool -- | Enable program coverage (deprecated) [configLibCoverage] :: ConfigFlags -> Flag Bool -- | All direct dependencies and flags are provided on the command line by -- the user via the '--dependency' and '--flags' options. [configExactConfiguration] :: ConfigFlags -> Flag Bool -- | Halt and show an error message indicating an error in flag assignment [configFlagError] :: ConfigFlags -> Flag String -- | Enable relocatable package built [configRelocatable] :: ConfigFlags -> Flag Bool -- | Emit debug info. [configDebugInfo] :: ConfigFlags -> Flag DebugInfoLevel -- | dual to configAllowNewer [configAllowOlder] :: ConfigFlags -> Maybe AllowOlder -- | Ignore upper bounds on all or some dependencies. Wrapped in -- Maybe to distinguish between "default" and "explicitly -- disabled". [configAllowNewer] :: ConfigFlags -> Maybe AllowNewer emptyConfigFlags :: ConfigFlags defaultConfigFlags :: ProgramDb -> ConfigFlags configureCommand :: ProgramDb -> CommandUI ConfigFlags -- | More convenient version of configPrograms. Results in an -- error if internal invariant is violated. configPrograms :: WithCallStack (ConfigFlags -> ProgramDb) -- | Generic data type for policy when relaxing bounds in dependencies. -- Don't use this directly: use AllowOlder or AllowNewer -- depending on whether or not you are relaxing an lower or upper bound -- (respectively). data RelaxDeps -- | Default: honor the upper bounds in all dependencies, never choose -- versions newer than allowed. RelaxDepsNone :: RelaxDeps -- | Ignore upper bounds in dependencies on the given packages. RelaxDepsSome :: [RelaxedDep] -> RelaxDeps -- | Ignore upper bounds in dependencies on all packages. RelaxDepsAll :: RelaxDeps -- | Dependencies can be relaxed either for all packages in the install -- plan, or only for some packages. data RelaxedDep RelaxedDep :: PackageName -> RelaxedDep RelaxedDepScoped :: PackageName -> PackageName -> RelaxedDep -- | Convert RelaxDeps to a boolean. isRelaxDeps :: RelaxDeps -> Bool -- | RelaxDeps in the context of upper bounds (i.e. for -- --allow-newer flag) newtype AllowNewer AllowNewer :: RelaxDeps -> AllowNewer [unAllowNewer] :: AllowNewer -> RelaxDeps -- | RelaxDeps in the context of lower bounds (i.e. for -- --allow-older flag) newtype AllowOlder AllowOlder :: RelaxDeps -> AllowOlder [unAllowOlder] :: AllowOlder -> RelaxDeps configAbsolutePaths :: ConfigFlags -> NoCallStackIO ConfigFlags readPackageDbList :: String -> [Maybe PackageDB] showPackageDbList :: [Maybe PackageDB] -> [String] -- | Flags to copy: (destdir, copy-prefix (backwards compat), -- verbosity) data CopyFlags CopyFlags :: Flag CopyDest -> Flag FilePath -> Flag Verbosity -> [String] -> CopyFlags [copyDest] :: CopyFlags -> Flag CopyDest [copyDistPref] :: CopyFlags -> Flag FilePath [copyVerbosity] :: CopyFlags -> Flag Verbosity [copyArgs] :: CopyFlags -> [String] emptyCopyFlags :: CopyFlags defaultCopyFlags :: CopyFlags copyCommand :: CommandUI CopyFlags -- | Flags to install: (package db, verbosity) data InstallFlags InstallFlags :: Flag PackageDB -> Flag FilePath -> Flag Bool -> Flag Bool -> Flag Verbosity -> InstallFlags [installPackageDB] :: InstallFlags -> Flag PackageDB [installDistPref] :: InstallFlags -> Flag FilePath [installUseWrapper] :: InstallFlags -> Flag Bool [installInPlace] :: InstallFlags -> Flag Bool [installVerbosity] :: InstallFlags -> Flag Verbosity emptyInstallFlags :: InstallFlags defaultInstallFlags :: InstallFlags installCommand :: CommandUI InstallFlags data DoctestFlags DoctestFlags :: [(String, FilePath)] -> [(String, [String])] -> Flag FilePath -> Flag Verbosity -> DoctestFlags [doctestProgramPaths] :: DoctestFlags -> [(String, FilePath)] [doctestProgramArgs] :: DoctestFlags -> [(String, [String])] [doctestDistPref] :: DoctestFlags -> Flag FilePath [doctestVerbosity] :: DoctestFlags -> Flag Verbosity emptyDoctestFlags :: DoctestFlags defaultDoctestFlags :: DoctestFlags doctestCommand :: CommandUI DoctestFlags -- | When we build haddock documentation, there are two cases: -- --
-- splitArgs "--foo=\"C:/Program Files/Bar/" --baz" -- = ["--foo=C:/Program Files/Bar", "--baz"] ---- --
-- splitArgs "\"-DMSGSTR=\\\"foo bar\\\"\" --baz" -- = ["-DMSGSTR=\"foo bar\"","--baz"] --splitArgs :: String -> [String] defaultDistPref :: FilePath optionDistPref :: (flags -> Flag FilePath) -> (Flag FilePath -> flags -> flags) -> ShowOrParseArgs -> OptionField flags -- | All flags are monoids, they come in two flavours: -- --
-- --ghc-option=foo --ghc-option=bar ---- -- gives us all the values ["foo", "bar"] -- --
-- --enable-foo --disable-foo ---- -- gives us Just False So this Flag type is for the latter singular kind -- of flag. Its monoid instance gives us the behaviour where it starts -- out as NoFlag and later flags override earlier ones. data Flag a Flag :: a -> Flag a NoFlag :: Flag a toFlag :: a -> Flag a fromFlag :: WithCallStack (Flag a -> a) fromFlagOrDefault :: a -> Flag a -> a flagToMaybe :: Flag a -> Maybe a flagToList :: Flag a -> [a] maybeToFlag :: Maybe a -> Flag a -- | Types that represent boolean flags. class BooleanFlag a asBool :: BooleanFlag a => a -> Bool boolOpt :: SFlags -> SFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a boolOpt' :: OptFlags -> OptFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a trueArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a falseArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a optionVerbosity :: (flags -> Flag Verbosity) -> (Flag Verbosity -> flags -> flags) -> OptionField flags optionNumJobs :: (flags -> Flag (Maybe Int)) -> (Flag (Maybe Int) -> flags -> flags) -> OptionField flags readPToMaybe :: ReadP a a -> String -> Maybe a instance GHC.Generics.Generic Distribution.Simple.Setup.BenchmarkFlags instance GHC.Generics.Generic Distribution.Simple.Setup.TestFlags instance GHC.Show.Show Distribution.Simple.Setup.TestShowDetails instance GHC.Enum.Bounded Distribution.Simple.Setup.TestShowDetails instance GHC.Enum.Enum Distribution.Simple.Setup.TestShowDetails instance GHC.Classes.Ord Distribution.Simple.Setup.TestShowDetails instance GHC.Classes.Eq Distribution.Simple.Setup.TestShowDetails instance GHC.Generics.Generic Distribution.Simple.Setup.ReplFlags instance GHC.Show.Show Distribution.Simple.Setup.ReplFlags instance GHC.Generics.Generic Distribution.Simple.Setup.BuildFlags instance GHC.Show.Show Distribution.Simple.Setup.BuildFlags instance GHC.Read.Read Distribution.Simple.Setup.BuildFlags instance GHC.Generics.Generic Distribution.Simple.Setup.CleanFlags instance GHC.Show.Show Distribution.Simple.Setup.CleanFlags instance GHC.Generics.Generic Distribution.Simple.Setup.HaddockFlags instance GHC.Show.Show Distribution.Simple.Setup.HaddockFlags instance GHC.Generics.Generic Distribution.Simple.Setup.HaddockTarget instance GHC.Show.Show Distribution.Simple.Setup.HaddockTarget instance GHC.Classes.Eq Distribution.Simple.Setup.HaddockTarget instance GHC.Generics.Generic Distribution.Simple.Setup.DoctestFlags instance GHC.Show.Show Distribution.Simple.Setup.DoctestFlags instance GHC.Generics.Generic Distribution.Simple.Setup.HscolourFlags instance GHC.Show.Show Distribution.Simple.Setup.HscolourFlags instance GHC.Generics.Generic Distribution.Simple.Setup.RegisterFlags instance GHC.Show.Show Distribution.Simple.Setup.RegisterFlags instance GHC.Generics.Generic Distribution.Simple.Setup.SDistFlags instance GHC.Show.Show Distribution.Simple.Setup.SDistFlags instance GHC.Generics.Generic Distribution.Simple.Setup.InstallFlags instance GHC.Show.Show Distribution.Simple.Setup.InstallFlags instance GHC.Generics.Generic Distribution.Simple.Setup.CopyFlags instance GHC.Show.Show Distribution.Simple.Setup.CopyFlags instance GHC.Show.Show Distribution.Simple.Setup.ConfigFlags instance GHC.Read.Read Distribution.Simple.Setup.ConfigFlags instance GHC.Generics.Generic Distribution.Simple.Setup.ConfigFlags instance GHC.Generics.Generic Distribution.Simple.Setup.AllowNewer instance GHC.Show.Show Distribution.Simple.Setup.AllowNewer instance GHC.Read.Read Distribution.Simple.Setup.AllowNewer instance GHC.Classes.Eq Distribution.Simple.Setup.AllowNewer instance GHC.Generics.Generic Distribution.Simple.Setup.AllowOlder instance GHC.Show.Show Distribution.Simple.Setup.AllowOlder instance GHC.Read.Read Distribution.Simple.Setup.AllowOlder instance GHC.Classes.Eq Distribution.Simple.Setup.AllowOlder instance GHC.Generics.Generic Distribution.Simple.Setup.RelaxDeps instance GHC.Show.Show Distribution.Simple.Setup.RelaxDeps instance GHC.Read.Read Distribution.Simple.Setup.RelaxDeps instance GHC.Classes.Eq Distribution.Simple.Setup.RelaxDeps instance GHC.Generics.Generic Distribution.Simple.Setup.RelaxedDep instance GHC.Show.Show Distribution.Simple.Setup.RelaxedDep instance GHC.Read.Read Distribution.Simple.Setup.RelaxedDep instance GHC.Classes.Eq Distribution.Simple.Setup.RelaxedDep instance GHC.Generics.Generic Distribution.Simple.Setup.GlobalFlags instance GHC.Read.Read a => GHC.Read.Read (Distribution.Simple.Setup.Flag a) instance GHC.Show.Show a => GHC.Show.Show (Distribution.Simple.Setup.Flag a) instance GHC.Generics.Generic (Distribution.Simple.Setup.Flag a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Distribution.Simple.Setup.Flag a) instance GHC.Base.Monoid Distribution.Simple.Setup.BenchmarkFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.BenchmarkFlags instance GHC.Base.Monoid Distribution.Simple.Setup.TestFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.TestFlags instance Distribution.Text.Text Distribution.Simple.Setup.TestShowDetails instance GHC.Base.Monoid Distribution.Simple.Setup.TestShowDetails instance Data.Semigroup.Semigroup Distribution.Simple.Setup.TestShowDetails instance GHC.Base.Monoid Distribution.Simple.Setup.ReplFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.ReplFlags instance GHC.Base.Monoid Distribution.Simple.Setup.BuildFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.BuildFlags instance GHC.Base.Monoid Distribution.Simple.Setup.CleanFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.CleanFlags instance GHC.Base.Monoid Distribution.Simple.Setup.HaddockFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.HaddockFlags instance GHC.Base.Monoid Distribution.Simple.Setup.DoctestFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.DoctestFlags instance GHC.Base.Monoid Distribution.Simple.Setup.HscolourFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.HscolourFlags instance GHC.Base.Monoid Distribution.Simple.Setup.RegisterFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.RegisterFlags instance GHC.Base.Monoid Distribution.Simple.Setup.SDistFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.SDistFlags instance GHC.Base.Monoid Distribution.Simple.Setup.InstallFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.InstallFlags instance GHC.Base.Monoid Distribution.Simple.Setup.CopyFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.CopyFlags instance Data.Binary.Class.Binary Distribution.Simple.Setup.ConfigFlags instance GHC.Classes.Eq Distribution.Simple.Setup.ConfigFlags instance GHC.Base.Monoid Distribution.Simple.Setup.ConfigFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.ConfigFlags instance Data.Binary.Class.Binary Distribution.Simple.Setup.AllowNewer instance Data.Semigroup.Semigroup Distribution.Simple.Setup.AllowNewer instance GHC.Base.Monoid Distribution.Simple.Setup.AllowNewer instance Data.Binary.Class.Binary Distribution.Simple.Setup.AllowOlder instance Data.Semigroup.Semigroup Distribution.Simple.Setup.AllowOlder instance GHC.Base.Monoid Distribution.Simple.Setup.AllowOlder instance Data.Binary.Class.Binary Distribution.Simple.Setup.RelaxDeps instance Data.Semigroup.Semigroup Distribution.Simple.Setup.RelaxDeps instance GHC.Base.Monoid Distribution.Simple.Setup.RelaxDeps instance Distribution.Text.Text Distribution.Simple.Setup.RelaxedDep instance Data.Binary.Class.Binary Distribution.Simple.Setup.RelaxedDep instance GHC.Base.Monoid Distribution.Simple.Setup.GlobalFlags instance Data.Semigroup.Semigroup Distribution.Simple.Setup.GlobalFlags instance Distribution.Simple.Setup.BooleanFlag GHC.Types.Bool instance Data.Binary.Class.Binary a => Data.Binary.Class.Binary (Distribution.Simple.Setup.Flag a) instance GHC.Base.Functor Distribution.Simple.Setup.Flag instance GHC.Base.Monoid (Distribution.Simple.Setup.Flag a) instance Data.Semigroup.Semigroup (Distribution.Simple.Setup.Flag a) instance GHC.Enum.Bounded a => GHC.Enum.Bounded (Distribution.Simple.Setup.Flag a) instance GHC.Enum.Enum a => GHC.Enum.Enum (Distribution.Simple.Setup.Flag a) module Distribution.Types.LocalBuildInfo -- | Data cached after configuration step. See also ConfigFlags. data LocalBuildInfo LocalBuildInfo :: ConfigFlags -> FlagAssignment -> ComponentRequestedSpec -> [String] -> InstallDirTemplates -> Compiler -> Platform -> FilePath -> Graph ComponentLocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo] -> InstalledPackageIndex -> Maybe FilePath -> PackageDescription -> ProgramDb -> PackageDBStack -> Bool -> Bool -> Bool -> Bool -> Bool -> ProfDetailLevel -> ProfDetailLevel -> OptimisationLevel -> DebugInfoLevel -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> PathTemplate -> PathTemplate -> Bool -> LocalBuildInfo -- | Options passed to the configuration step. Needed to re-run -- configuration when .cabal is out of date [configFlags] :: LocalBuildInfo -> ConfigFlags -- | The final set of flags which were picked for this package [flagAssignment] :: LocalBuildInfo -> FlagAssignment -- | What components were enabled during configuration, and why. [componentEnabledSpec] :: LocalBuildInfo -> ComponentRequestedSpec -- | Extra args on the command line for the configuration step. Needed to -- re-run configuration when .cabal is out of date [extraConfigArgs] :: LocalBuildInfo -> [String] -- | The installation directories for the various different kinds of files -- TODO: inplaceDirTemplates :: InstallDirs FilePath [installDirTemplates] :: LocalBuildInfo -> InstallDirTemplates -- | The compiler we're building with [compiler] :: LocalBuildInfo -> Compiler -- | The platform we're building for [hostPlatform] :: LocalBuildInfo -> Platform -- | Where to build the package. [buildDir] :: LocalBuildInfo -> FilePath -- | All the components to build, ordered by topological sort, and with -- their INTERNAL dependencies over the intrapackage dependency graph. -- TODO: this is assumed to be short; otherwise we want some sort of -- ordered map. [componentGraph] :: LocalBuildInfo -> Graph ComponentLocalBuildInfo -- | A map from component name to all matching components. These coincide -- with componentGraph [componentNameMap] :: LocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo] -- | All the info about the installed packages that the current package -- depends on (directly or indirectly). The copy saved on disk does NOT -- include internal dependencies (because we just don't have enough -- information at this point to have an InstalledPackageInfo for -- an internal dep), but we will often update it with the internal -- dependencies; see for example build. (This admonition doesn't -- apply for per-component builds.) [installedPkgs] :: LocalBuildInfo -> InstalledPackageIndex -- | the filename containing the .cabal file, if available [pkgDescrFile] :: LocalBuildInfo -> Maybe FilePath -- | WARNING WARNING WARNING Be VERY careful about using this function; we -- haven't deprecated it but using it could introduce subtle bugs related -- to HookedBuildInfo. -- -- In principle, this is supposed to contain the resolved package -- description, that does not contain any conditionals. However, it MAY -- NOT contain the description wtih a HookedBuildInfo applied to -- it; see HookedBuildInfo for the whole sordid saga. As much as -- possible, Cabal library should avoid using this parameter. [localPkgDescr] :: LocalBuildInfo -> PackageDescription -- | Location and args for all programs [withPrograms] :: LocalBuildInfo -> ProgramDb -- | What package database to use, global/user [withPackageDB] :: LocalBuildInfo -> PackageDBStack -- | Whether to build normal libs. [withVanillaLib] :: LocalBuildInfo -> Bool -- | Whether to build profiling versions of libs. [withProfLib] :: LocalBuildInfo -> Bool -- | Whether to build shared versions of libs. [withSharedLib] :: LocalBuildInfo -> Bool -- | Whether to link executables dynamically [withDynExe] :: LocalBuildInfo -> Bool -- | Whether to build executables for profiling. [withProfExe] :: LocalBuildInfo -> Bool -- | Level of automatic profile detail. [withProfLibDetail] :: LocalBuildInfo -> ProfDetailLevel -- | Level of automatic profile detail. [withProfExeDetail] :: LocalBuildInfo -> ProfDetailLevel -- | Whether to build with optimization (if available). [withOptimization] :: LocalBuildInfo -> OptimisationLevel -- | Whether to emit debug info (if available). [withDebugInfo] :: LocalBuildInfo -> DebugInfoLevel -- | Whether to build libs suitable for use with GHCi. [withGHCiLib] :: LocalBuildInfo -> Bool -- | Use -split-objs with GHC, if available [splitObjs] :: LocalBuildInfo -> Bool -- | Whether to strip executables during install [stripExes] :: LocalBuildInfo -> Bool -- | Whether to strip libraries during install [stripLibs] :: LocalBuildInfo -> Bool -- | Whether to enable executable program coverage [exeCoverage] :: LocalBuildInfo -> Bool -- | Whether to enable library program coverage [libCoverage] :: LocalBuildInfo -> Bool -- | Prefix to be prepended to installed executables [progPrefix] :: LocalBuildInfo -> PathTemplate -- | Suffix to be appended to installed executables [progSuffix] :: LocalBuildInfo -> PathTemplate [relocatable] :: LocalBuildInfo -> Bool -- | Extract the ComponentId from the public library component of a -- LocalBuildInfo if it exists, or make a fake component ID based -- on the package ID. localComponentId :: LocalBuildInfo -> ComponentId -- | Extract the UnitId from the library component of a -- LocalBuildInfo if it exists, or make a fake unit ID based on -- the package ID. localUnitId :: LocalBuildInfo -> UnitId -- | Extract the compatibility package key from the public library -- component of a LocalBuildInfo if it exists, or make a fake -- package key based on the package ID. localCompatPackageKey :: LocalBuildInfo -> String -- | Extract the PackageIdentifier of a LocalBuildInfo. This -- is a "safe" use of localPkgDescr localPackage :: LocalBuildInfo -> PackageId -- | Return all ComponentLocalBuildInfos associated with -- ComponentName. In the presence of Backpack there may be more -- than one! componentNameCLBIs :: LocalBuildInfo -> ComponentName -> [ComponentLocalBuildInfo] -- | Return all TargetInfos associated with ComponentName. In -- the presence of Backpack there may be more than one! Has a prime -- because it takes a PackageDescription argument which may -- disagree with localPkgDescr in LocalBuildInfo. componentNameTargets' :: PackageDescription -> LocalBuildInfo -> ComponentName -> [TargetInfo] unitIdTarget' :: PackageDescription -> LocalBuildInfo -> UnitId -> Maybe TargetInfo -- | Return the list of default TargetInfos associated with a -- configured package, in the order they need to be built. Has a prime -- because it takes a PackageDescription argument which may -- disagree with localPkgDescr in LocalBuildInfo. allTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [TargetInfo] -- | Execute f for every TargetInfo in the package, -- respecting the build dependency order. (TODO: We should use Shake!) -- Has a prime because it takes a PackageDescription argument -- which may disagree with localPkgDescr in LocalBuildInfo. withAllTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> (TargetInfo -> IO ()) -> IO () -- | Return the list of all targets needed to build the uids, in -- the order they need to be built. Has a prime because it takes a -- PackageDescription argument which may disagree with -- localPkgDescr in LocalBuildInfo. neededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> [TargetInfo] -- | Execute f for every TargetInfo needed to build -- uids, respecting the build dependency order. Has a prime -- because it takes a PackageDescription argument which may -- disagree with localPkgDescr in LocalBuildInfo. withNeededTargetsInBuildOrder' :: PackageDescription -> LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO () -- | Is coverage enabled for test suites? In practice, this requires -- library and executable profiling to be enabled. testCoverage :: LocalBuildInfo -> Bool -- | Warning: By using this function, you may be introducing a bug where -- you retrieve a Component which does not have -- HookedBuildInfo applied to it. See the documentation for -- HookedBuildInfo for an explanation of the issue. If you have a -- PakcageDescription handy (NOT from the -- LocalBuildInfo), try using the primed version of the function, -- which takes it as an extra argument. componentNameTargets :: LocalBuildInfo -> ComponentName -> [TargetInfo] -- | Warning: By using this function, you may be introducing a bug where -- you retrieve a Component which does not have -- HookedBuildInfo applied to it. See the documentation for -- HookedBuildInfo for an explanation of the issue. If you have a -- PakcageDescription handy (NOT from the -- LocalBuildInfo), try using the primed version of the function, -- which takes it as an extra argument. unitIdTarget :: LocalBuildInfo -> UnitId -> Maybe TargetInfo -- | Warning: By using this function, you may be introducing a bug where -- you retrieve a Component which does not have -- HookedBuildInfo applied to it. See the documentation for -- HookedBuildInfo for an explanation of the issue. If you have a -- PakcageDescription handy (NOT from the -- LocalBuildInfo), try using the primed version of the function, -- which takes it as an extra argument. allTargetsInBuildOrder :: LocalBuildInfo -> [TargetInfo] -- | Warning: By using this function, you may be introducing a bug where -- you retrieve a Component which does not have -- HookedBuildInfo applied to it. See the documentation for -- HookedBuildInfo for an explanation of the issue. If you have a -- PakcageDescription handy (NOT from the -- LocalBuildInfo), try using the primed version of the function, -- which takes it as an extra argument. withAllTargetsInBuildOrder :: LocalBuildInfo -> (TargetInfo -> IO ()) -> IO () -- | Warning: By using this function, you may be introducing a bug where -- you retrieve a Component which does not have -- HookedBuildInfo applied to it. See the documentation for -- HookedBuildInfo for an explanation of the issue. If you have a -- PakcageDescription handy (NOT from the -- LocalBuildInfo), try using the primed version of the function, -- which takes it as an extra argument. neededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> [TargetInfo] -- | Warning: By using this function, you may be introducing a bug where -- you retrieve a Component which does not have -- HookedBuildInfo applied to it. See the documentation for -- HookedBuildInfo for an explanation of the issue. If you have a -- PakcageDescription handy (NOT from the -- LocalBuildInfo), try using the primed version of the function, -- which takes it as an extra argument. withNeededTargetsInBuildOrder :: LocalBuildInfo -> [UnitId] -> (TargetInfo -> IO ()) -> IO () -- | Deprecated: Use componentGraph instead; you can get a list -- of ComponentLocalBuildInfo with toList. There's not a -- good way to get the list of ComponentNames the -- ComponentLocalBuildInfo depends on because this query doesn't -- make sense; the graph is indexed by UnitId not -- ComponentName. Given a UnitId you can lookup the -- ComponentLocalBuildInfo (getCLBI) and then get the -- ComponentName ('componentLocalName]). To be removed in Cabal -- 2.2 componentsConfigs :: LocalBuildInfo -> [(ComponentName, ComponentLocalBuildInfo, [ComponentName])] -- | External package dependencies for the package as a whole. This is the -- union of the individual componentPackageDeps, less any internal -- deps. -- | Deprecated: You almost certainly don't want this function, which -- agglomerates the dependencies of ALL enabled components. If you're -- using this to write out information on your dependencies, read off the -- dependencies directly from the actual component in question. To be -- removed in Cabal 2.2 externalPackageDeps :: LocalBuildInfo -> [(UnitId, MungedPackageId)] instance GHC.Show.Show Distribution.Types.LocalBuildInfo.LocalBuildInfo instance GHC.Read.Read Distribution.Types.LocalBuildInfo.LocalBuildInfo instance GHC.Generics.Generic Distribution.Types.LocalBuildInfo.LocalBuildInfo instance Data.Binary.Class.Binary Distribution.Types.LocalBuildInfo.LocalBuildInfo -- | Once a package has been configured we have resolved conditionals and -- dependencies, configured the compiler and other needed external -- programs. The LocalBuildInfo is used to hold all this -- information. It holds the install dirs, the compiler, the exact -- package dependencies, the configured programs, the package database to -- use and a bunch of miscellaneous configure flags. It gets saved and -- reloaded from a file (dist/setup-config). It gets passed in -- to very many subsequent build actions. module Distribution.Simple.LocalBuildInfo -- | Data cached after configuration step. See also ConfigFlags. data LocalBuildInfo LocalBuildInfo :: ConfigFlags -> FlagAssignment -> ComponentRequestedSpec -> [String] -> InstallDirTemplates -> Compiler -> Platform -> FilePath -> Graph ComponentLocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo] -> InstalledPackageIndex -> Maybe FilePath -> PackageDescription -> ProgramDb -> PackageDBStack -> Bool -> Bool -> Bool -> Bool -> Bool -> ProfDetailLevel -> ProfDetailLevel -> OptimisationLevel -> DebugInfoLevel -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> PathTemplate -> PathTemplate -> Bool -> LocalBuildInfo -- | Options passed to the configuration step. Needed to re-run -- configuration when .cabal is out of date [configFlags] :: LocalBuildInfo -> ConfigFlags -- | The final set of flags which were picked for this package [flagAssignment] :: LocalBuildInfo -> FlagAssignment -- | What components were enabled during configuration, and why. [componentEnabledSpec] :: LocalBuildInfo -> ComponentRequestedSpec -- | Extra args on the command line for the configuration step. Needed to -- re-run configuration when .cabal is out of date [extraConfigArgs] :: LocalBuildInfo -> [String] -- | The installation directories for the various different kinds of files -- TODO: inplaceDirTemplates :: InstallDirs FilePath [installDirTemplates] :: LocalBuildInfo -> InstallDirTemplates -- | The compiler we're building with [compiler] :: LocalBuildInfo -> Compiler -- | The platform we're building for [hostPlatform] :: LocalBuildInfo -> Platform -- | Where to build the package. [buildDir] :: LocalBuildInfo -> FilePath -- | All the components to build, ordered by topological sort, and with -- their INTERNAL dependencies over the intrapackage dependency graph. -- TODO: this is assumed to be short; otherwise we want some sort of -- ordered map. [componentGraph] :: LocalBuildInfo -> Graph ComponentLocalBuildInfo -- | A map from component name to all matching components. These coincide -- with componentGraph [componentNameMap] :: LocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo] -- | All the info about the installed packages that the current package -- depends on (directly or indirectly). The copy saved on disk does NOT -- include internal dependencies (because we just don't have enough -- information at this point to have an InstalledPackageInfo for -- an internal dep), but we will often update it with the internal -- dependencies; see for example build. (This admonition doesn't -- apply for per-component builds.) [installedPkgs] :: LocalBuildInfo -> InstalledPackageIndex -- | the filename containing the .cabal file, if available [pkgDescrFile] :: LocalBuildInfo -> Maybe FilePath -- | WARNING WARNING WARNING Be VERY careful about using this function; we -- haven't deprecated it but using it could introduce subtle bugs related -- to HookedBuildInfo. -- -- In principle, this is supposed to contain the resolved package -- description, that does not contain any conditionals. However, it MAY -- NOT contain the description wtih a HookedBuildInfo applied to -- it; see HookedBuildInfo for the whole sordid saga. As much as -- possible, Cabal library should avoid using this parameter. [localPkgDescr] :: LocalBuildInfo -> PackageDescription -- | Location and args for all programs [withPrograms] :: LocalBuildInfo -> ProgramDb -- | What package database to use, global/user [withPackageDB] :: LocalBuildInfo -> PackageDBStack -- | Whether to build normal libs. [withVanillaLib] :: LocalBuildInfo -> Bool -- | Whether to build profiling versions of libs. [withProfLib] :: LocalBuildInfo -> Bool -- | Whether to build shared versions of libs. [withSharedLib] :: LocalBuildInfo -> Bool -- | Whether to link executables dynamically [withDynExe] :: LocalBuildInfo -> Bool -- | Whether to build executables for profiling. [withProfExe] :: LocalBuildInfo -> Bool -- | Level of automatic profile detail. [withProfLibDetail] :: LocalBuildInfo -> ProfDetailLevel -- | Level of automatic profile detail. [withProfExeDetail] :: LocalBuildInfo -> ProfDetailLevel -- | Whether to build with optimization (if available). [withOptimization] :: LocalBuildInfo -> OptimisationLevel -- | Whether to emit debug info (if available). [withDebugInfo] :: LocalBuildInfo -> DebugInfoLevel -- | Whether to build libs suitable for use with GHCi. [withGHCiLib] :: LocalBuildInfo -> Bool -- | Use -split-objs with GHC, if available [splitObjs] :: LocalBuildInfo -> Bool -- | Whether to strip executables during install [stripExes] :: LocalBuildInfo -> Bool -- | Whether to strip libraries during install [stripLibs] :: LocalBuildInfo -> Bool -- | Whether to enable executable program coverage [exeCoverage] :: LocalBuildInfo -> Bool -- | Whether to enable library program coverage [libCoverage] :: LocalBuildInfo -> Bool -- | Prefix to be prepended to installed executables [progPrefix] :: LocalBuildInfo -> PathTemplate -- | Suffix to be appended to installed executables [progSuffix] :: LocalBuildInfo -> PathTemplate [relocatable] :: LocalBuildInfo -> Bool -- | External package dependencies for the package as a whole. This is the -- union of the individual componentPackageDeps, less any internal -- deps. -- | Deprecated: You almost certainly don't want this function, which -- agglomerates the dependencies of ALL enabled components. If you're -- using this to write out information on your dependencies, read off the -- dependencies directly from the actual component in question. To be -- removed in Cabal 2.2 externalPackageDeps :: LocalBuildInfo -> [(UnitId, MungedPackageId)] -- | Extract the ComponentId from the public library component of a -- LocalBuildInfo if it exists, or make a fake component ID based -- on the package ID. localComponentId :: LocalBuildInfo -> ComponentId -- | Extract the UnitId from the library component of a -- LocalBuildInfo if it exists, or make a fake unit ID based on -- the package ID. localUnitId :: LocalBuildInfo -> UnitId -- | Extract the compatibility package key from the public library -- component of a LocalBuildInfo if it exists, or make a fake -- package key based on the package ID. localCompatPackageKey :: LocalBuildInfo -> String data Component CLib :: Library -> Component CFLib :: ForeignLib -> Component CExe :: Executable -> Component CTest :: TestSuite -> Component CBench :: Benchmark -> Component data ComponentName CLibName :: ComponentName CSubLibName :: UnqualComponentName -> ComponentName CFLibName :: UnqualComponentName -> ComponentName CExeName :: UnqualComponentName -> ComponentName CTestName :: UnqualComponentName -> ComponentName CBenchName :: UnqualComponentName -> ComponentName defaultLibName :: ComponentName showComponentName :: ComponentName -> String -- | This gets the underlying unqualified component name. In fact, it is -- guaranteed to uniquely identify a component, returning -- Nothing if the ComponentName was for the public -- library. componentNameString :: ComponentName -> Maybe UnqualComponentName -- | The first five fields are common across all algebraic variants. data ComponentLocalBuildInfo LibComponentLocalBuildInfo :: ComponentName -> ComponentId -> UnitId -> Bool -> [(ModuleName, OpenModule)] -> [(UnitId, MungedPackageId)] -> [(OpenUnitId, ModuleRenaming)] -> [UnitId] -> [UnitId] -> String -> MungedPackageName -> [ExposedModule] -> Bool -> ComponentLocalBuildInfo -- | It would be very convenient to store the literal Library here, but if -- we do that, it will get serialized (via the Binary) instance twice. So -- instead we just provide the ComponentName, which can be used to find -- the Component in the PackageDescription. NB: eventually, this will NOT -- uniquely identify the ComponentLocalBuildInfo. [componentLocalName] :: ComponentLocalBuildInfo -> ComponentName -- | The computed ComponentId of this component. [componentComponentId] :: ComponentLocalBuildInfo -> ComponentId -- | The computed UnitId which uniquely identifies this component. -- Might be hashed. [componentUnitId] :: ComponentLocalBuildInfo -> UnitId -- | Is this an indefinite component (i.e. has unfilled holes)? [componentIsIndefinite_] :: ComponentLocalBuildInfo -> Bool -- | How the component was instantiated [componentInstantiatedWith] :: ComponentLocalBuildInfo -> [(ModuleName, OpenModule)] -- | Resolved internal and external package dependencies for this -- component. The BuildInfo specifies a set of build dependencies -- that must be satisfied in terms of version ranges. This field fixes -- those dependencies to the specific versions available on this machine -- for this compiler. [componentPackageDeps] :: ComponentLocalBuildInfo -> [(UnitId, MungedPackageId)] -- | The set of packages that are brought into scope during compilation, -- including a ModuleRenaming which may used to hide or rename -- modules. This is what gets translated into -package-id -- arguments. This is a modernized version of -- componentPackageDeps, which is kept around for BC purposes. [componentIncludes] :: ComponentLocalBuildInfo -> [(OpenUnitId, ModuleRenaming)] [componentExeDeps] :: ComponentLocalBuildInfo -> [UnitId] -- | The internal dependencies which induce a graph on the -- ComponentLocalBuildInfo of this package. This does NOT coincide -- with componentPackageDeps because it ALSO records 'build-tool' -- dependencies on executables. Maybe one day cabal-install will -- also handle these correctly too! [componentInternalDeps] :: ComponentLocalBuildInfo -> [UnitId] -- | Compatibility "package key" that we pass to older versions of GHC. [componentCompatPackageKey] :: ComponentLocalBuildInfo -> String -- | Compatibility "package name" that we register this component as. [componentCompatPackageName] :: ComponentLocalBuildInfo -> MungedPackageName -- | A list of exposed modules (either defined in this component, or -- reexported from another component.) [componentExposedModules] :: ComponentLocalBuildInfo -> [ExposedModule] -- | Convenience field, specifying whether or not this is the "public -- library" that has the same name as the package. [componentIsPublic] :: ComponentLocalBuildInfo -> Bool FLibComponentLocalBuildInfo :: ComponentName -> ComponentId -> UnitId -> [(UnitId, MungedPackageId)] -> [(OpenUnitId, ModuleRenaming)] -> [UnitId] -> [UnitId] -> ComponentLocalBuildInfo -- | It would be very convenient to store the literal Library here, but if -- we do that, it will get serialized (via the Binary) instance twice. So -- instead we just provide the ComponentName, which can be used to find -- the Component in the PackageDescription. NB: eventually, this will NOT -- uniquely identify the ComponentLocalBuildInfo. [componentLocalName] :: ComponentLocalBuildInfo -> ComponentName -- | The computed ComponentId of this component. [componentComponentId] :: ComponentLocalBuildInfo -> ComponentId -- | The computed UnitId which uniquely identifies this component. -- Might be hashed. [componentUnitId] :: ComponentLocalBuildInfo -> UnitId -- | Resolved internal and external package dependencies for this -- component. The BuildInfo specifies a set of build dependencies -- that must be satisfied in terms of version ranges. This field fixes -- those dependencies to the specific versions available on this machine -- for this compiler. [componentPackageDeps] :: ComponentLocalBuildInfo -> [(UnitId, MungedPackageId)] -- | The set of packages that are brought into scope during compilation, -- including a ModuleRenaming which may used to hide or rename -- modules. This is what gets translated into -package-id -- arguments. This is a modernized version of -- componentPackageDeps, which is kept around for BC purposes. [componentIncludes] :: ComponentLocalBuildInfo -> [(OpenUnitId, ModuleRenaming)] [componentExeDeps] :: ComponentLocalBuildInfo -> [UnitId] -- | The internal dependencies which induce a graph on the -- ComponentLocalBuildInfo of this package. This does NOT coincide -- with componentPackageDeps because it ALSO records 'build-tool' -- dependencies on executables. Maybe one day cabal-install will -- also handle these correctly too! [componentInternalDeps] :: ComponentLocalBuildInfo -> [UnitId] ExeComponentLocalBuildInfo :: ComponentName -> ComponentId -> UnitId -> [(UnitId, MungedPackageId)] -> [(OpenUnitId, ModuleRenaming)] -> [UnitId] -> [UnitId] -> ComponentLocalBuildInfo -- | It would be very convenient to store the literal Library here, but if -- we do that, it will get serialized (via the Binary) instance twice. So -- instead we just provide the ComponentName, which can be used to find -- the Component in the PackageDescription. NB: eventually, this will NOT -- uniquely identify the ComponentLocalBuildInfo. [componentLocalName] :: ComponentLocalBuildInfo -> ComponentName -- | The computed ComponentId of this component. [componentComponentId] :: ComponentLocalBuildInfo -> ComponentId -- | The computed UnitId which uniquely identifies this component. -- Might be hashed. [componentUnitId] :: ComponentLocalBuildInfo -> UnitId -- | Resolved internal and external package dependencies for this -- component. The BuildInfo specifies a set of build dependencies -- that must be satisfied in terms of version ranges. This field fixes -- those dependencies to the specific versions available on this machine -- for this compiler. [componentPackageDeps] :: ComponentLocalBuildInfo -> [(UnitId, MungedPackageId)] -- | The set of packages that are brought into scope during compilation, -- including a ModuleRenaming which may used to hide or rename -- modules. This is what gets translated into -package-id -- arguments. This is a modernized version of -- componentPackageDeps, which is kept around for BC purposes. [componentIncludes] :: ComponentLocalBuildInfo -> [(OpenUnitId, ModuleRenaming)] [componentExeDeps] :: ComponentLocalBuildInfo -> [UnitId] -- | The internal dependencies which induce a graph on the -- ComponentLocalBuildInfo of this package. This does NOT coincide -- with componentPackageDeps because it ALSO records 'build-tool' -- dependencies on executables. Maybe one day cabal-install will -- also handle these correctly too! [componentInternalDeps] :: ComponentLocalBuildInfo -> [UnitId] TestComponentLocalBuildInfo :: ComponentName -> ComponentId -> UnitId -> [(UnitId, MungedPackageId)] -> [(OpenUnitId, ModuleRenaming)] -> [UnitId] -> [UnitId] -> ComponentLocalBuildInfo -- | It would be very convenient to store the literal Library here, but if -- we do that, it will get serialized (via the Binary) instance twice. So -- instead we just provide the ComponentName, which can be used to find -- the Component in the PackageDescription. NB: eventually, this will NOT -- uniquely identify the ComponentLocalBuildInfo. [componentLocalName] :: ComponentLocalBuildInfo -> ComponentName -- | The computed ComponentId of this component. [componentComponentId] :: ComponentLocalBuildInfo -> ComponentId -- | The computed UnitId which uniquely identifies this component. -- Might be hashed. [componentUnitId] :: ComponentLocalBuildInfo -> UnitId -- | Resolved internal and external package dependencies for this -- component. The BuildInfo specifies a set of build dependencies -- that must be satisfied in terms of version ranges. This field fixes -- those dependencies to the specific versions available on this machine -- for this compiler. [componentPackageDeps] :: ComponentLocalBuildInfo -> [(UnitId, MungedPackageId)] -- | The set of packages that are brought into scope during compilation, -- including a ModuleRenaming which may used to hide or rename -- modules. This is what gets translated into -package-id -- arguments. This is a modernized version of -- componentPackageDeps, which is kept around for BC purposes. [componentIncludes] :: ComponentLocalBuildInfo -> [(OpenUnitId, ModuleRenaming)] [componentExeDeps] :: ComponentLocalBuildInfo -> [UnitId] -- | The internal dependencies which induce a graph on the -- ComponentLocalBuildInfo of this package. This does NOT coincide -- with componentPackageDeps because it ALSO records 'build-tool' -- dependencies on executables. Maybe one day cabal-install will -- also handle these correctly too! [componentInternalDeps] :: ComponentLocalBuildInfo -> [UnitId] BenchComponentLocalBuildInfo :: ComponentName -> ComponentId -> UnitId -> [(UnitId, MungedPackageId)] -> [(OpenUnitId, ModuleRenaming)] -> [UnitId] -> [UnitId] -> ComponentLocalBuildInfo -- | It would be very convenient to store the literal Library here, but if -- we do that, it will get serialized (via the Binary) instance twice. So -- instead we just provide the ComponentName, which can be used to find -- the Component in the PackageDescription. NB: eventually, this will NOT -- uniquely identify the ComponentLocalBuildInfo. [componentLocalName] :: ComponentLocalBuildInfo -> ComponentName -- | The computed ComponentId of this component. [componentComponentId] :: ComponentLocalBuildInfo -> ComponentId -- | The computed UnitId which uniquely identifies this component. -- Might be hashed. [componentUnitId] :: ComponentLocalBuildInfo -> UnitId -- | Resolved internal and external package dependencies for this -- component. The BuildInfo specifies a set of build dependencies -- that must be satisfied in terms of version ranges. This field fixes -- those dependencies to the specific versions available on this machine -- for this compiler. [componentPackageDeps] :: ComponentLocalBuildInfo -> [(UnitId, MungedPackageId)] -- | The set of packages that are brought into scope during compilation, -- including a ModuleRenaming which may used to hide or rename -- modules. This is what gets translated into -package-id -- arguments. This is a modernized version of -- componentPackageDeps, which is kept around for BC purposes. [componentIncludes] :: ComponentLocalBuildInfo -> [(OpenUnitId, ModuleRenaming)] [componentExeDeps] :: ComponentLocalBuildInfo -> [UnitId] -- | The internal dependencies which induce a graph on the -- ComponentLocalBuildInfo of this package. This does NOT coincide -- with componentPackageDeps because it ALSO records 'build-tool' -- dependencies on executables. Maybe one day cabal-install will -- also handle these correctly too! [componentInternalDeps] :: ComponentLocalBuildInfo -> [UnitId] componentBuildDir :: LocalBuildInfo -> ComponentLocalBuildInfo -> FilePath foldComponent :: (Library -> a) -> (ForeignLib -> a) -> (Executable -> a) -> (TestSuite -> a) -> (Benchmark -> a) -> Component -> a componentName :: Component -> ComponentName componentBuildInfo :: Component -> BuildInfo -- | Is a component buildable (i.e., not marked with buildable: -- False)? See also this note in -- Distribution.Types.ComponentRequestedSpec#buildable_vs_enabled_components. componentBuildable :: Component -> Bool -- | All the components in the package. pkgComponents :: PackageDescription -> [Component] -- | A list of all components in the package that are buildable, i.e., were -- not marked with buildable: False. This does NOT indicate if -- we are actually going to build the component, see -- enabledComponents instead. pkgBuildableComponents :: PackageDescription -> [Component] lookupComponent :: PackageDescription -> ComponentName -> Maybe Component getComponent :: PackageDescription -> ComponentName -> Component -- | Deprecated: This function is not well-defined, because a -- ComponentName does not uniquely identify a -- ComponentLocalBuildInfo. If you have a TargetInfo, you -- should use targetCLBI to get the -- ComponentLocalBuildInfo. Otherwise, use -- componentNameTargets to get all possible -- ComponentLocalBuildInfos. This will be removed in Cabal -- 2.2. getComponentLocalBuildInfo :: LocalBuildInfo -> ComponentName -> ComponentLocalBuildInfo allComponentsInBuildOrder :: LocalBuildInfo -> [ComponentLocalBuildInfo] -- | Deprecated: You've got TargetInfo right? Use -- neededTargetsInBuildOrder on the UnitIds you can -- nodeKey out. componentsInBuildOrder :: LocalBuildInfo -> [ComponentName] -> [ComponentLocalBuildInfo] -- | Determine the directories containing the dynamic libraries of the -- transitive dependencies of the component we are building. -- -- When wanted, and possible, returns paths relative to the installDirs -- prefix depLibraryPaths :: Bool -> Bool -> LocalBuildInfo -> ComponentLocalBuildInfo -> NoCallStackIO [FilePath] -- | Get all module names that needed to be built by GHC; i.e., all of -- these ModuleNames have interface files associated with them -- that need to be installed. allLibModules :: Library -> ComponentLocalBuildInfo -> [ModuleName] -- | Perform the action on each buildable Library or -- Executable (Component) in the PackageDescription, subject to -- the build order specified by the compBuildOrder field of the -- given LocalBuildInfo withAllComponentsInBuildOrder :: PackageDescription -> LocalBuildInfo -> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO () -- | Deprecated: You have got a TargetInfo right? Use -- withNeededTargetsInBuildOrder on the UnitIds you can -- nodeKey out. withComponentsInBuildOrder :: PackageDescription -> LocalBuildInfo -> [ComponentName] -> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO () -- | Deprecated: Use withAllComponentsInBuildOrder withComponentsLBI :: PackageDescription -> LocalBuildInfo -> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO () -- | Perform the action on each enabled library in the package -- description with the ComponentLocalBuildInfo. withLibLBI :: PackageDescription -> LocalBuildInfo -> (Library -> ComponentLocalBuildInfo -> IO ()) -> IO () -- | Perform the action on each enabled Executable in the package -- description. Extended version of withExe that also gives -- corresponding build info. withExeLBI :: PackageDescription -> LocalBuildInfo -> (Executable -> ComponentLocalBuildInfo -> IO ()) -> IO () -- | Perform the action on each enabled Benchmark in the package -- description. withBenchLBI :: PackageDescription -> LocalBuildInfo -> (Benchmark -> ComponentLocalBuildInfo -> IO ()) -> IO () withTestLBI :: PackageDescription -> LocalBuildInfo -> (TestSuite -> ComponentLocalBuildInfo -> IO ()) -> IO () enabledTestLBIs :: PackageDescription -> LocalBuildInfo -> [(TestSuite, ComponentLocalBuildInfo)] enabledBenchLBIs :: PackageDescription -> LocalBuildInfo -> [(Benchmark, ComponentLocalBuildInfo)] -- | Backwards compatibility function which computes the InstallDirs -- assuming that $libname points to the public library (or some -- fake package identifier if there is no public library.) IF AT ALL -- POSSIBLE, please use absoluteComponentInstallDirs instead. absoluteInstallDirs :: PackageDescription -> LocalBuildInfo -> CopyDest -> InstallDirs FilePath -- | Backwards compatibility function which computes the InstallDirs -- assuming that $libname points to the public library (or some -- fake package identifier if there is no public library.) IF AT ALL -- POSSIBLE, please use prefixRelativeComponentInstallDirs -- instead. prefixRelativeInstallDirs :: PackageId -> LocalBuildInfo -> InstallDirs (Maybe FilePath) -- | See absoluteInstallDirs. absoluteComponentInstallDirs :: PackageDescription -> LocalBuildInfo -> UnitId -> CopyDest -> InstallDirs FilePath -- | See prefixRelativeInstallDirs prefixRelativeComponentInstallDirs :: PackageId -> LocalBuildInfo -> UnitId -> InstallDirs (Maybe FilePath) substPathTemplate :: PackageId -> LocalBuildInfo -> UnitId -> PathTemplate -> FilePath -- | This module provides an library interface to the ar program. module Distribution.Simple.Program.Ar -- | Call ar to create a library archive from a bunch of object -- files. createArLibArchive :: Verbosity -> LocalBuildInfo -> FilePath -> [FilePath] -> IO () -- | Like the unix xargs program. Useful for when we've got very long -- command lines that might overflow an OS limit on command line length -- and so you need to invoke a command multiple times to get all the args -- in. -- -- It takes four template invocations corresponding to the simple, -- initial, middle and last invocations. If the number of args given is -- small enough that we can get away with just a single invocation then -- the simple one is used: -- --
-- $ simple args ---- -- If the number of args given means that we need to use multiple -- invocations then the templates for the initial, middle and last -- invocations are used: -- --
-- $ initial args_0 -- $ middle args_1 -- $ middle args_2 -- ... -- $ final args_n --multiStageProgramInvocation :: ProgramInvocation -> (ProgramInvocation, ProgramInvocation, ProgramInvocation) -> [String] -> [ProgramInvocation] -- | This module provides functions for locating various HPC-related paths -- and a function for adding the necessary options to a -- PackageDescription to build test suites with HPC enabled. module Distribution.Simple.Hpc data Way Vanilla :: Way Prof :: Way Dyn :: Way -- | Attempt to guess the way the test suites in this package were compiled -- and linked with the library so the correct module interfaces are -- found. guessWay :: LocalBuildInfo -> Way htmlDir :: FilePath -> Way -> FilePath -> FilePath mixDir :: FilePath -> Way -> FilePath -> FilePath tixDir :: FilePath -> Way -> FilePath -> FilePath -- | Path to the .tix file containing a test suite's sum statistics. tixFilePath :: FilePath -> Way -> FilePath -> FilePath -- | Generate the HTML markup for all of a package's test suites. markupPackage :: Verbosity -> LocalBuildInfo -> FilePath -> String -> [TestSuite] -> IO () -- | Generate the HTML markup for a test suite. markupTest :: Verbosity -> LocalBuildInfo -> FilePath -> String -> TestSuite -> IO () instance GHC.Show.Show Distribution.Simple.Hpc.Way instance GHC.Read.Read Distribution.Simple.Hpc.Way instance GHC.Classes.Eq Distribution.Simple.Hpc.Way instance GHC.Enum.Enum Distribution.Simple.Hpc.Way instance GHC.Enum.Bounded Distribution.Simple.Hpc.Way -- | Generate cabal_macros.h - CPP macros for package version testing -- -- When using CPP you get -- --
-- VERSION_<package> -- MIN_VERSION_<package>(A,B,C) ---- -- for each package in build-depends, which is true if -- the version of package in use is >= A.B.C, using -- the normal ordering on version numbers. -- -- TODO Figure out what to do about backpack and internal libraries. It -- is very suspecious that this stuff works with munged package -- identifiers module Distribution.Simple.Build.Macros -- | The contents of the cabal_macros.h for the given configured -- package. generate :: PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> String -- | Helper function that generates just the VERSION_pkg and -- MIN_VERSION_pkg macros for a list of package ids (usually -- used with the specific deps of a configured package). generatePackageVersionMacros :: [PackageId] -> String -- | See -- https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst module Distribution.Backpack.ComponentsGraph -- | A graph of source-level components by their source-level dependencies type ComponentsGraph = Graph (Node ComponentName Component) -- | A list of components associated with the source level dependencies -- between them. type ComponentsWithDeps = [(Component, [ComponentName])] -- | Create a Graph of Component, or report a cycle if there -- is a problem. mkComponentsGraph :: ComponentRequestedSpec -> PackageDescription -> Either [ComponentName] ComponentsGraph -- | Given the package description and a PackageDescription (used to -- determine if a package name is internal or not), sort the components -- in dependency order (fewest dependencies first). This is NOT -- necessarily the build order (although it is in the absence of -- Backpack.) componentsGraphToList :: ComponentsGraph -> ComponentsWithDeps -- | Pretty-print ComponentsWithDeps. dispComponentsWithDeps :: ComponentsWithDeps -> Doc -- | Error message when there is a cycle; takes the SCC of components. componentCycleMsg :: [ComponentName] -> Doc module Distribution.Simple.Test.Log -- | Logs all test results for a package, broken down first by test suite -- and then by test case. data PackageLog PackageLog :: PackageId -> CompilerId -> Platform -> [TestSuiteLog] -> PackageLog [package] :: PackageLog -> PackageId [compiler] :: PackageLog -> CompilerId [platform] :: PackageLog -> Platform [testSuites] :: PackageLog -> [TestSuiteLog] data TestLogs TestLog :: String -> Options -> Result -> TestLogs [testName] :: TestLogs -> String [testOptionsReturned] :: TestLogs -> Options [testResult] :: TestLogs -> Result GroupLogs :: String -> [TestLogs] -> TestLogs -- | Logs test suite results, itemized by test case. data TestSuiteLog TestSuiteLog :: UnqualComponentName -> TestLogs -> FilePath -> TestSuiteLog [testSuiteName] :: TestSuiteLog -> UnqualComponentName [testLogs] :: TestSuiteLog -> TestLogs [logFile] :: TestSuiteLog -> FilePath -- | Count the number of pass, fail, and error test results in a -- TestLogs tree. countTestResults :: TestLogs -> (Int, Int, Int) -- | A PackageLog with package and platform information specified. localPackageLog :: PackageDescription -> LocalBuildInfo -> PackageLog -- | Print a summary to the console after all test suites have been run -- indicating the number of successful test suites and cases. Returns -- True if all test suites passed and False otherwise. summarizePackage :: Verbosity -> PackageLog -> IO Bool -- | Print a summary of the test suite's results on the console, -- suppressing output for certain verbosity or test filter levels. summarizeSuiteFinish :: TestSuiteLog -> String summarizeSuiteStart :: String -> String -- | Print a summary of a single test case's result to the console, -- supressing output for certain verbosity or test filter levels. summarizeTest :: Verbosity -> TestShowDetails -> TestLogs -> IO () -- | From a TestSuiteLog, determine if the test suite encountered -- errors. suiteError :: TestLogs -> Bool -- | From a TestSuiteLog, determine if the test suite failed. suiteFailed :: TestLogs -> Bool -- | From a TestSuiteLog, determine if the test suite passed. suitePassed :: TestLogs -> Bool testSuiteLogPath :: PathTemplate -> PackageDescription -> LocalBuildInfo -> String -> TestLogs -> FilePath instance GHC.Classes.Eq Distribution.Simple.Test.Log.PackageLog instance GHC.Show.Show Distribution.Simple.Test.Log.PackageLog instance GHC.Read.Read Distribution.Simple.Test.Log.PackageLog instance GHC.Classes.Eq Distribution.Simple.Test.Log.TestSuiteLog instance GHC.Show.Show Distribution.Simple.Test.Log.TestSuiteLog instance GHC.Read.Read Distribution.Simple.Test.Log.TestSuiteLog instance GHC.Classes.Eq Distribution.Simple.Test.Log.TestLogs instance GHC.Show.Show Distribution.Simple.Test.Log.TestLogs instance GHC.Read.Read Distribution.Simple.Test.Log.TestLogs module Distribution.Simple.Program.GHC -- | A structured set of GHC options/flags data GhcOptions GhcOptions :: Flag GhcMode -> NubListR String -> NubListR String -> NubListR FilePath -> NubListR ModuleName -> Flag FilePath -> Flag FilePath -> Flag Bool -> NubListR FilePath -> Flag String -> Flag ComponentId -> [(ModuleName, OpenModule)] -> Flag Bool -> PackageDBStack -> NubListR (OpenUnitId, ModuleRenaming) -> Flag Bool -> Flag Bool -> Flag Bool -> NubListR FilePath -> NubListR FilePath -> NubListR String -> NubListR String -> NubListR String -> Flag Bool -> Flag Bool -> NubListR FilePath -> NubListR String -> NubListR String -> NubListR FilePath -> NubListR FilePath -> NubListR FilePath -> Flag Language -> NubListR Extension -> Map Extension String -> Flag GhcOptimisation -> Flag Bool -> Flag Bool -> Flag GhcProfAuto -> Flag Bool -> Flag (Maybe Int) -> Flag FilePath -> NubListR FilePath -> Flag String -> Flag String -> Flag String -> Flag String -> Flag FilePath -> Flag FilePath -> Flag FilePath -> Flag FilePath -> Flag GhcDynLinkMode -> Flag Bool -> Flag Bool -> Flag Bool -> Flag String -> NubListR FilePath -> Flag Verbosity -> NubListR FilePath -> Flag Bool -> GhcOptions -- | The major mode for the ghc invocation. [ghcOptMode] :: GhcOptions -> Flag GhcMode -- | Any extra options to pass directly to ghc. These go at the end and -- hence override other stuff. [ghcOptExtra] :: GhcOptions -> NubListR String -- | Extra default flags to pass directly to ghc. These go at the beginning -- and so can be overridden by other stuff. [ghcOptExtraDefault] :: GhcOptions -> NubListR String -- | The main input files; could be .hs, .hi, .c, .o, depending on mode. [ghcOptInputFiles] :: GhcOptions -> NubListR FilePath -- | The names of input Haskell modules, mainly for --make mode. [ghcOptInputModules] :: GhcOptions -> NubListR ModuleName -- | Location for output file; the ghc -o flag. [ghcOptOutputFile] :: GhcOptions -> Flag FilePath -- | Location for dynamic output file in GhcStaticAndDynamic mode; -- the ghc -dyno flag. [ghcOptOutputDynFile] :: GhcOptions -> Flag FilePath -- | Start with an empty search path for Haskell source files; the ghc -- -i flag (-i on it's own with no path argument). [ghcOptSourcePathClear] :: GhcOptions -> Flag Bool -- | Search path for Haskell source files; the ghc -i flag. [ghcOptSourcePath] :: GhcOptions -> NubListR FilePath -- | The unit ID the modules will belong to; the ghc -this-unit-id -- flag (or -this-package-key or -package-name on older -- versions of GHC). This is a String because we assume you've -- already figured out what the correct format for this string is (we -- need to handle backwards compatibility.) [ghcOptThisUnitId] :: GhcOptions -> Flag String -- | GHC doesn't make any assumptions about the format of definite unit -- ids, so when we are instantiating a package it needs to be told -- explicitly what the component being instantiated is. This only gets -- set when ghcOptInstantiatedWith is non-empty [ghcOptThisComponentId] :: GhcOptions -> Flag ComponentId -- | How the requirements of the package being compiled are to be filled. -- When typechecking an indefinite package, the OpenModule is -- always a OpenModuleVar; otherwise, it specifies the installed -- module that instantiates a package. [ghcOptInstantiatedWith] :: GhcOptions -> [(ModuleName, OpenModule)] -- | No code? (But we turn on interface writing [ghcOptNoCode] :: GhcOptions -> Flag Bool -- | GHC package databases to use, the ghc -package-conf flag. [ghcOptPackageDBs] :: GhcOptions -> PackageDBStack -- | The GHC packages to bring into scope when compiling, the ghc -- -package-id flags. [ghcOptPackages] :: GhcOptions -> NubListR (OpenUnitId, ModuleRenaming) -- | Start with a clean package set; the ghc -hide-all-packages -- flag [ghcOptHideAllPackages] :: GhcOptions -> Flag Bool -- | Warn about modules, not listed in command line [ghcOptWarnMissingHomeModules] :: GhcOptions -> Flag Bool -- | Don't automatically link in Haskell98 etc; the ghc -- -no-auto-link-packages flag. [ghcOptNoAutoLinkPackages] :: GhcOptions -> Flag Bool -- | Names of libraries to link in; the ghc -l flag. [ghcOptLinkLibs] :: GhcOptions -> NubListR FilePath -- | Search path for libraries to link in; the ghc -L flag. [ghcOptLinkLibPath] :: GhcOptions -> NubListR FilePath -- | Options to pass through to the linker; the ghc -optl flag. [ghcOptLinkOptions] :: GhcOptions -> NubListR String -- | OSX only: frameworks to link in; the ghc -framework flag. [ghcOptLinkFrameworks] :: GhcOptions -> NubListR String -- | OSX only: Search path for frameworks to link in; the ghc -- -framework-path flag. [ghcOptLinkFrameworkDirs] :: GhcOptions -> NubListR String -- | Don't do the link step, useful in make mode; the ghc -no-link -- flag. [ghcOptNoLink] :: GhcOptions -> Flag Bool -- | Don't link in the normal RTS main entry point; the ghc -- -no-hs-main flag. [ghcOptLinkNoHsMain] :: GhcOptions -> Flag Bool -- | Module definition files (Windows specific) [ghcOptLinkModDefFiles] :: GhcOptions -> NubListR FilePath -- | Options to pass through to the C compiler; the ghc -optc -- flag. [ghcOptCcOptions] :: GhcOptions -> NubListR String -- | Options to pass through to CPP; the ghc -optP flag. [ghcOptCppOptions] :: GhcOptions -> NubListR String -- | Search path for CPP includes like header files; the ghc -I -- flag. [ghcOptCppIncludePath] :: GhcOptions -> NubListR FilePath -- | Extra header files to include at CPP stage; the ghc -- -optP-include flag. [ghcOptCppIncludes] :: GhcOptions -> NubListR FilePath -- | Extra header files to include for old-style FFI; the ghc -- -#include flag. [ghcOptFfiIncludes] :: GhcOptions -> NubListR FilePath -- | The base language; the ghc -XHaskell98 or -- -XHaskell2010 flag. [ghcOptLanguage] :: GhcOptions -> Flag Language -- | The language extensions; the ghc -X flag. [ghcOptExtensions] :: GhcOptions -> NubListR Extension -- | A GHC version-dependent mapping of extensions to flags. This must be -- set to be able to make use of the ghcOptExtensions. [ghcOptExtensionMap] :: GhcOptions -> Map Extension String -- | What optimisation level to use; the ghc -O flag. [ghcOptOptimisation] :: GhcOptions -> Flag GhcOptimisation -- | Emit debug info; the ghc -g flag. [ghcOptDebugInfo] :: GhcOptions -> Flag Bool -- | Compile in profiling mode; the ghc -prof flag. [ghcOptProfilingMode] :: GhcOptions -> Flag Bool -- | Automatically add profiling cost centers; the ghc -- -fprof-auto* flags. [ghcOptProfilingAuto] :: GhcOptions -> Flag GhcProfAuto -- | Use the "split object files" feature; the ghc -split-objs -- flag. [ghcOptSplitObjs] :: GhcOptions -> Flag Bool -- | Run N jobs simultaneously (if possible). [ghcOptNumJobs] :: GhcOptions -> Flag (Maybe Int) -- | Enable coverage analysis; the ghc -fhpc -hpcdir flags. [ghcOptHPCDir] :: GhcOptions -> Flag FilePath -- | Extra GHCi startup scripts; the -ghci-script flag [ghcOptGHCiScripts] :: GhcOptions -> NubListR FilePath [ghcOptHiSuffix] :: GhcOptions -> Flag String [ghcOptObjSuffix] :: GhcOptions -> Flag String -- | only in GhcStaticAndDynamic mode [ghcOptDynHiSuffix] :: GhcOptions -> Flag String -- | only in GhcStaticAndDynamic mode [ghcOptDynObjSuffix] :: GhcOptions -> Flag String [ghcOptHiDir] :: GhcOptions -> Flag FilePath [ghcOptObjDir] :: GhcOptions -> Flag FilePath [ghcOptOutputDir] :: GhcOptions -> Flag FilePath [ghcOptStubDir] :: GhcOptions -> Flag FilePath [ghcOptDynLinkMode] :: GhcOptions -> Flag GhcDynLinkMode [ghcOptStaticLib] :: GhcOptions -> Flag Bool [ghcOptShared] :: GhcOptions -> Flag Bool [ghcOptFPic] :: GhcOptions -> Flag Bool [ghcOptDylibName] :: GhcOptions -> Flag String [ghcOptRPaths] :: GhcOptions -> NubListR FilePath -- | Get GHC to be quiet or verbose with what it's doing; the ghc -- -v flag. [ghcOptVerbosity] :: GhcOptions -> Flag Verbosity -- | Put the extra folders in the PATH environment variable we invoke GHC -- with [ghcOptExtraPath] :: GhcOptions -> NubListR FilePath -- | Let GHC know that it is Cabal that's calling it. Modifies some of the -- GHC error messages. [ghcOptCabal] :: GhcOptions -> Flag Bool data GhcMode -- |
-- ghc -c --GhcModeCompile :: GhcMode -- |
-- ghc --GhcModeLink :: GhcMode -- |
-- ghc --make --GhcModeMake :: GhcMode -- | ghci / ghc --interactive GhcModeInteractive :: GhcMode -- | ghc --abi-hash | GhcModeDepAnalysis -- ^ ghc -M | -- GhcModeEvaluate -- ^ ghc -e GhcModeAbiHash :: GhcMode data GhcOptimisation -- |
-- -O0 --GhcNoOptimisation :: GhcOptimisation -- |
-- -O --GhcNormalOptimisation :: GhcOptimisation -- |
-- -O2 --GhcMaximumOptimisation :: GhcOptimisation -- | e.g. -Odph GhcSpecialOptimisation :: String -> GhcOptimisation data GhcDynLinkMode -- |
-- -static --GhcStaticOnly :: GhcDynLinkMode -- |
-- -dynamic --GhcDynamicOnly :: GhcDynLinkMode -- |
-- -static -dynamic-too --GhcStaticAndDynamic :: GhcDynLinkMode data GhcProfAuto -- |
-- -fprof-auto --GhcProfAutoAll :: GhcProfAuto -- |
-- -fprof-auto-top --GhcProfAutoToplevel :: GhcProfAuto -- |
-- -fprof-auto-exported --GhcProfAutoExported :: GhcProfAuto ghcInvocation :: ConfiguredProgram -> Compiler -> Platform -> GhcOptions -> ProgramInvocation renderGhcOptions :: Compiler -> Platform -> GhcOptions -> [String] runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> Platform -> GhcOptions -> IO () instance GHC.Generics.Generic Distribution.Simple.Program.GHC.GhcOptions instance GHC.Show.Show Distribution.Simple.Program.GHC.GhcOptions instance GHC.Classes.Eq Distribution.Simple.Program.GHC.GhcProfAuto instance GHC.Show.Show Distribution.Simple.Program.GHC.GhcProfAuto instance GHC.Classes.Eq Distribution.Simple.Program.GHC.GhcDynLinkMode instance GHC.Show.Show Distribution.Simple.Program.GHC.GhcDynLinkMode instance GHC.Classes.Eq Distribution.Simple.Program.GHC.GhcOptimisation instance GHC.Show.Show Distribution.Simple.Program.GHC.GhcOptimisation instance GHC.Classes.Eq Distribution.Simple.Program.GHC.GhcMode instance GHC.Show.Show Distribution.Simple.Program.GHC.GhcMode instance GHC.Base.Monoid Distribution.Simple.Program.GHC.GhcOptions instance Data.Semigroup.Semigroup Distribution.Simple.Program.GHC.GhcOptions -- | See -- https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst module Distribution.Backpack.ConfiguredComponent -- | A configured component, we know exactly what its ComponentId -- is, and the ComponentIds of the things it depends on. data ConfiguredComponent ConfiguredComponent :: AnnotatedId ComponentId -> Component -> Bool -> [AnnotatedId ComponentId] -> [ComponentInclude ComponentId IncludeRenaming] -> ConfiguredComponent -- | Unique identifier of component, plus extra useful info. [cc_ann_id] :: ConfiguredComponent -> AnnotatedId ComponentId -- | The fragment of syntax from the Cabal file describing this component. [cc_component] :: ConfiguredComponent -> Component -- | Is this the public library component of the package? (If we invoke -- Setup with an instantiation, this is the component the instantiation -- applies to.) Note that in one-component configure mode, this is always -- True, because any component is the "public" one.) [cc_public] :: ConfiguredComponent -> Bool -- | Dependencies on executables from build-tools and -- build-tool-depends. [cc_exe_deps] :: ConfiguredComponent -> [AnnotatedId ComponentId] -- | The mixins of this package, including both explicit (from the -- mixins field) and implicit (from build-depends). Not -- mix-in linked yet; component configuration only looks at -- ComponentIds. [cc_includes] :: ConfiguredComponent -> [ComponentInclude ComponentId IncludeRenaming] -- | The ComponentName of a component; this uniquely identifies a -- fragment of syntax within a specified Cabal file describing the -- component. cc_name :: ConfiguredComponent -> ComponentName -- | Uniquely identifies a configured component. cc_cid :: ConfiguredComponent -> ComponentId -- | The package this component came from. cc_pkgid :: ConfiguredComponent -> PackageId toConfiguredComponent :: PackageDescription -> ComponentId -> ConfiguredComponentMap -> Component -> LogProgress ConfiguredComponent toConfiguredComponents :: Bool -> FlagAssignment -> Bool -> Flag String -> Flag ComponentId -> PackageDescription -> ConfiguredComponentMap -> [Component] -> LogProgress [ConfiguredComponent] -- | Pretty-print a ConfiguredComponent. dispConfiguredComponent :: ConfiguredComponent -> Doc type ConfiguredComponentMap = Map PackageName (Map ComponentName (AnnotatedId ComponentId)) extendConfiguredComponentMap :: ConfiguredComponent -> ConfiguredComponentMap -> ConfiguredComponentMap newPackageDepsBehaviour :: PackageDescription -> Bool -- | See -- https://github.com/ezyang/ghc-proposals/blob/backpack/proposals/0000-backpack.rst module Distribution.Backpack.LinkedComponent -- | A linked component is a component that has been mix-in linked, at -- which point we have determined how all the dependencies of the -- component are explicitly instantiated (in the form of an OpenUnitId). -- ConfiguredComponent is mix-in linked into -- LinkedComponent, which is then instantiated into -- ReadyComponent. data LinkedComponent LinkedComponent :: AnnotatedId ComponentId -> Component -> [AnnotatedId OpenUnitId] -> Bool -> [ComponentInclude OpenUnitId ModuleRenaming] -> [ComponentInclude OpenUnitId ModuleRenaming] -> ModuleShape -> LinkedComponent -- | Uniquely identifies linked component [lc_ann_id] :: LinkedComponent -> AnnotatedId ComponentId -- | Corresponds to cc_component. [lc_component] :: LinkedComponent -> Component -- | build-tools and build-tool-depends dependencies. -- Corresponds to cc_exe_deps. [lc_exe_deps] :: LinkedComponent -> [AnnotatedId OpenUnitId] -- | Is this the public library of a package? Corresponds to -- cc_public. [lc_public] :: LinkedComponent -> Bool -- | Corresponds to cc_includes, but (1) this does not contain -- includes of signature packages (packages with no exports), and (2) the -- ModuleRenaming for requirements (stored in -- IncludeRenaming) has been removed, as it is reflected in -- OpenUnitId.) [lc_includes] :: LinkedComponent -> [ComponentInclude OpenUnitId ModuleRenaming] -- | Like lc_includes, but this specifies includes on signature -- packages which have no exports. [lc_sig_includes] :: LinkedComponent -> [ComponentInclude OpenUnitId ModuleRenaming] -- | The module shape computed by mix-in linking. This is newly computed -- from ConfiguredComponent [lc_shape] :: LinkedComponent -> ModuleShape -- | The instantiation of lc_uid; this always has the invariant that -- it is a mapping from a module name A to A -- (the hole A). lc_insts :: LinkedComponent -> [(ModuleName, OpenModule)] -- | The OpenUnitId of this component in the "default" -- instantiation. See also lc_insts. LinkedComponents -- cannot be instantiated (e.g., there is no ModSubst instance -- for them). lc_uid :: LinkedComponent -> OpenUnitId -- | Uniquely identifies a LinkedComponent. Corresponds to -- cc_cid. lc_cid :: LinkedComponent -> ComponentId -- | Corresponds to cc_pkgid. lc_pkgid :: LinkedComponent -> PackageId toLinkedComponent :: Verbosity -> FullDb -> PackageId -> LinkedComponentMap -> ConfiguredComponent -> LogProgress LinkedComponent toLinkedComponents :: Verbosity -> FullDb -> PackageId -> LinkedComponentMap -> [ConfiguredComponent] -> LogProgress [LinkedComponent] dispLinkedComponent :: LinkedComponent -> Doc type LinkedComponentMap = Map ComponentId (OpenUnitId, ModuleShape) extendLinkedComponentMap :: LinkedComponent -> LinkedComponentMap -> LinkedComponentMap instance Distribution.Package.Package Distribution.Backpack.LinkedComponent.LinkedComponent -- | Handling for user-specified build targets module Distribution.Simple.BuildTarget -- | Take a list of String build targets, and parse and validate -- them into actual TargetInfos to be -- builtregisteredwhatever. readTargetInfos :: Verbosity -> PackageDescription -> LocalBuildInfo -> [String] -> IO [TargetInfo] -- | Read a list of user-supplied build target strings and resolve them to -- BuildTargets according to a PackageDescription. If there -- are problems with any of the targets e.g. they don't exist or are -- misformatted, throw an IOException. readBuildTargets :: Verbosity -> PackageDescription -> [String] -> IO [BuildTarget] -- | A fully resolved build target. data BuildTarget -- | A specific component BuildTargetComponent :: ComponentName -> BuildTarget -- | A specific module within a specific component. BuildTargetModule :: ComponentName -> ModuleName -> BuildTarget -- | A specific file within a specific component. BuildTargetFile :: ComponentName -> FilePath -> BuildTarget -- | Unambiguously render a BuildTarget, so that it can be parsed in -- all situations. showBuildTarget :: PackageId -> BuildTarget -> String data QualLevel QL1 :: QualLevel QL2 :: QualLevel QL3 :: QualLevel buildTargetComponentName :: BuildTarget -> ComponentName -- | Various ways that a user may specify a build target. data UserBuildTarget readUserBuildTargets :: [String] -> ([UserBuildTargetProblem], [UserBuildTarget]) showUserBuildTarget :: UserBuildTarget -> String data UserBuildTargetProblem UserBuildTargetUnrecognised :: String -> UserBuildTargetProblem reportUserBuildTargetProblems :: Verbosity -> [UserBuildTargetProblem] -> IO () -- | Given a bunch of user-specified targets, try to resolve what it is -- they refer to. resolveBuildTargets :: PackageDescription -> [(UserBuildTarget, Bool)] -> ([BuildTargetProblem], [BuildTarget]) data BuildTargetProblem -- |
-- -- a comment --GhcEnvFileComment :: String -> GhcEnvironmentFileEntry -- |
-- package-id foo-1.0-4fe301a... --GhcEnvFilePackageId :: UnitId -> GhcEnvironmentFileEntry -- | global-package-db, user-package-db or package-db -- blahpackage.conf.d GhcEnvFilePackageDb :: PackageDB -> GhcEnvironmentFileEntry -- |
-- clear-package-db --GhcEnvFileClearPackageDbStack :: GhcEnvironmentFileEntry -- | Make entries for a GHC environment file based on a -- PackageDBStack and a bunch of package (unit) ids. -- -- If you need to do anything more complicated then either use this as a -- basis and add more entries, or just make all the entries directly. simpleGhcEnvironmentFile :: PackageDBStack -> [UnitId] -> [GhcEnvironmentFileEntry] -- | Write a .ghc.environment-$arch-$os-$ver file in the given -- directory. -- -- The Platform and GHC Version are needed as part of the -- file name. writeGhcEnvironmentFile :: FilePath -> Platform -> Version -> [GhcEnvironmentFileEntry] -> NoCallStackIO () getImplInfo :: Compiler -> GhcImplInfo -- | Information about features and quirks of a GHC-based implementation. -- -- Compiler flavors based on GHC behave similarly enough that some of the -- support code for them is shared. Every implementation has its own -- peculiarities, that may or may not be a direct result of the -- underlying GHC version. This record keeps track of these differences. -- -- All shared code (i.e. everything not in the Distribution.Simple.FLAVOR -- module) should use implementation info rather than version numbers to -- test for supported features. data GhcImplInfo GhcImplInfo :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> GhcImplInfo -- |
-- since 1.26.0.0 --writePackageDescription :: FilePath -> PackageDescription -> NoCallStackIO () -- |
-- since 1.26.0.0 --showPackageDescription :: PackageDescription -> String -- |
-- since 1.26.0.0 --writeHookedBuildInfo :: FilePath -> HookedBuildInfo -> NoCallStackIO () -- |
-- since 1.26.0.0 --showHookedBuildInfo :: HookedBuildInfo -> String -- | This has code for checking for various problems in packages. There is -- one set of checks that just looks at a PackageDescription in -- isolation and another set of checks that also looks at files in the -- package. Some of the checks are basic sanity checks, others are -- portability standards that we'd like to encourage. There is a -- PackageCheck type that distinguishes the different kinds of -- check so we can see which ones are appropriate to report in different -- situations. This code gets uses when configuring a package when we -- consider only basic problems. The higher standard is uses when when -- preparing a source tarball and by Hackage when uploading new packages. -- The reason for this is that we want to hold packages that are expected -- to be distributed to a higher standard than packages that are only -- ever expected to be used on the author's own environment. module Distribution.PackageDescription.Check -- | Results of some kind of failed package check. -- -- There are a range of severities, from merely dubious to totally -- insane. All of them come with a human readable explanation. In future -- we may augment them with more machine readable explanations, for -- example to help an IDE suggest automatic corrections. data PackageCheck -- | This package description is no good. There's no way it's going to -- build sensibly. This should give an error at configure time. PackageBuildImpossible :: String -> PackageCheck [explanation] :: PackageCheck -> String -- | A problem that is likely to affect building the package, or an issue -- that we'd like every package author to be aware of, even if the -- package is never distributed. PackageBuildWarning :: String -> PackageCheck [explanation] :: PackageCheck -> String -- | An issue that might not be a problem for the package author but might -- be annoying or detrimental when the package is distributed to users. -- We should encourage distributed packages to be free from these issues, -- but occasionally there are justifiable reasons so we cannot ban them -- entirely. PackageDistSuspicious :: String -> PackageCheck [explanation] :: PackageCheck -> String -- | Like PackageDistSuspicious but will only display warnings rather than -- causing abnormal exit when you run 'cabal check'. PackageDistSuspiciousWarn :: String -> PackageCheck [explanation] :: PackageCheck -> String -- | An issue that is OK in the author's environment but is almost certain -- to be a portability problem for other environments. We can quite -- legitimately refuse to publicly distribute packages with these -- problems. PackageDistInexcusable :: String -> PackageCheck [explanation] :: PackageCheck -> String -- | Check for common mistakes and problems in package descriptions. -- -- This is the standard collection of checks covering all aspects except -- for checks that require looking at files within the package. For those -- see checkPackageFiles. -- -- It requires the GenericPackageDescription and optionally a -- particular configuration of that package. If you pass Nothing -- then we just check a version of the generic description using -- flattenPackageDescription. checkPackage :: GenericPackageDescription -> Maybe PackageDescription -> [PackageCheck] checkConfiguredPackage :: PackageDescription -> [PackageCheck] -- | Sanity check things that requires IO. It looks at the files in the -- package and expects to find the package unpacked in at the given file -- path. checkPackageFiles :: PackageDescription -> FilePath -> NoCallStackIO [PackageCheck] -- | Sanity check things that requires looking at files in the package. -- This is a generalised version of checkPackageFiles that can -- work in any monad for which you can provide -- CheckPackageContentOps operations. -- -- The point of this extra generality is to allow doing checks in some -- virtual file system, for example a tarball in memory. checkPackageContent :: Monad m => CheckPackageContentOps m -> PackageDescription -> m [PackageCheck] -- | A record of operations needed to check the contents of packages. Used -- by checkPackageContent. data CheckPackageContentOps m CheckPackageContentOps :: (FilePath -> m Bool) -> (FilePath -> m Bool) -> (FilePath -> m [FilePath]) -> (FilePath -> m String) -> CheckPackageContentOps m [doesFileExist] :: CheckPackageContentOps m -> FilePath -> m Bool [doesDirectoryExist] :: CheckPackageContentOps m -> FilePath -> m Bool [getDirectoryContents] :: CheckPackageContentOps m -> FilePath -> m [FilePath] [getFileContents] :: CheckPackageContentOps m -> FilePath -> m String -- | Check the names of all files in a package for portability problems. -- This should be done for example when creating or validating a package -- tarball. checkPackageFileNames :: [FilePath] -> [PackageCheck] instance GHC.Classes.Eq Distribution.PackageDescription.Check.PackageCheck instance GHC.Show.Show Distribution.PackageDescription.Check.PackageCheck -- | This is an alternative build system that delegates everything to the -- make program. All the commands just end up calling -- make with appropriate arguments. The intention was to allow -- preexisting packages that used makefiles to be wrapped into Cabal -- packages. In practice essentially all such packages were converted -- over to the "Simple" build system instead. Consequently this module is -- not used much and it certainly only sees cursory maintenance and no -- testing. Perhaps at some point we should stop pretending that it -- works. -- -- Uses the parsed command-line from Distribution.Simple.Setup in -- order to build Haskell tools using a back-end build system based on -- make. Obviously we assume that there is a configure script, and that -- after the ConfigCmd has been run, there is a Makefile. Further -- assumptions: -- --
-- ppTestHandler :: PreProcessor -- ppTestHandler = -- PreProcessor { -- platformIndependent = True, -- runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity -> -- do info verbosity (inFile++" has been preprocessed to "++outFile) -- stuff <- readFile inFile -- writeFile outFile ("-- preprocessed as a test\n\n" ++ stuff) -- return ExitSuccess ---- -- We split the input and output file names into a base directory and the -- rest of the file name. The input base dir is the path in the list of -- search dirs that this file was found in. The output base dir is the -- build dir where all the generated source files are put. -- -- The reason for splitting it up this way is that some pre-processors -- don't simply generate one output .hs file from one input file but have -- dependencies on other generated files (notably c2hs, where building -- one .hs file may require reading other .chi files, and then compiling -- the .hs file may require reading a generated .h file). In these cases -- the generated files need to embed relative path names to each other -- (eg the generated .hs file mentions the .h file in the FFI imports). -- This path must be relative to the base directory where the generated -- files are located, it cannot be relative to the top level of the build -- tree because the compilers do not look for .h files relative to there, -- ie we do not use "-I .", instead we use "-I dist/build" (or whatever -- dist dir has been set by the user) -- -- Most pre-processors do not care of course, so mkSimplePreProcessor and -- runSimplePreProcessor functions handle the simple case. data PreProcessor PreProcessor :: Bool -> ((FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO ()) -> PreProcessor [platformIndependent] :: PreProcessor -> Bool [runPreProcessor] :: PreProcessor -> (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO () mkSimplePreProcessor :: (FilePath -> FilePath -> Verbosity -> IO ()) -> (FilePath, FilePath) -> (FilePath, FilePath) -> Verbosity -> IO () runSimplePreProcessor :: PreProcessor -> FilePath -> FilePath -> Verbosity -> IO () ppCpp :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppCpp' :: [String] -> BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppGreenCard :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppC2hs :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppHsc2hs :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppHappy :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppAlex :: BuildInfo -> LocalBuildInfo -> ComponentLocalBuildInfo -> PreProcessor ppUnlit :: PreProcessor platformDefines :: LocalBuildInfo -> [String] -- | This defines the API that Setup.hs scripts can use to -- customise the way the build works. This module just defines the -- UserHooks type. The predefined sets of hooks that implement the -- Simple, Make and Configure build systems -- are defined in Distribution.Simple. The UserHooks is a -- big record of functions. There are 3 for each action, a pre, post and -- the action itself. There are few other miscellaneous hooks, ones to -- extend the set of programs and preprocessors and one to override the -- function used to read the .cabal file. -- -- This hooks type is widely agreed to not be the right solution. Partly -- this is because changes to it usually break custom Setup.hs -- files and yet many internal code changes do require changes to the -- hooks. For example we cannot pass any extra parameters to most of the -- functions that implement the various phases because it would involve -- changing the types of the corresponding hook. At some point it will -- have to be replaced. module Distribution.Simple.UserHooks -- | Hooks allow authors to add specific functionality before and after a -- command is run, and also to specify additional preprocessors. -- --
-- ccflags <- getDbProgramOutput verbosity prog progdb ["--cflags"] -- ldflags <- getDbProgramOutput verbosity prog progdb ["--libs"] -- return (ccldOptionsBuildInfo (words ccflags) (words ldflags)) --ccLdOptionsBuildInfo :: [String] -> [String] -> BuildInfo checkForeignDeps :: PackageDescription -> LocalBuildInfo -> Verbosity -> IO () -- | The user interface specifies the package dbs to use with a combination -- of --global, --user and -- --package-db=global|user|clear|$file. This function combines -- the global/user flag and interprets the package-db flag into a single -- package db stack. interpretPackageDbFlags :: Bool -> [Maybe PackageDB] -> PackageDBStack -- | The errors that can be thrown when reading the setup-config -- file. data ConfigStateFileError -- | No header found. ConfigStateFileNoHeader :: ConfigStateFileError -- | Incorrect header. ConfigStateFileBadHeader :: ConfigStateFileError -- | Cannot parse file contents. ConfigStateFileNoParse :: ConfigStateFileError -- | No file! ConfigStateFileMissing :: ConfigStateFileError -- | Mismatched version. ConfigStateFileBadVersion :: PackageIdentifier -> PackageIdentifier -> (Either ConfigStateFileError LocalBuildInfo) -> ConfigStateFileError -- | Read the localBuildInfoFile, returning either an error or the -- local build info. tryGetConfigStateFile :: FilePath -> IO (Either ConfigStateFileError LocalBuildInfo) platformDefines :: LocalBuildInfo -> [String] -- | Relax the dependencies of this package if needed. relaxPackageDeps :: (VersionRange -> VersionRange) -> RelaxDeps -> GenericPackageDescription -> GenericPackageDescription instance GHC.Show.Show Distribution.Simple.Configure.ConfigStateFileError instance GHC.Exception.Exception Distribution.Simple.Configure.ConfigStateFileError -- | This is the entry point to actually building the modules in a package. -- It doesn't actually do much itself, most of the work is delegated to -- compiler-specific actions. It does do some non-compiler specific bits -- like running pre-processors. module Distribution.Simple.Build -- | Build the libraries and executables in this package. build :: PackageDescription -> LocalBuildInfo -> BuildFlags -> [PPSuffixHandler] -> IO () repl :: PackageDescription -> LocalBuildInfo -> ReplFlags -> [PPSuffixHandler] -> [String] -> IO () -- | Start an interpreter without loading any package files. startInterpreter :: Verbosity -> ProgramDb -> Compiler -> Platform -> PackageDBStack -> IO () -- | Runs componentInitialBuildSteps on every configured component. initialBuildSteps :: FilePath -> PackageDescription -> LocalBuildInfo -> Verbosity -> IO () -- | Creates the autogenerated files for a particular configured component. componentInitialBuildSteps :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> Verbosity -> IO () -- | Generate and write out the Paths_pkg.hs and cabal_macros.h -- files writeAutogenFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> IO () -- | This module deals with the haddock and hscolour -- commands. It uses information about installed packages (from -- ghc-pkg) to find the locations of documentation for dependent -- packages, so it can create links. -- -- The hscolour support allows generating HTML versions of the -- original source, with coloured syntax highlighting. module Distribution.Simple.Haddock haddock :: PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> HaddockFlags -> IO () hscolour :: PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> HscolourFlags -> IO () -- | Given a list of InstalledPackageInfos, return a list of -- interfaces and HTML paths, and an optional warning for packages with -- missing documentation. haddockPackagePaths :: [InstalledPackageInfo] -> Maybe (InstalledPackageInfo -> FilePath) -> NoCallStackIO ([(FilePath, Maybe FilePath)], Maybe String) instance GHC.Generics.Generic Distribution.Simple.Haddock.HaddockArgs instance GHC.Classes.Ord Distribution.Simple.Haddock.Directory instance GHC.Classes.Eq Distribution.Simple.Haddock.Directory instance GHC.Show.Show Distribution.Simple.Haddock.Directory instance GHC.Read.Read Distribution.Simple.Haddock.Directory instance GHC.Base.Monoid Distribution.Simple.Haddock.HaddockArgs instance Data.Semigroup.Semigroup Distribution.Simple.Haddock.HaddockArgs instance GHC.Base.Monoid Distribution.Simple.Haddock.Directory instance Data.Semigroup.Semigroup Distribution.Simple.Haddock.Directory -- | This module deals with the doctest command. module Distribution.Simple.Doctest doctest :: PackageDescription -> LocalBuildInfo -> [PPSuffixHandler] -> DoctestFlags -> IO () instance GHC.Generics.Generic Distribution.Simple.Doctest.DoctestArgs instance GHC.Show.Show Distribution.Simple.Doctest.DoctestArgs instance GHC.Base.Monoid Distribution.Simple.Doctest.DoctestArgs instance Data.Semigroup.Semigroup Distribution.Simple.Doctest.DoctestArgs -- | This is the command line front end to the Simple build system. When -- given the parsed command-line args and package information, is able to -- perform basic commands like configure, build, install, register, etc. -- -- This module exports the main functions that Setup.hs scripts use. It -- re-exports the UserHooks type, the standard entry points like -- defaultMain and defaultMainWithHooks and the predefined -- sets of UserHooks that custom Setup.hs scripts can -- extend to add their own behaviour. -- -- This module isn't called "Simple" because it's simple. Far from it. -- It's called "Simple" because it does complicated things to simple -- software. -- -- The original idea was that there could be different build systems that -- all presented the same compatible command line interfaces. There is -- still a Distribution.Make system but in practice no packages -- use it. module Distribution.Simple -- | A simple implementation of main for a Cabal setup script. It -- reads the package description file using IO, and performs the action -- specified on the command line. defaultMain :: IO () -- | Like defaultMain, but accepts the package description as input -- rather than using IO to read it. defaultMainNoRead :: GenericPackageDescription -> IO () -- | A version of defaultMain that is passed the command line -- arguments, rather than getting them from the environment. defaultMainArgs :: [String] -> IO () -- | Hooks allow authors to add specific functionality before and after a -- command is run, and also to specify additional preprocessors. -- --