Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Provides a typeclass for all monads that may print text.
Synopsis
- class Monad m => ChPrinter m where
- newtype DeafT m a = Deaf {
- runDeafT :: m a
- newtype OutRedirT m a = OutRedir {
- runOutRedirT :: Handle -> m a
- type OutRedir = OutRedirT IO
- runOutRedir :: OutRedir a -> Handle -> IO a
- runOutRedirFT :: (Functor m, MonadIO m) => OutRedirT m a -> FilePath -> IOMode -> m a
- runOutRedirF :: OutRedir a -> FilePath -> IOMode -> IO a
- newtype RecorderT m a = Recorder {
- runRecorderT' :: m (a, [String])
- type Recorder = RecorderT Identity
- newtype Replayable = Replayable [String]
- replay :: Replayable -> String
- runRecorder :: Recorder a -> (a, Replayable)
- runRecorderT :: (Functor m, Monad m) => RecorderT m a -> m (a, Replayable)
- mprintLn :: ChPrinter m => String -> m ()
- mnomaskLn :: ChPrinter m => String -> m ()
- data DiscardO = DiscardO
- data RecordO = RecordO
- class RedirectionTarget t mt a r | t -> mt, t a -> r where
Documentation
class Monad m => ChPrinter m where Source #
A typeclass for all monads that may output strings.
mprint :: String -> m () Source #
Just print it!
mnoecho :: String -> m () Source #
Print it, except you are IO.
Flush the buffer.
mnomask :: String -> m () Source #
Alternative to mprint that does not mask any characters (depends on the carrier).
Instances
DeafT discards all output (much like >/dev/null in the shell)
Instances
MonadTrans DeafT Source # | |
Defined in Text.Chatty.Printer | |
RedirectionTarget DiscardO DeafT a a Source # | |
Monad m => Monad (DeafT m) Source # | |
Functor m => Functor (DeafT m) Source # | |
(Functor m, Monad m) => Applicative (DeafT m) Source # | |
MonadIO m => MonadIO (DeafT m) Source # | |
Defined in Text.Chatty.Printer | |
ChAtoms m => ChAtoms (DeafT m) Source # | |
Defined in Text.Chatty.Interactor | |
ChCounter m => ChCounter (DeafT m) Source # | |
Defined in Text.Chatty.Interactor | |
ChExpand m => ChExpand (DeafT m) Source # | |
ChHistoryEnv m => ChHistoryEnv (DeafT m) Source # | |
ChExpanderEnv m => ChExpanderEnv (DeafT m) Source # | |
ChFinalizer m => ChFinalizer (DeafT m) Source # | |
Monad m => ChPrinter (DeafT m) Source # | |
ChScanner m => ChScanner (DeafT m) Source # | |
ChBufferedScanner m => ChBufferedScanner (DeafT m) Source # | |
newtype OutRedirT m a Source #
Redirects all output to a given handle (much like >filename in the shell)
OutRedir | |
|
Instances
newtype RecorderT m a Source #
Catches all output (much like VAR=$(...) in the shell)
Recorder | |
|
Instances
newtype Replayable Source #
The recorder state. Use this together with replay
, replayM
or replay_
.
Instances
Show Replayable Source # | |
Defined in Text.Chatty.Printer showsPrec :: Int -> Replayable -> ShowS # show :: Replayable -> String # showList :: [Replayable] -> ShowS # | |
RedirectionTarget RecordO RecorderT a (a, Replayable) Source # | |
replay :: Replayable -> String Source #
Replay a recorder state in a pure context.
runRecorder :: Recorder a -> (a, Replayable) Source #
Run Recorder
and also return its state.
runRecorderT :: (Functor m, Monad m) => RecorderT m a -> m (a, Replayable) Source #
Run RecorderT
and also return its state.
Redirection target that discards input.
Redirection target that records input.
Instances
class RedirectionTarget t mt a r | t -> mt, t a -> r where Source #
Class for all redirection targets.
(.>.) :: (Functor m, MonadIO m, ChPrinter (mt m)) => mt m a -> t -> m r Source #
Overwriting redirection.
(.>>.) :: (Functor m, MonadIO m, ChPrinter (mt m)) => mt m a -> t -> m r Source #
Appending redirection.