chatty-0.5.4.0: 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 QuietT m a Source

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

Constructors

Quiet 

Fields

runQuietT :: m a
 

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