{-# LANGUAGE Rank2Types #-}
module Distribution.Types.GenericPackageDescription.Lens (
GenericPackageDescription,
PackageFlag,
FlagName,
ConfVar (..),
module Distribution.Types.GenericPackageDescription.Lens,
) where
import Prelude()
import Distribution.Compat.Prelude
import Distribution.Compat.Lens
import qualified Distribution.Types.GenericPackageDescription as T
import Distribution.Types.CondTree (CondTree)
import Distribution.Types.Dependency (Dependency)
import Distribution.Types.Executable (Executable)
import Distribution.Types.PackageDescription (PackageDescription)
import Distribution.Types.Benchmark (Benchmark)
import Distribution.Types.ForeignLib (ForeignLib)
import Distribution.Types.GenericPackageDescription (GenericPackageDescription(GenericPackageDescription) )
import Distribution.Types.Flag (PackageFlag(MkPackageFlag), FlagName)
import Distribution.Types.ConfVar (ConfVar (..))
import Distribution.Types.Library (Library)
import Distribution.Types.TestSuite (TestSuite)
import Distribution.Types.UnqualComponentName (UnqualComponentName)
import Distribution.System (Arch, OS)
import Distribution.Compiler (CompilerFlavor)
import Distribution.Version (Version, VersionRange)
packageDescription :: Lens' GenericPackageDescription PackageDescription
packageDescription :: Lens' GenericPackageDescription PackageDescription
packageDescription PackageDescription -> f PackageDescription
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\PackageDescription
x -> GenericPackageDescription
s { packageDescription :: PackageDescription
T.packageDescription = PackageDescription
x }) (PackageDescription -> f PackageDescription
f (GenericPackageDescription -> PackageDescription
T.packageDescription GenericPackageDescription
s))
{-# INLINE packageDescription #-}
gpdScannedVersion :: Lens' GenericPackageDescription (Maybe Version)
gpdScannedVersion :: Lens' GenericPackageDescription (Maybe Version)
gpdScannedVersion Maybe Version -> f (Maybe Version)
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Maybe Version
x -> GenericPackageDescription
s { gpdScannedVersion :: Maybe Version
T.gpdScannedVersion = Maybe Version
x }) (Maybe Version -> f (Maybe Version)
f (GenericPackageDescription -> Maybe Version
T.gpdScannedVersion GenericPackageDescription
s))
{-# INLINE gpdScannedVersion #-}
genPackageFlags :: Lens' GenericPackageDescription [PackageFlag]
genPackageFlags :: Lens' GenericPackageDescription [PackageFlag]
genPackageFlags [PackageFlag] -> f [PackageFlag]
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[PackageFlag]
x -> GenericPackageDescription
s { genPackageFlags :: [PackageFlag]
T.genPackageFlags = [PackageFlag]
x }) ([PackageFlag] -> f [PackageFlag]
f (GenericPackageDescription -> [PackageFlag]
T.genPackageFlags GenericPackageDescription
s))
{-# INLINE genPackageFlags #-}
condLibrary :: Lens' GenericPackageDescription (Maybe (CondTree ConfVar [Dependency] Library))
condLibrary :: Lens'
GenericPackageDescription
(Maybe (CondTree ConfVar [Dependency] Library))
condLibrary Maybe (CondTree ConfVar [Dependency] Library)
-> f (Maybe (CondTree ConfVar [Dependency] Library))
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Maybe (CondTree ConfVar [Dependency] Library)
x -> GenericPackageDescription
s { condLibrary :: Maybe (CondTree ConfVar [Dependency] Library)
T.condLibrary = Maybe (CondTree ConfVar [Dependency] Library)
x }) (Maybe (CondTree ConfVar [Dependency] Library)
-> f (Maybe (CondTree ConfVar [Dependency] Library))
f (GenericPackageDescription
-> Maybe (CondTree ConfVar [Dependency] Library)
T.condLibrary GenericPackageDescription
s))
{-# INLINE condLibrary #-}
condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName,(CondTree ConfVar [Dependency] Library))]
condSubLibraries :: Lens'
GenericPackageDescription
[(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
condSubLibraries [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
-> f [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
x -> GenericPackageDescription
s { condSubLibraries :: [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
T.condSubLibraries = [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
x }) ([(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
-> f [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
f (GenericPackageDescription
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
T.condSubLibraries GenericPackageDescription
s))
{-# INLINE condSubLibraries #-}
condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName,(CondTree ConfVar [Dependency] ForeignLib))]
condForeignLibs :: Lens'
GenericPackageDescription
[(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
condForeignLibs [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
x -> GenericPackageDescription
s { condForeignLibs :: [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
T.condForeignLibs = [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
x }) ([(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
f (GenericPackageDescription
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
T.condForeignLibs GenericPackageDescription
s))
{-# INLINE condForeignLibs #-}
condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName,(CondTree ConfVar [Dependency] Executable))]
condExecutables :: Lens'
GenericPackageDescription
[(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
condExecutables [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
x -> GenericPackageDescription
s { condExecutables :: [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
T.condExecutables = [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
x }) ([(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
f (GenericPackageDescription
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
T.condExecutables GenericPackageDescription
s))
{-# INLINE condExecutables #-}
condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName,(CondTree ConfVar [Dependency] TestSuite))]
condTestSuites :: Lens'
GenericPackageDescription
[(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
condTestSuites [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] TestSuite)]
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
x -> GenericPackageDescription
s { condTestSuites :: [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
T.condTestSuites = [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
x }) ([(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] TestSuite)]
f (GenericPackageDescription
-> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
T.condTestSuites GenericPackageDescription
s))
{-# INLINE condTestSuites #-}
condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName,(CondTree ConfVar [Dependency] Benchmark))]
condBenchmarks :: Lens'
GenericPackageDescription
[(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
condBenchmarks [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] Benchmark)]
f GenericPackageDescription
s = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
x -> GenericPackageDescription
s { condBenchmarks :: [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
T.condBenchmarks = [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
x }) ([(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> f [(UnqualComponentName,
CondTree ConfVar [Dependency] Benchmark)]
f (GenericPackageDescription
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
T.condBenchmarks GenericPackageDescription
s))
{-# INLINE condBenchmarks #-}
allCondTrees
:: Applicative f
=> (forall a. CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a))
-> GenericPackageDescription
-> f GenericPackageDescription
allCondTrees :: forall (f :: * -> *).
Applicative f =>
(forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a))
-> GenericPackageDescription -> f GenericPackageDescription
allCondTrees forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f (GenericPackageDescription PackageDescription
p Maybe Version
v [PackageFlag]
a1 Maybe (CondTree ConfVar [Dependency] Library)
x1 [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
x2 [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
x3 [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
x4 [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
x5 [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
x6) =
PackageDescription
-> Maybe Version
-> [PackageFlag]
-> Maybe (CondTree ConfVar [Dependency] Library)
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] ForeignLib)]
-> [(UnqualComponentName,
CondTree ConfVar [Dependency] Executable)]
-> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
-> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
-> GenericPackageDescription
GenericPackageDescription
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (f :: * -> *) a. Applicative f => a -> f a
pure PackageDescription
p
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Version
v
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (f :: * -> *) a. Applicative f => a -> f a
pure [PackageFlag]
a1
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f Maybe (CondTree ConfVar [Dependency] Library)
x1
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a b. Lens (c, a) (c, b) a b
_2) forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f [(UnqualComponentName, CondTree ConfVar [Dependency] Library)]
x2
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a b. Lens (c, a) (c, b) a b
_2) forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f [(UnqualComponentName, CondTree ConfVar [Dependency] ForeignLib)]
x3
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a b. Lens (c, a) (c, b) a b
_2) forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f [(UnqualComponentName, CondTree ConfVar [Dependency] Executable)]
x4
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a b. Lens (c, a) (c, b) a b
_2) forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)]
x5
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall c a b. Lens (c, a) (c, b) a b
_2) forall a.
CondTree ConfVar [Dependency] a
-> f (CondTree ConfVar [Dependency] a)
f [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)]
x6
flagName :: Lens' PackageFlag FlagName
flagName :: Lens' PackageFlag FlagName
flagName FlagName -> f FlagName
f (MkPackageFlag FlagName
x1 String
x2 Bool
x3 Bool
x4) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\FlagName
y1 -> FlagName -> String -> Bool -> Bool -> PackageFlag
MkPackageFlag FlagName
y1 String
x2 Bool
x3 Bool
x4) (FlagName -> f FlagName
f FlagName
x1)
{-# INLINE flagName #-}
flagDescription :: Lens' PackageFlag String
flagDescription :: Lens' PackageFlag String
flagDescription String -> f String
f (MkPackageFlag FlagName
x1 String
x2 Bool
x3 Bool
x4) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\String
y1 -> FlagName -> String -> Bool -> Bool -> PackageFlag
MkPackageFlag FlagName
x1 String
y1 Bool
x3 Bool
x4) (String -> f String
f String
x2)
{-# INLINE flagDescription #-}
flagDefault :: Lens' PackageFlag Bool
flagDefault :: Lens' PackageFlag Bool
flagDefault Bool -> f Bool
f (MkPackageFlag FlagName
x1 String
x2 Bool
x3 Bool
x4) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Bool
y1 -> FlagName -> String -> Bool -> Bool -> PackageFlag
MkPackageFlag FlagName
x1 String
x2 Bool
y1 Bool
x4) (Bool -> f Bool
f Bool
x3)
{-# INLINE flagDefault #-}
flagManual :: Lens' PackageFlag Bool
flagManual :: Lens' PackageFlag Bool
flagManual Bool -> f Bool
f (MkPackageFlag FlagName
x1 String
x2 Bool
x3 Bool
x4) = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Bool
y1 -> FlagName -> String -> Bool -> Bool -> PackageFlag
MkPackageFlag FlagName
x1 String
x2 Bool
x3 Bool
y1) (Bool -> f Bool
f Bool
x4)
{-# INLINE flagManual #-}
_OS :: Traversal' ConfVar OS
_OS :: Traversal' ConfVar OS
_OS OS -> f OS
f (OS OS
os) = OS -> ConfVar
OS forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> OS -> f OS
f OS
os
_OS OS -> f OS
_ ConfVar
x = forall (f :: * -> *) a. Applicative f => a -> f a
pure ConfVar
x
_Arch :: Traversal' ConfVar Arch
_Arch :: Traversal' ConfVar Arch
_Arch Arch -> f Arch
f (Arch Arch
arch) = Arch -> ConfVar
Arch forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Arch -> f Arch
f Arch
arch
_Arch Arch -> f Arch
_ ConfVar
x = forall (f :: * -> *) a. Applicative f => a -> f a
pure ConfVar
x
_PackageFlag :: Traversal' ConfVar FlagName
_PackageFlag :: Traversal' ConfVar FlagName
_PackageFlag FlagName -> f FlagName
f (PackageFlag FlagName
flag) = FlagName -> ConfVar
PackageFlag forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> FlagName -> f FlagName
f FlagName
flag
_PackageFlag FlagName -> f FlagName
_ ConfVar
x = forall (f :: * -> *) a. Applicative f => a -> f a
pure ConfVar
x
_Impl :: Traversal' ConfVar (CompilerFlavor, VersionRange)
_Impl :: Traversal' ConfVar (CompilerFlavor, VersionRange)
_Impl (CompilerFlavor, VersionRange) -> f (CompilerFlavor, VersionRange)
f (Impl CompilerFlavor
cf VersionRange
vr) = forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry CompilerFlavor -> VersionRange -> ConfVar
Impl forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (CompilerFlavor, VersionRange) -> f (CompilerFlavor, VersionRange)
f (CompilerFlavor
cf, VersionRange
vr)
_Impl (CompilerFlavor, VersionRange) -> f (CompilerFlavor, VersionRange)
_ ConfVar
x = forall (f :: * -> *) a. Applicative f => a -> f a
pure ConfVar
x