{-# LANGUAGE CPP #-}

{- ORMOLU_DISABLE -}

-- | Provides a dynamic effect for typed process.
--
-- @since 0.1
module Effectful.Process.Typed.Dynamic
  ( -- * Effect
    TypedProcess (..),

    -- ** Handler
    runTypedProcess,

    -- * Types
    ProcessConfig,
    StreamSpec,
    StreamType (..),
    Process,

    -- * ProcessConfig
    P.proc,
    P.shell,

    -- * Setters
    P.setStdin,
    P.setStdout,
    P.setStderr,
    P.setWorkingDir,
    P.setWorkingDirInherit,
    P.setEnv,
    P.setEnvInherit,
    P.setCloseFds,
    P.setCreateGroup,
    P.setDelegateCtlc,
    P.setDetachConsole,
    P.setCreateNewConsole,
    P.setNewSession,
#if !WINDOWS
    P.setChildGroup,
    P.setChildGroupInherit,
    P.setChildUser,
    P.setChildUserInherit,
#endif

    -- * Stream specs

    -- ** Built-in stream specs
    P.inherit,
    P.nullStream,
    P.closed,
    P.byteStringInput,
    P.byteStringOutput,
    P.createPipe,
    P.useHandleOpen,
    P.useHandleClose,

    -- ** Create your own stream spec
    P.mkStreamSpec,
    P.mkPipeStreamSpec,

    -- * Launch a process
    runProcess,
    readProcess,
    readProcessStdout,
    readProcessStderr,
    readProcessInterleaved,
    withProcessWait,
    withProcessTerm,
    startProcess,
    stopProcess,

    -- * Exception-throwing functions
    runProcess_,
    readProcess_,
    readProcessStdout_,
    readProcessStderr_,
    readProcessInterleaved_,
    withProcessWait_,
    withProcessTerm_,

    -- * Interact with a process

    -- ** Process exit code
    waitExitCode,
    P.waitExitCodeSTM,
    getExitCode,
    P.getExitCodeSTM,
    checkExitCode,
    P.checkExitCodeSTM,

    -- ** Process streams
    P.getStdin,
    P.getStdout,
    P.getStderr,

    -- * Exceptions
    P.ExitCodeException (..),
    P.ByteStringOutputException (..),

    -- * Re-exports
    P.ExitCode (..),
    P.StdStream (..),

    -- * Unsafe functions
    P.unsafeProcessHandle,
  )
where

{- ORMOLU_ENABLE -}

import Control.Monad.IO.Class (MonadIO (liftIO))
import Data.ByteString.Lazy qualified as BSL
import Effectful
  ( Dispatch (Dynamic),
    DispatchOf,
    Eff,
    Effect,
    IOE,
    type (:>),
  )
import Effectful.Dispatch.Dynamic (interpret, localSeqUnliftIO, send)
import Effectful.Dynamic.Utils (ShowEffect (showEffectCons))
import GHC.Stack (HasCallStack)
import System.Exit (ExitCode)
import System.Process.Typed
  ( Process,
    ProcessConfig,
    StreamSpec,
    StreamType (STInput, STOutput),
  )
import System.Process.Typed qualified as P
import System.Process.Typed qualified as TP

-- NOTE: This could be implemented in terms of the static effect, defined in
-- typed-process-effectful. But not doing so saves us a dependency, so...

-- | Dynamic effect for typed process.
--
-- @since 0.1
data TypedProcess :: Effect where
  RunProcess :: ProcessConfig stdin stdout stderr -> TypedProcess m ExitCode
  ReadProcess ::
    ProcessConfig stdin stdoutIgnored stderrIgnored ->
    TypedProcess m (ExitCode, BSL.ByteString, BSL.ByteString)
  ReadProcessStdout ::
    ProcessConfig stdin stdoutIgnored stderr ->
    TypedProcess m (ExitCode, BSL.ByteString)
  ReadProcessStderr ::
    ProcessConfig stdin stdoutIgnored stderrIgnored ->
    TypedProcess m (ExitCode, BSL.ByteString)
  ReadProcessInterleaved ::
    ProcessConfig stdin stdoutIgnored stderrIgnored ->
    TypedProcess m (ExitCode, BSL.ByteString)
  WithProcessWait ::
    ProcessConfig stdin stdout stderr ->
    (Process stdin stdout stderr -> m a) ->
    TypedProcess m a
  WithProcessTerm ::
    ProcessConfig stdin stdout stderr ->
    (Process stdin stdout stderr -> m a) ->
    TypedProcess m a
  StartProcess ::
    ProcessConfig stdin stdout stderr ->
    TypedProcess m (Process stdin stdout stderr)
  StopProcess :: Process stdin stdout stderr -> TypedProcess m ()
  RunProcess_ :: ProcessConfig stdin stdout stderr -> TypedProcess m ()
  ReadProcess_ ::
    ProcessConfig stdin stdoutIgnored stderrIgnored ->
    TypedProcess m (BSL.ByteString, BSL.ByteString)
  ReadProcessStdout_ ::
    ProcessConfig stdin stdoutIgnored stderr ->
    TypedProcess m BSL.ByteString
  ReadProcessStderr_ ::
    ProcessConfig stdin stdout stderrIgnored ->
    TypedProcess m BSL.ByteString
  ReadProcessInterleaved_ ::
    ProcessConfig stdin stdoutIgnored stderrIgnored ->
    TypedProcess m BSL.ByteString
  WithProcessWait_ ::
    ProcessConfig stdin stdout stderr ->
    (Process stdin stdout stderr -> m a) ->
    TypedProcess m a
  WithProcessTerm_ ::
    ProcessConfig stdin stdout stderr ->
    (Process stdin stdout stderr -> m a) ->
    TypedProcess m a
  WaitExitCode :: Process stdin stdout stderr -> TypedProcess m ExitCode
  GetExitCode :: Process stdin stdout stderr -> TypedProcess m (Maybe ExitCode)
  CheckExitCode :: Process stdin stdout stderr -> TypedProcess m ()

-- | @since 0.1
type instance DispatchOf TypedProcess = Dynamic

-- | @since 0.1
instance ShowEffect TypedProcess where
  showEffectCons :: forall (m :: * -> *) a. TypedProcess m a -> String
showEffectCons = \case
    RunProcess ProcessConfig stdin stdout stderr
_ -> String
"RunProcess"
    ReadProcess ProcessConfig stdin stdoutIgnored stderrIgnored
_ -> String
"ReadProcess"
    ReadProcessStdout ProcessConfig stdin stdoutIgnored stderr
_ -> String
"ReadProcessStdout"
    ReadProcessStderr ProcessConfig stdin stdoutIgnored stderrIgnored
_ -> String
"ReadProcessStderr"
    ReadProcessInterleaved ProcessConfig stdin stdoutIgnored stderrIgnored
_ -> String
"ReadProcessInterleaved"
    WithProcessWait ProcessConfig stdin stdout stderr
_ Process stdin stdout stderr -> m a
_ -> String
"WithProcessWait"
    WithProcessTerm ProcessConfig stdin stdout stderr
_ Process stdin stdout stderr -> m a
_ -> String
"WithProcessTerm"
    StartProcess ProcessConfig stdin stdout stderr
_ -> String
"StartProcess"
    StopProcess Process stdin stdout stderr
_ -> String
"StopProcess"
    RunProcess_ ProcessConfig stdin stdout stderr
_ -> String
"RunProcess_"
    ReadProcess_ ProcessConfig stdin stdoutIgnored stderrIgnored
_ -> String
"ReadProcess_"
    ReadProcessStdout_ ProcessConfig stdin stdoutIgnored stderr
_ -> String
"ReadProcessStdout_"
    ReadProcessStderr_ ProcessConfig stdin stdout stderrIgnored
_ -> String
"ReadProcessStderr_"
    ReadProcessInterleaved_ ProcessConfig stdin stdoutIgnored stderrIgnored
_ -> String
"ReadProcessInterleaved_"
    WithProcessWait_ ProcessConfig stdin stdout stderr
_ Process stdin stdout stderr -> m a
_ -> String
"WithProcessWait_"
    WithProcessTerm_ ProcessConfig stdin stdout stderr
_ Process stdin stdout stderr -> m a
_ -> String
"WithProcessTerm_"
    WaitExitCode Process stdin stdout stderr
_ -> String
"WaitExitCode"
    GetExitCode Process stdin stdout stderr
_ -> String
"GetExitCode"
    CheckExitCode Process stdin stdout stderr
_ -> String
"CheckExitCode"

-- | Runs 'TypedProcess' in 'IO'.
--
-- @since 0.1
runTypedProcess ::
  ( HasCallStack,
    IOE :> es
  ) =>
  Eff (TypedProcess : es) a ->
  Eff es a
runTypedProcess :: forall (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, IOE :> es) =>
Eff (TypedProcess : es) a -> Eff es a
runTypedProcess = EffectHandler TypedProcess es
-> Eff (TypedProcess : es) a -> Eff es a
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic) =>
EffectHandler e es -> Eff (e : es) a -> Eff es a
interpret (EffectHandler TypedProcess es
 -> Eff (TypedProcess : es) a -> Eff es a)
-> EffectHandler TypedProcess es
-> Eff (TypedProcess : es) a
-> Eff es a
forall a b. (a -> b) -> a -> b
$ \LocalEnv localEs es
env -> \case
  RunProcess ProcessConfig stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr -> IO ExitCode
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
ProcessConfig stdin stdout stderr -> m ExitCode
TP.runProcess ProcessConfig stdin stdout stderr
pc
  ReadProcess ProcessConfig stdin stdoutIgnored stderrIgnored
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderrIgnored
-> IO (ExitCode, ByteString, ByteString)
forall (m :: * -> *) stdin stdoutIgnored stderrIgnored.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderrIgnored
-> m (ExitCode, ByteString, ByteString)
TP.readProcess ProcessConfig stdin stdoutIgnored stderrIgnored
pc
  ReadProcessStdout ProcessConfig stdin stdoutIgnored stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderr
-> IO (ExitCode, ByteString)
forall (m :: * -> *) stdin stdoutIgnored stderr.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderr
-> m (ExitCode, ByteString)
TP.readProcessStdout ProcessConfig stdin stdoutIgnored stderr
pc
  ReadProcessStderr ProcessConfig stdin stdoutIgnored stderrIgnored
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderrIgnored
-> IO (ExitCode, ByteString)
forall (m :: * -> *) stdin stdoutIgnored stderr.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderr
-> m (ExitCode, ByteString)
TP.readProcessStderr ProcessConfig stdin stdoutIgnored stderrIgnored
pc
  ReadProcessInterleaved ProcessConfig stdin stdoutIgnored stderrIgnored
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderrIgnored
-> IO (ExitCode, ByteString)
forall (m :: * -> *) stdin stdoutIgnored stderr.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderr
-> m (ExitCode, ByteString)
TP.readProcessInterleaved ProcessConfig stdin stdoutIgnored stderrIgnored
pc
  WithProcessWait ProcessConfig stdin stdout stderr
pc Process stdin stdout stderr -> Eff localEs a
onProcess -> LocalEnv localEs es
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall (es :: [(* -> *) -> * -> *])
       (handlerEs :: [(* -> *) -> * -> *])
       (localEs :: [(* -> *) -> * -> *]) a.
(HasCallStack, SharedSuffix es handlerEs, IOE :> es) =>
LocalEnv localEs handlerEs
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
localSeqUnliftIO LocalEnv localEs es
env (((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a)
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall a b. (a -> b) -> a -> b
$ \forall r. Eff localEs r -> IO r
runInIO ->
    IO a -> IO a
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> IO a) -> IO a -> IO a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> IO a) -> IO a
forall (m :: * -> *) stdin stdout stderr a.
MonadUnliftIO m =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> m a
TP.withProcessWait ProcessConfig stdin stdout stderr
pc (Eff localEs a -> IO a
forall r. Eff localEs r -> IO r
runInIO (Eff localEs a -> IO a)
-> (Process stdin stdout stderr -> Eff localEs a)
-> Process stdin stdout stderr
-> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> Eff localEs a
onProcess)
  WithProcessTerm ProcessConfig stdin stdout stderr
pc Process stdin stdout stderr -> Eff localEs a
onProcess -> LocalEnv localEs es
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall (es :: [(* -> *) -> * -> *])
       (handlerEs :: [(* -> *) -> * -> *])
       (localEs :: [(* -> *) -> * -> *]) a.
(HasCallStack, SharedSuffix es handlerEs, IOE :> es) =>
LocalEnv localEs handlerEs
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
localSeqUnliftIO LocalEnv localEs es
env (((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a)
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall a b. (a -> b) -> a -> b
$ \forall r. Eff localEs r -> IO r
runInIO ->
    IO a -> IO a
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> IO a) -> IO a -> IO a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> IO a) -> IO a
forall (m :: * -> *) stdin stdout stderr a.
MonadUnliftIO m =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> m a
TP.withProcessTerm ProcessConfig stdin stdout stderr
pc (Eff localEs a -> IO a
forall r. Eff localEs r -> IO r
runInIO (Eff localEs a -> IO a)
-> (Process stdin stdout stderr -> Eff localEs a)
-> Process stdin stdout stderr
-> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> Eff localEs a
onProcess)
  StartProcess ProcessConfig stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr
-> IO (Process stdin stdout stderr)
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
ProcessConfig stdin stdout stderr
-> m (Process stdin stdout stderr)
TP.startProcess ProcessConfig stdin stdout stderr
pc
  StopProcess Process stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ Process stdin stdout stderr -> IO ()
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
Process stdin stdout stderr -> m ()
TP.stopProcess Process stdin stdout stderr
pc
  RunProcess_ ProcessConfig stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr -> IO ()
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
ProcessConfig stdin stdout stderr -> m ()
TP.runProcess_ ProcessConfig stdin stdout stderr
pc
  ReadProcess_ ProcessConfig stdin stdoutIgnored stderrIgnored
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderrIgnored
-> IO (ByteString, ByteString)
forall (m :: * -> *) stdin stdoutIgnored stderrIgnored.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderrIgnored
-> m (ByteString, ByteString)
TP.readProcess_ ProcessConfig stdin stdoutIgnored stderrIgnored
pc
  ReadProcessStdout_ ProcessConfig stdin stdoutIgnored stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderr -> IO ByteString
forall (m :: * -> *) stdin stdoutIgnored stderr.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderr -> m ByteString
TP.readProcessStdout_ ProcessConfig stdin stdoutIgnored stderr
pc
  ReadProcessStderr_ ProcessConfig stdin stdout stderrIgnored
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderrIgnored -> IO ByteString
forall (m :: * -> *) stdin stdoutIgnored stderr.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderr -> m ByteString
TP.readProcessStderr_ ProcessConfig stdin stdout stderrIgnored
pc
  ReadProcessInterleaved_ ProcessConfig stdin stdoutIgnored stderrIgnored
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdoutIgnored stderrIgnored -> IO ByteString
forall (m :: * -> *) stdin stdoutIgnored stderr.
MonadIO m =>
ProcessConfig stdin stdoutIgnored stderr -> m ByteString
TP.readProcessInterleaved_ ProcessConfig stdin stdoutIgnored stderrIgnored
pc
  WithProcessWait_ ProcessConfig stdin stdout stderr
pc Process stdin stdout stderr -> Eff localEs a
onProcess -> LocalEnv localEs es
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall (es :: [(* -> *) -> * -> *])
       (handlerEs :: [(* -> *) -> * -> *])
       (localEs :: [(* -> *) -> * -> *]) a.
(HasCallStack, SharedSuffix es handlerEs, IOE :> es) =>
LocalEnv localEs handlerEs
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
localSeqUnliftIO LocalEnv localEs es
env (((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a)
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall a b. (a -> b) -> a -> b
$ \forall r. Eff localEs r -> IO r
runInIO ->
    IO a -> IO a
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> IO a) -> IO a -> IO a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> IO a) -> IO a
forall (m :: * -> *) stdin stdout stderr a.
MonadUnliftIO m =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> m a
TP.withProcessWait_ ProcessConfig stdin stdout stderr
pc (Eff localEs a -> IO a
forall r. Eff localEs r -> IO r
runInIO (Eff localEs a -> IO a)
-> (Process stdin stdout stderr -> Eff localEs a)
-> Process stdin stdout stderr
-> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> Eff localEs a
onProcess)
  WithProcessTerm_ ProcessConfig stdin stdout stderr
pc Process stdin stdout stderr -> Eff localEs a
onProcess -> LocalEnv localEs es
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall (es :: [(* -> *) -> * -> *])
       (handlerEs :: [(* -> *) -> * -> *])
       (localEs :: [(* -> *) -> * -> *]) a.
(HasCallStack, SharedSuffix es handlerEs, IOE :> es) =>
LocalEnv localEs handlerEs
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
localSeqUnliftIO LocalEnv localEs es
env (((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a)
-> ((forall r. Eff localEs r -> IO r) -> IO a) -> Eff es a
forall a b. (a -> b) -> a -> b
$ \forall r. Eff localEs r -> IO r
runInIO ->
    IO a -> IO a
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> IO a) -> IO a -> IO a
forall a b. (a -> b) -> a -> b
$ ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> IO a) -> IO a
forall (m :: * -> *) stdin stdout stderr a.
MonadUnliftIO m =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> m a
TP.withProcessTerm_ ProcessConfig stdin stdout stderr
pc (Eff localEs a -> IO a
forall r. Eff localEs r -> IO r
runInIO (Eff localEs a -> IO a)
-> (Process stdin stdout stderr -> Eff localEs a)
-> Process stdin stdout stderr
-> IO a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> Eff localEs a
onProcess)
  WaitExitCode Process stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ Process stdin stdout stderr -> IO ExitCode
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
Process stdin stdout stderr -> m ExitCode
TP.waitExitCode Process stdin stdout stderr
pc
  GetExitCode Process stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ Process stdin stdout stderr -> IO (Maybe ExitCode)
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
Process stdin stdout stderr -> m (Maybe ExitCode)
TP.getExitCode Process stdin stdout stderr
pc
  CheckExitCode Process stdin stdout stderr
pc -> IO a -> Eff es a
forall a. IO a -> Eff es a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO a -> Eff es a) -> IO a -> Eff es a
forall a b. (a -> b) -> a -> b
$ Process stdin stdout stderr -> IO ()
forall (m :: * -> *) stdin stdout stderr.
MonadIO m =>
Process stdin stdout stderr -> m ()
TP.checkExitCode Process stdin stdout stderr
pc

-- | Lifted 'TP.runProcess'.
--
-- @since 0.1
runProcess ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  Eff es ExitCode
runProcess :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr -> Eff es ExitCode
runProcess = TypedProcess (Eff es) ExitCode -> Eff es ExitCode
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) ExitCode -> Eff es ExitCode)
-> (ProcessConfig stdin stdout stderr
    -> TypedProcess (Eff es) ExitCode)
-> ProcessConfig stdin stdout stderr
-> Eff es ExitCode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr -> TypedProcess (Eff es) ExitCode
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr -> TypedProcess m ExitCode
RunProcess

-- | Lifted 'TP.readProcess'.
--
-- @since 0.1
readProcess ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderrIgnored ->
  Eff es (ExitCode, BSL.ByteString, BSL.ByteString)
readProcess :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored
       stderrIgnored.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es (ExitCode, ByteString, ByteString)
readProcess = TypedProcess (Eff es) (ExitCode, ByteString, ByteString)
-> Eff es (ExitCode, ByteString, ByteString)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (ExitCode, ByteString, ByteString)
 -> Eff es (ExitCode, ByteString, ByteString))
-> (ProcessConfig stdin stdoutIgnored stderrIgnored
    -> TypedProcess (Eff es) (ExitCode, ByteString, ByteString))
-> ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es (ExitCode, ByteString, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderrIgnored
-> TypedProcess (Eff es) (ExitCode, ByteString, ByteString)
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr
-> TypedProcess m (ExitCode, ByteString, ByteString)
ReadProcess

-- | Lifted 'TP.readProcessStdout'.
--
-- @since 0.1
readProcessStdout ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderr ->
  Eff es (ExitCode, BSL.ByteString)
readProcessStdout :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderr
-> Eff es (ExitCode, ByteString)
readProcessStdout = TypedProcess (Eff es) (ExitCode, ByteString)
-> Eff es (ExitCode, ByteString)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (ExitCode, ByteString)
 -> Eff es (ExitCode, ByteString))
-> (ProcessConfig stdin stdoutIgnored stderr
    -> TypedProcess (Eff es) (ExitCode, ByteString))
-> ProcessConfig stdin stdoutIgnored stderr
-> Eff es (ExitCode, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderr
-> TypedProcess (Eff es) (ExitCode, ByteString)
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr
-> TypedProcess m (ExitCode, ByteString)
ReadProcessStdout

-- | Lifted 'TP.readProcessStderr'.
--
-- @since 0.1
readProcessStderr ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderrIgnored ->
  Eff es (ExitCode, BSL.ByteString)
readProcessStderr :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderr
-> Eff es (ExitCode, ByteString)
readProcessStderr = TypedProcess (Eff es) (ExitCode, ByteString)
-> Eff es (ExitCode, ByteString)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (ExitCode, ByteString)
 -> Eff es (ExitCode, ByteString))
-> (ProcessConfig stdin stdoutIgnored stderrIgnored
    -> TypedProcess (Eff es) (ExitCode, ByteString))
-> ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es (ExitCode, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderrIgnored
-> TypedProcess (Eff es) (ExitCode, ByteString)
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr
-> TypedProcess m (ExitCode, ByteString)
ReadProcessStderr

-- | Lifted 'TP.readProcessInterleaved'.
--
-- @since 0.1
readProcessInterleaved ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderrIgnored ->
  Eff es (ExitCode, BSL.ByteString)
readProcessInterleaved :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderr
-> Eff es (ExitCode, ByteString)
readProcessInterleaved = TypedProcess (Eff es) (ExitCode, ByteString)
-> Eff es (ExitCode, ByteString)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (ExitCode, ByteString)
 -> Eff es (ExitCode, ByteString))
-> (ProcessConfig stdin stdoutIgnored stderrIgnored
    -> TypedProcess (Eff es) (ExitCode, ByteString))
-> ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es (ExitCode, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderrIgnored
-> TypedProcess (Eff es) (ExitCode, ByteString)
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr
-> TypedProcess m (ExitCode, ByteString)
ReadProcessInterleaved

-- | Lifted 'TP.withProcessWait'.
--
-- @since 0.1
withProcessWait ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  (Process stdin stdout stderr -> Eff es a) ->
  Eff es a
withProcessWait :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr a.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a) -> Eff es a
withProcessWait ProcessConfig stdin stdout stderr
pc = TypedProcess (Eff es) a -> Eff es a
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) a -> Eff es a)
-> ((Process stdin stdout stderr -> Eff es a)
    -> TypedProcess (Eff es) a)
-> (Process stdin stdout stderr -> Eff es a)
-> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a)
-> TypedProcess (Eff es) a
forall stdin stdout stderr (m :: * -> *) a.
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> TypedProcess m a
WithProcessWait ProcessConfig stdin stdout stderr
pc

-- | Lifted 'TP.withProcessTerm'.
--
-- @since 0.1
withProcessTerm ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  (Process stdin stdout stderr -> Eff es a) ->
  Eff es a
withProcessTerm :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr a.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a) -> Eff es a
withProcessTerm ProcessConfig stdin stdout stderr
pc = TypedProcess (Eff es) a -> Eff es a
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) a -> Eff es a)
-> ((Process stdin stdout stderr -> Eff es a)
    -> TypedProcess (Eff es) a)
-> (Process stdin stdout stderr -> Eff es a)
-> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a)
-> TypedProcess (Eff es) a
forall stdin stdout stderr (m :: * -> *) a.
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> TypedProcess m a
WithProcessTerm ProcessConfig stdin stdout stderr
pc

-- | Lifted 'TP.startProcess'.
--
-- @since 0.1
startProcess ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  Eff es (Process stdin stdout stderr)
startProcess :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr
-> Eff es (Process stdin stdout stderr)
startProcess = TypedProcess (Eff es) (Process stdin stdout stderr)
-> Eff es (Process stdin stdout stderr)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (Process stdin stdout stderr)
 -> Eff es (Process stdin stdout stderr))
-> (ProcessConfig stdin stdout stderr
    -> TypedProcess (Eff es) (Process stdin stdout stderr))
-> ProcessConfig stdin stdout stderr
-> Eff es (Process stdin stdout stderr)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr
-> TypedProcess (Eff es) (Process stdin stdout stderr)
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr
-> TypedProcess m (Process stdin stdout stderr)
StartProcess

-- | Lifted 'TP.stopProcess'.
--
-- @since 0.1
stopProcess ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  Process stdin stdout stderr ->
  Eff es ()
stopProcess :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
Process stdin stdout stderr -> Eff es ()
stopProcess = TypedProcess (Eff es) () -> Eff es ()
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) () -> Eff es ())
-> (Process stdin stdout stderr -> TypedProcess (Eff es) ())
-> Process stdin stdout stderr
-> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> TypedProcess (Eff es) ()
forall stdin stdout stderr (m :: * -> *).
Process stdin stdout stderr -> TypedProcess m ()
StopProcess

-- | Lifted 'TP.runProcess_'.
--
-- @since 0.1
runProcess_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  Eff es ()
runProcess_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr -> Eff es ()
runProcess_ = TypedProcess (Eff es) () -> Eff es ()
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) () -> Eff es ())
-> (ProcessConfig stdin stdout stderr -> TypedProcess (Eff es) ())
-> ProcessConfig stdin stdout stderr
-> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr -> TypedProcess (Eff es) ()
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr -> TypedProcess m ()
RunProcess_

-- | Lifted 'TP.readProcess_'.
--
-- @since 0.1
readProcess_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderrIgnored ->
  Eff es (BSL.ByteString, BSL.ByteString)
readProcess_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored
       stderrIgnored.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es (ByteString, ByteString)
readProcess_ = TypedProcess (Eff es) (ByteString, ByteString)
-> Eff es (ByteString, ByteString)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (ByteString, ByteString)
 -> Eff es (ByteString, ByteString))
-> (ProcessConfig stdin stdoutIgnored stderrIgnored
    -> TypedProcess (Eff es) (ByteString, ByteString))
-> ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es (ByteString, ByteString)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderrIgnored
-> TypedProcess (Eff es) (ByteString, ByteString)
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr
-> TypedProcess m (ByteString, ByteString)
ReadProcess_

-- | Lifted 'TP.readProcessStdout_'.
--
-- @since 0.1
readProcessStdout_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderr ->
  Eff es BSL.ByteString
readProcessStdout_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderr -> Eff es ByteString
readProcessStdout_ = TypedProcess (Eff es) ByteString -> Eff es ByteString
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) ByteString -> Eff es ByteString)
-> (ProcessConfig stdin stdoutIgnored stderr
    -> TypedProcess (Eff es) ByteString)
-> ProcessConfig stdin stdoutIgnored stderr
-> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderr
-> TypedProcess (Eff es) ByteString
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr -> TypedProcess m ByteString
ReadProcessStdout_

-- | Lifted 'TP.readProcessStderr_'.
--
-- @since 0.1
readProcessStderr_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderrIgnored ->
  Eff es BSL.ByteString
readProcessStderr_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderr -> Eff es ByteString
readProcessStderr_ = TypedProcess (Eff es) ByteString -> Eff es ByteString
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) ByteString -> Eff es ByteString)
-> (ProcessConfig stdin stdout stderrIgnored
    -> TypedProcess (Eff es) ByteString)
-> ProcessConfig stdin stdout stderrIgnored
-> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderrIgnored
-> TypedProcess (Eff es) ByteString
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr -> TypedProcess m ByteString
ReadProcessStderr_

-- | Lifted 'TP.readProcessInterleaved_'.
--
-- @since 0.1
readProcessInterleaved_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdoutIgnored stderrIgnored ->
  Eff es BSL.ByteString
readProcessInterleaved_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdoutIgnored stderr.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdoutIgnored stderr -> Eff es ByteString
readProcessInterleaved_ = TypedProcess (Eff es) ByteString -> Eff es ByteString
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) ByteString -> Eff es ByteString)
-> (ProcessConfig stdin stdoutIgnored stderrIgnored
    -> TypedProcess (Eff es) ByteString)
-> ProcessConfig stdin stdoutIgnored stderrIgnored
-> Eff es ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdoutIgnored stderrIgnored
-> TypedProcess (Eff es) ByteString
forall stdin stdout stderr (m :: * -> *).
ProcessConfig stdin stdout stderr -> TypedProcess m ByteString
ReadProcessInterleaved_

-- | Lifted 'TP.withProcessWait_'.
--
-- @since 0.1
withProcessWait_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  (Process stdin stdout stderr -> Eff es a) ->
  Eff es a
withProcessWait_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr a.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a) -> Eff es a
withProcessWait_ ProcessConfig stdin stdout stderr
pc = TypedProcess (Eff es) a -> Eff es a
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) a -> Eff es a)
-> ((Process stdin stdout stderr -> Eff es a)
    -> TypedProcess (Eff es) a)
-> (Process stdin stdout stderr -> Eff es a)
-> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a)
-> TypedProcess (Eff es) a
forall stdin stdout stderr (m :: * -> *) a.
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> TypedProcess m a
WithProcessWait_ ProcessConfig stdin stdout stderr
pc

-- | Lifted 'TP.withProcessTerm_'.
--
-- @since 0.1
withProcessTerm_ ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  ProcessConfig stdin stdout stderr ->
  (Process stdin stdout stderr -> Eff es a) ->
  Eff es a
withProcessTerm_ :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr a.
(HasCallStack, TypedProcess :> es) =>
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a) -> Eff es a
withProcessTerm_ ProcessConfig stdin stdout stderr
pc = TypedProcess (Eff es) a -> Eff es a
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) a -> Eff es a)
-> ((Process stdin stdout stderr -> Eff es a)
    -> TypedProcess (Eff es) a)
-> (Process stdin stdout stderr -> Eff es a)
-> Eff es a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> Eff es a)
-> TypedProcess (Eff es) a
forall stdin stdout stderr (m :: * -> *) a.
ProcessConfig stdin stdout stderr
-> (Process stdin stdout stderr -> m a) -> TypedProcess m a
WithProcessTerm_ ProcessConfig stdin stdout stderr
pc

-- | Lifted 'TP.waitExitCode'.
--
-- @since 0.1
waitExitCode ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  Process stdin stdout stderr ->
  Eff es ExitCode
waitExitCode :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
Process stdin stdout stderr -> Eff es ExitCode
waitExitCode = TypedProcess (Eff es) ExitCode -> Eff es ExitCode
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) ExitCode -> Eff es ExitCode)
-> (Process stdin stdout stderr -> TypedProcess (Eff es) ExitCode)
-> Process stdin stdout stderr
-> Eff es ExitCode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> TypedProcess (Eff es) ExitCode
forall stdin stdout stderr (m :: * -> *).
Process stdin stdout stderr -> TypedProcess m ExitCode
WaitExitCode

-- | Lifted 'TP.getExitCode'.
--
-- @since 0.1
getExitCode ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  Process stdin stdout stderr ->
  Eff es (Maybe ExitCode)
getExitCode :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
Process stdin stdout stderr -> Eff es (Maybe ExitCode)
getExitCode = TypedProcess (Eff es) (Maybe ExitCode) -> Eff es (Maybe ExitCode)
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) (Maybe ExitCode) -> Eff es (Maybe ExitCode))
-> (Process stdin stdout stderr
    -> TypedProcess (Eff es) (Maybe ExitCode))
-> Process stdin stdout stderr
-> Eff es (Maybe ExitCode)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr
-> TypedProcess (Eff es) (Maybe ExitCode)
forall stdin stdout stderr (m :: * -> *).
Process stdin stdout stderr -> TypedProcess m (Maybe ExitCode)
GetExitCode

-- | Lifted 'TP.checkExitCode'.
--
-- @since 0.1
checkExitCode ::
  ( HasCallStack,
    TypedProcess :> es
  ) =>
  Process stdin stdout stderr ->
  Eff es ()
checkExitCode :: forall (es :: [(* -> *) -> * -> *]) stdin stdout stderr.
(HasCallStack, TypedProcess :> es) =>
Process stdin stdout stderr -> Eff es ()
checkExitCode = TypedProcess (Eff es) () -> Eff es ()
forall (e :: (* -> *) -> * -> *) (es :: [(* -> *) -> * -> *]) a.
(HasCallStack, DispatchOf e ~ 'Dynamic, e :> es) =>
e (Eff es) a -> Eff es a
send (TypedProcess (Eff es) () -> Eff es ())
-> (Process stdin stdout stderr -> TypedProcess (Eff es) ())
-> Process stdin stdout stderr
-> Eff es ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Process stdin stdout stderr -> TypedProcess (Eff es) ()
forall stdin stdout stderr (m :: * -> *).
Process stdin stdout stderr -> TypedProcess m ()
CheckExitCode