chatty-0.5.3.1: Some monad transformers and typeclasses to simplify I/O on a transformer stack.

Safe HaskellSafe-Inferred

Text.Chatty.Scanner

Description

Provides a typeclass for all monads that may scan text.

Synopsis

Documentation

class Monad m => MonadScanner m whereSource

A typeclass for all monads that may read input.

Methods

mscan1 :: m CharSource

Read one single character

mscanL :: m StringSource

Lazily read all the input.

mscannable :: m BoolSource

Input readable? (not EOF)

mscanh :: m (Maybe Handle)Source

Return FD handle, if available

mready :: m BoolSource

Input available yet?

newtype HereStringT m a Source

HereStringT holds a given string and uses it as input for the function (much like here-strings in the shell)

Constructors

HereString 

Fields

runHereStringT :: String -> m (a, String)
 

newtype QuietT m a Source

QuietT does not convey any input (much like <devnull in the shell)

Constructors

Quiet 

Fields

runQuietT :: m a
 

Instances

MonadTrans QuietT 
RedirectionSource EmptyI QuietT a a 
ChannelPrinter Bool m0 => ChannelPrinter Bool (QuietT m0) 
ChannelPrinter Int m0 => ChannelPrinter Int (QuietT m0) 
ChannelPrinter Handle m0 => ChannelPrinter Handle (QuietT m0) 
Monad m => Monad (QuietT m) 
Functor m => Functor (QuietT m) 
MonadRandom m0 => MonadRandom (QuietT m0) 
MonadClock m0 => MonadClock (QuietT m0) 
Monad m => MonadScanner (QuietT m) 
MonadPrinter m0 => MonadPrinter (QuietT m0) 
MonadSpawn m0 => MonadSpawn (QuietT m0) 
ExtendedPrinter m0 => ExtendedPrinter (QuietT m0) 
MonadExpand m0 => MonadExpand (QuietT m0) 
ExpanderEnv m0 => ExpanderEnv (QuietT m0) 
HistoryEnv m0 => HistoryEnv (QuietT m0) 

newtype InRedirT m a Source

InRedirT redirects all input to a given handle (much like <filename in the shell)

Constructors

InRedir 

Fields

runInRedirT' :: Handle -> m (a, Handle)
 

type InRedir = InRedirT (HandleCloserT IO)Source

InRedirT on an IO monad

runInRedirT :: Functor m => InRedirT m a -> Handle -> m aSource

Run InRedirT with handle

runInRedir :: InRedir a -> Handle -> IO aSource

Run InRedir with handle

runInRedirFT :: (Functor m, MonadIO m, MonadFinalizer m) => InRedirT m a -> FilePath -> m aSource

Run InRedirT with a filename

runInRedirF :: InRedir a -> FilePath -> IO aSource

Run InRedir with a filename

mscanLn :: MonadScanner m => m StringSource

Line-scanning alternative to mscan1/L

mscanN :: MonadScanner m => Int -> m StringSource

Scan a fixed number of chars

data EmptyI Source

Redirection source that does not provide any output

Constructors

EmptyI 

class RedirectionSource t mt a r | t -> mt, t a -> r whereSource

Class for all primitive redirection sources.

Methods

(.<.) :: (MonadFinalizer m, Functor m, MonadIO m, MonadScanner (mt m)) => mt m a -> t -> m aSource

Redirection

class RedirectionHeredoc t mt a r | t -> mt, t a -> r whereSource

Class for all Here-Documents

Methods

(.<<.) :: (Functor m, MonadScanner (mt m)) => mt m a -> t -> m aSource

Redirection

Instances