{-# LANGUAGE DataKinds #-}

module Distribution.Types.ForeignLib.Lens
  ( ForeignLib
  , module Distribution.Types.ForeignLib.Lens
  ) where

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

import Distribution.Types.BuildInfo (BuildInfo)
import Distribution.Types.ForeignLib (ForeignLib, LibVersionInfo)
import Distribution.Types.ForeignLibOption (ForeignLibOption)
import Distribution.Types.ForeignLibType (ForeignLibType)
import Distribution.Types.UnqualComponentName (UnqualComponentName)
import Distribution.Utils.Path
import Distribution.Version (Version)

import qualified Distribution.Types.ForeignLib as T

foreignLibName :: Lens' ForeignLib UnqualComponentName
foreignLibName :: Lens' ForeignLib UnqualComponentName
foreignLibName UnqualComponentName -> f UnqualComponentName
f ForeignLib
s = (UnqualComponentName -> ForeignLib)
-> f UnqualComponentName -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\UnqualComponentName
x -> ForeignLib
s{T.foreignLibName = x}) (UnqualComponentName -> f UnqualComponentName
f (ForeignLib -> UnqualComponentName
T.foreignLibName ForeignLib
s))
{-# INLINE foreignLibName #-}

foreignLibType :: Lens' ForeignLib ForeignLibType
foreignLibType :: Lens' ForeignLib ForeignLibType
foreignLibType ForeignLibType -> f ForeignLibType
f ForeignLib
s = (ForeignLibType -> ForeignLib) -> f ForeignLibType -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\ForeignLibType
x -> ForeignLib
s{T.foreignLibType = x}) (ForeignLibType -> f ForeignLibType
f (ForeignLib -> ForeignLibType
T.foreignLibType ForeignLib
s))
{-# INLINE foreignLibType #-}

foreignLibOptions :: Lens' ForeignLib [ForeignLibOption]
foreignLibOptions :: Lens' ForeignLib [ForeignLibOption]
foreignLibOptions [ForeignLibOption] -> f [ForeignLibOption]
f ForeignLib
s = ([ForeignLibOption] -> ForeignLib)
-> f [ForeignLibOption] -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[ForeignLibOption]
x -> ForeignLib
s{T.foreignLibOptions = x}) ([ForeignLibOption] -> f [ForeignLibOption]
f (ForeignLib -> [ForeignLibOption]
T.foreignLibOptions ForeignLib
s))
{-# INLINE foreignLibOptions #-}

foreignLibBuildInfo :: Lens' ForeignLib BuildInfo
foreignLibBuildInfo :: Lens' ForeignLib BuildInfo
foreignLibBuildInfo BuildInfo -> f BuildInfo
f ForeignLib
s = (BuildInfo -> ForeignLib) -> f BuildInfo -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\BuildInfo
x -> ForeignLib
s{T.foreignLibBuildInfo = x}) (BuildInfo -> f BuildInfo
f (ForeignLib -> BuildInfo
T.foreignLibBuildInfo ForeignLib
s))
{-# INLINE foreignLibBuildInfo #-}

foreignLibVersionInfo :: Lens' ForeignLib (Maybe LibVersionInfo)
foreignLibVersionInfo :: Lens' ForeignLib (Maybe LibVersionInfo)
foreignLibVersionInfo Maybe LibVersionInfo -> f (Maybe LibVersionInfo)
f ForeignLib
s = (Maybe LibVersionInfo -> ForeignLib)
-> f (Maybe LibVersionInfo) -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Maybe LibVersionInfo
x -> ForeignLib
s{T.foreignLibVersionInfo = x}) (Maybe LibVersionInfo -> f (Maybe LibVersionInfo)
f (ForeignLib -> Maybe LibVersionInfo
T.foreignLibVersionInfo ForeignLib
s))
{-# INLINE foreignLibVersionInfo #-}

foreignLibVersionLinux :: Lens' ForeignLib (Maybe Version)
foreignLibVersionLinux :: Lens' ForeignLib (Maybe Version)
foreignLibVersionLinux Maybe Version -> f (Maybe Version)
f ForeignLib
s = (Maybe Version -> ForeignLib) -> f (Maybe Version) -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\Maybe Version
x -> ForeignLib
s{T.foreignLibVersionLinux = x}) (Maybe Version -> f (Maybe Version)
f (ForeignLib -> Maybe Version
T.foreignLibVersionLinux ForeignLib
s))
{-# INLINE foreignLibVersionLinux #-}

foreignLibModDefFile :: Lens' ForeignLib [RelativePath Source File]
foreignLibModDefFile :: Lens' ForeignLib [RelativePath Source 'File]
foreignLibModDefFile [RelativePath Source 'File] -> f [RelativePath Source 'File]
f ForeignLib
s = ([RelativePath Source 'File] -> ForeignLib)
-> f [RelativePath Source 'File] -> f ForeignLib
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\[RelativePath Source 'File]
x -> ForeignLib
s{T.foreignLibModDefFile = x}) ([RelativePath Source 'File] -> f [RelativePath Source 'File]
f (ForeignLib -> [RelativePath Source 'File]
T.foreignLibModDefFile ForeignLib
s))
{-# INLINE foreignLibModDefFile #-}