module Distribution.Client.BuildReports.Lens
  ( BuildReport
  , module Distribution.Client.BuildReports.Lens
  ) where

import Distribution.Client.Compat.Prelude
import Distribution.Compat.Lens
import Prelude ()

import Distribution.Client.BuildReports.Types (BuildReport, InstallOutcome, Outcome)
import Distribution.Compiler (CompilerId)
import Distribution.System (Arch, OS)
import Distribution.Types.Flag (FlagAssignment)
import Distribution.Types.PackageId (PackageIdentifier)

import qualified Distribution.Client.BuildReports.Types as T

package :: Lens' BuildReport PackageIdentifier
package :: Lens' BuildReport PackageIdentifier
package PackageIdentifier -> f PackageIdentifier
f BuildReport
s = (PackageIdentifier -> BuildReport)
-> f PackageIdentifier -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\PackageIdentifier
x -> BuildReport
s{T.package = x}) (PackageIdentifier -> f PackageIdentifier
f (BuildReport -> PackageIdentifier
T.package BuildReport
s))

os :: Lens' BuildReport OS
os :: Lens' BuildReport OS
os OS -> f OS
f BuildReport
s = (OS -> BuildReport) -> f OS -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\OS
x -> BuildReport
s{T.os = x}) (OS -> f OS
f (BuildReport -> OS
T.os BuildReport
s))

arch :: Lens' BuildReport Arch
arch :: Lens' BuildReport Arch
arch Arch -> f Arch
f BuildReport
s = (Arch -> BuildReport) -> f Arch -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Arch
x -> BuildReport
s{T.arch = x}) (Arch -> f Arch
f (BuildReport -> Arch
T.arch BuildReport
s))

compiler :: Lens' BuildReport CompilerId
compiler :: Lens' BuildReport CompilerId
compiler CompilerId -> f CompilerId
f BuildReport
s = (CompilerId -> BuildReport) -> f CompilerId -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\CompilerId
x -> BuildReport
s{T.compiler = x}) (CompilerId -> f CompilerId
f (BuildReport -> CompilerId
T.compiler BuildReport
s))

client :: Lens' BuildReport PackageIdentifier
client :: Lens' BuildReport PackageIdentifier
client PackageIdentifier -> f PackageIdentifier
f BuildReport
s = (PackageIdentifier -> BuildReport)
-> f PackageIdentifier -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\PackageIdentifier
x -> BuildReport
s{T.client = x}) (PackageIdentifier -> f PackageIdentifier
f (BuildReport -> PackageIdentifier
T.client BuildReport
s))

flagAssignment :: Lens' BuildReport FlagAssignment
flagAssignment :: Lens' BuildReport FlagAssignment
flagAssignment FlagAssignment -> f FlagAssignment
f BuildReport
s = (FlagAssignment -> BuildReport)
-> f FlagAssignment -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\FlagAssignment
x -> BuildReport
s{T.flagAssignment = x}) (FlagAssignment -> f FlagAssignment
f (BuildReport -> FlagAssignment
T.flagAssignment BuildReport
s))

dependencies :: Lens' BuildReport [PackageIdentifier]
dependencies :: Lens' BuildReport [PackageIdentifier]
dependencies [PackageIdentifier] -> f [PackageIdentifier]
f BuildReport
s = ([PackageIdentifier] -> BuildReport)
-> f [PackageIdentifier] -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[PackageIdentifier]
x -> BuildReport
s{T.dependencies = x}) ([PackageIdentifier] -> f [PackageIdentifier]
f (BuildReport -> [PackageIdentifier]
T.dependencies BuildReport
s))

installOutcome :: Lens' BuildReport InstallOutcome
installOutcome :: Lens' BuildReport InstallOutcome
installOutcome InstallOutcome -> f InstallOutcome
f BuildReport
s = (InstallOutcome -> BuildReport)
-> f InstallOutcome -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\InstallOutcome
x -> BuildReport
s{T.installOutcome = x}) (InstallOutcome -> f InstallOutcome
f (BuildReport -> InstallOutcome
T.installOutcome BuildReport
s))

docsOutcome :: Lens' BuildReport Outcome
docsOutcome :: Lens' BuildReport Outcome
docsOutcome Outcome -> f Outcome
f BuildReport
s = (Outcome -> BuildReport) -> f Outcome -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Outcome
x -> BuildReport
s{T.docsOutcome = x}) (Outcome -> f Outcome
f (BuildReport -> Outcome
T.docsOutcome BuildReport
s))

testsOutcome :: Lens' BuildReport Outcome
testsOutcome :: Lens' BuildReport Outcome
testsOutcome Outcome -> f Outcome
f BuildReport
s = (Outcome -> BuildReport) -> f Outcome -> f BuildReport
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Outcome
x -> BuildReport
s{T.testsOutcome = x}) (Outcome -> f Outcome
f (BuildReport -> Outcome
T.testsOutcome BuildReport
s))