module Distribution.Types.PackageId.Lens
  ( PackageIdentifier
  , module Distribution.Types.PackageId.Lens
  ) where

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

import Distribution.Types.PackageId (PackageIdentifier)
import Distribution.Types.PackageName (PackageName)
import Distribution.Version (Version)

import qualified Distribution.Types.PackageId as T

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

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