{-# LANGUAGE CPP #-}
module System.Process.Lens.ProcessHandler
(
ProcessHandler(..)
, _Handler
, hstdin
, hstdout
, hstderr
, hhandle
) where
import Control.Lens
import System.IO
import System.Process
data ProcessHandler =
ProcessHandler
{ ProcessHandler -> Maybe Handle
_hstdin :: Maybe Handle
, ProcessHandler -> Maybe Handle
_hstdout :: Maybe Handle
, ProcessHandler -> Maybe Handle
_hstderr :: Maybe Handle
, ProcessHandler -> ProcessHandle
_hhandle :: ProcessHandle
}
hstdin :: Lens' ProcessHandler (Maybe Handle)
hstdin :: (Maybe Handle -> f (Maybe Handle))
-> ProcessHandler -> f ProcessHandler
hstdin = (ProcessHandler -> Maybe Handle)
-> (ProcessHandler -> Maybe Handle -> ProcessHandler)
-> Lens ProcessHandler ProcessHandler (Maybe Handle) (Maybe Handle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ProcessHandler -> Maybe Handle
_hstdin (\ProcessHandler
t Maybe Handle
b -> ProcessHandler
t { _hstdin :: Maybe Handle
_hstdin = Maybe Handle
b })
hstdout :: Lens' ProcessHandler (Maybe Handle)
hstdout :: (Maybe Handle -> f (Maybe Handle))
-> ProcessHandler -> f ProcessHandler
hstdout = (ProcessHandler -> Maybe Handle)
-> (ProcessHandler -> Maybe Handle -> ProcessHandler)
-> Lens ProcessHandler ProcessHandler (Maybe Handle) (Maybe Handle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ProcessHandler -> Maybe Handle
_hstdout (\ProcessHandler
t Maybe Handle
b -> ProcessHandler
t { _hstdout :: Maybe Handle
_hstdout = Maybe Handle
b })
hstderr :: Lens' ProcessHandler (Maybe Handle)
hstderr :: (Maybe Handle -> f (Maybe Handle))
-> ProcessHandler -> f ProcessHandler
hstderr = (ProcessHandler -> Maybe Handle)
-> (ProcessHandler -> Maybe Handle -> ProcessHandler)
-> Lens ProcessHandler ProcessHandler (Maybe Handle) (Maybe Handle)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ProcessHandler -> Maybe Handle
_hstderr (\ProcessHandler
t Maybe Handle
b -> ProcessHandler
t { _hstderr :: Maybe Handle
_hstderr = Maybe Handle
b })
hhandle :: Lens' ProcessHandler ProcessHandle
hhandle :: (ProcessHandle -> f ProcessHandle)
-> ProcessHandler -> f ProcessHandler
hhandle = (ProcessHandler -> ProcessHandle)
-> (ProcessHandler -> ProcessHandle -> ProcessHandler)
-> Lens ProcessHandler ProcessHandler ProcessHandle ProcessHandle
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
lens ProcessHandler -> ProcessHandle
_hhandle (\ProcessHandler
t ProcessHandle
b -> ProcessHandler
t { _hhandle :: ProcessHandle
_hhandle = ProcessHandle
b })
_Handler :: Iso' ProcessHandler (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
_Handler :: p (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
(f (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle))
-> p ProcessHandler (f ProcessHandler)
_Handler = (ProcessHandler
-> (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle))
-> ((Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-> ProcessHandler)
-> Iso
ProcessHandler
ProcessHandler
(Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
(Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso
(\(ProcessHandler Maybe Handle
a Maybe Handle
b Maybe Handle
c ProcessHandle
p) -> (Maybe Handle
a,Maybe Handle
b,Maybe Handle
c,ProcessHandle
p))
(\(Maybe Handle
a,Maybe Handle
b,Maybe Handle
c,ProcessHandle
p) -> Maybe Handle
-> Maybe Handle -> Maybe Handle -> ProcessHandle -> ProcessHandler
ProcessHandler Maybe Handle
a Maybe Handle
b Maybe Handle
c ProcessHandle
p)