shell-conduit-5.0.0: Write shell scripts with Conduit

Safe Haskell | None
Language | Haskell2010

Data.Conduit.Shell.Process

Contents

- Running scripts
- Conduit types
- General conduits
- Running processes

Description

Reading from the process.

Synopsis

- run :: MonadIO m => Segment m r -> m r
- text :: forall r (m :: Type -> Type). (r ~ (), MonadThrow m) => ConduitT Text Text m r -> Segment m r
- bytes :: forall a (m :: Type -> Type) r. (a ~ ByteString, Monad m) => ConduitT a ByteString m r -> Segment m r
- conduit :: forall a (m :: Type -> Type) r. (a ~ ByteString, Monad m) => ConduitT a ByteString m r -> Segment m r
- conduitEither :: forall a (m :: Type -> Type) r. (a ~ ByteString, Monad m) => ConduitT a (Either ByteString ByteString) m r -> Segment m r
- shell :: forall (m :: Type -> Type). MonadIO m => String -> Segment m ()
- proc :: forall (m :: Type -> Type). MonadIO m => String -> [String] -> Segment m ()
- ($|) :: forall (m :: Type -> Type) b. MonadUnliftIO m => Segment m () -> Segment m b -> Segment m b
- data Segment (m :: Type -> Type) r
- data ProcessException
  - = ProcessException CreateProcess ExitCode
  - | ProcessEmpty
- class ToChunk a where
  - toChunk :: a -> Either ByteString ByteString
- tryS :: forall e (m :: Type -> Type) r. (Exception e, MonadUnliftIO m) => Segment m r -> Segment m (Either e r)

# Running scripts

run :: MonadIO m => Segment m r -> m r Source #

Run a segment.

# Conduit types

text :: forall r (m :: Type -> Type). (r ~ (), MonadThrow m) => ConduitT Text Text m r -> Segment m r Source #

Work on the stream as `Text` values from UTF-8.

bytes :: forall a (m :: Type -> Type) r. (a ~ ByteString, Monad m) => ConduitT a ByteString m r -> Segment m r Source #

Lift a conduit into a segment.

# General conduits

conduit :: forall a (m :: Type -> Type) r. (a ~ ByteString, Monad m) => ConduitT a ByteString m r -> Segment m r Source #

Lift a conduit into a segment.

conduitEither :: forall a (m :: Type -> Type) r. (a ~ ByteString, Monad m) => ConduitT a (Either ByteString ByteString) m r -> Segment m r Source #

Lift a conduit into a segment, which can yield stderr.

# Running processes

shell :: forall (m :: Type -> Type). MonadIO m => String -> Segment m () Source #

Run a shell command.

proc :: forall (m :: Type -> Type). MonadIO m => String -> [String] -> Segment m () Source #

Run a process command.

($|) :: forall (m :: Type -> Type) b. MonadUnliftIO m => Segment m () -> Segment m b -> Segment m b infixl 0 Source #

Fuse two segments (either processes or conduits).

data Segment (m :: Type -> Type) r Source #

A pipeable segment. Either a conduit or a process.

#### Instances

Instances details

MonadIO m => MonadIO (Segment m) Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods liftIO :: IO a -> Segment m a Source #
MonadUnliftIO m => Alternative (Segment m) Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods empty :: Segment m a Source # (<|>) :: Segment m a -> Segment m a -> Segment m a Source # some :: Segment m a -> Segment m [a] Source # many :: Segment m a -> Segment m [a] Source #
MonadIO m => Applicative (Segment m) Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods pure :: a -> Segment m a Source # (<*>) :: Segment m (a -> b) -> Segment m a -> Segment m b Source # liftA2 :: (a -> b -> c) -> Segment m a -> Segment m b -> Segment m c Source # (*>) :: Segment m a -> Segment m b -> Segment m b Source # (<*) :: Segment m a -> Segment m b -> Segment m a Source #
MonadIO m => Functor (Segment m) Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods fmap :: (a -> b) -> Segment m a -> Segment m b Source # (<$) :: a -> Segment m b -> Segment m a Source #
MonadIO m => Monad (Segment m) Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods (>>=) :: Segment m a -> (a -> Segment m b) -> Segment m b Source # (>>) :: Segment m a -> Segment m b -> Segment m b Source # return :: a -> Segment m a Source #
(r ~ (), MonadIO m) => ProcessType (Segment m r) Source # |
Instance details Defined in Data.Conduit.Shell.Variadic Methods spr :: String -> [Text] -> Segment m r Source #

data ProcessException Source #

Process running exception.

Constructors

ProcessException CreateProcess ExitCode |
ProcessEmpty |

#### Instances

Instances details

Exception ProcessException Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods toException :: ProcessException -> SomeException Source # fromException :: SomeException -> Maybe ProcessException Source # displayException :: ProcessException -> String Source # backtraceDesired :: ProcessException -> Bool Source #
Show ProcessException Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods showsPrec :: Int -> ProcessException -> ShowS Source # show :: ProcessException -> String Source # showList :: [ProcessException] -> ShowS Source #

class ToChunk a where Source #

Used to allow outputting stdout or stderr.

Methods

toChunk :: a -> Either ByteString ByteString Source #

#### Instances

Instances details

ToChunk ByteString Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods toChunk :: ByteString -> Either ByteString ByteString Source #
ToChunk (Either ByteString ByteString) Source # |
Instance details Defined in Data.Conduit.Shell.Process Methods toChunk :: Either ByteString ByteString -> Either ByteString ByteString Source #

tryS :: forall e (m :: Type -> Type) r. (Exception e, MonadUnliftIO m) => Segment m r -> Segment m (Either e r) Source #

Try something in a segment.