{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeSynonymInstances #-}

module Control.Process.Pid(
  HasPid(..)
, AsPid(..)
) where

import Control.Category((.), id)
import Control.Lens ( iso, Lens', Prism' )
import Data.Int ( Int32 )
import System.Posix.Types ( CPid(CPid) )
import System.Process ( Pid )

class HasPid a where
  pid ::
    Lens' a Pid
  pidInt32 ::
    Lens' a Int32
  pidInt32 =
    forall a. HasPid a => Lens' a Pid
pid forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
.
      forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso
        (\(CPid Int32
x) -> Int32
x)
        Int32 -> Pid
CPid

instance HasPid Pid where
  pid :: Lens' Pid Pid
pid =
    forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id

class AsPid a where
  _Pid ::
    Prism' a Pid
  _PidInt32 ::
    Prism' a Int32
  _PidInt32 =
    forall a. AsPid a => Prism' a Pid
_Pid forall {k} (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
.
      forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso
        (\(CPid Int32
x) -> Int32
x)
        Int32 -> Pid
CPid

instance AsPid Pid where
  _Pid :: Prism' Pid Pid
_Pid =
    forall {k} (cat :: k -> k -> *) (a :: k). Category cat => cat a a
id