chatty-0.6: Some monad transformers and typeclasses for abstraction of global dependencies.

Safe HaskellSafe-Inferred

Text.Chatty.Scanner

Description

Provides a typeclass for all monads that may scan text.

Synopsis

Documentation

class Monad m => ChScanner 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, ChFinalizer m) => InRedirT m a -> FilePath -> m aSource

Run InRedirT with a filename

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

Run InRedir with a filename

mscanLn :: ChScanner m => m StringSource

Line-scanning alternative to mscan1/L

mscanN :: ChScanner 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

(.<.) :: (ChFinalizer m, Functor m, MonadIO m, ChScanner (mt m)) => mt m a -> t -> m rSource

Redirection

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

Class for all Here-Documents

Methods

(.<<.) :: (Functor m, ChScanner (mt m)) => mt m a -> t -> m rSource

Redirection