exitcode-0.3.0.0: src/Control/Process/GroupID.hs
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wall #-}
module Control.Process.GroupID
( GroupID,
GetGroupID (..),
HasGroupID (..),
ReviewGroupID (..),
AsGroupID (..),
)
where
import Control.Category (id)
import Control.Lens (Getter, Lens', Prism', Review, unto)
import System.Process.Internals (GroupID)
-- $setup
-- >>> import Prelude
-- >>> import Control.Lens
-- | Type class for values that can be viewed as a @GroupID@.
--
-- >>> view getGroupID (42 :: GroupID)
-- 42
class GetGroupID a where
getGroupID ::
Getter a GroupID
-- |
--
-- >>> view getGroupID (42 :: GroupID)
-- 42
instance GetGroupID GroupID where
getGroupID = id
{-# INLINE getGroupID #-}
-- | Type class for values with a lens into a @GroupID@.
--
-- >>> view groupID (42 :: GroupID)
-- 42
class (GetGroupID a) => HasGroupID a where
groupID ::
Lens' a GroupID
-- |
--
-- >>> view groupID (42 :: GroupID)
-- 42
-- >>> set groupID 99 (42 :: GroupID)
-- 99
instance HasGroupID GroupID where
groupID =
id
-- | Type class for values that can be constructed from a @GroupID@.
--
-- >>> review reviewGroupID (42 :: GroupID) :: GroupID
-- 42
class ReviewGroupID a where
reviewGroupID ::
Review a GroupID
-- |
--
-- >>> review reviewGroupID (42 :: GroupID) :: GroupID
-- 42
instance ReviewGroupID GroupID where
reviewGroupID = unto id
{-# INLINE reviewGroupID #-}
-- | Type class for values with a prism into a @GroupID@.
--
-- >>> preview _GroupID (42 :: GroupID)
-- Just 42
class (ReviewGroupID a) => AsGroupID a where
_GroupID ::
Prism' a GroupID
-- |
--
-- >>> preview _GroupID (42 :: GroupID)
-- Just 42
-- >>> review _GroupID 42 :: GroupID
-- 42
instance AsGroupID GroupID where
_GroupID =
id