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

Safe HaskellSafe
LanguageHaskell2010

Text.Chatty.Scanner

Description

Provides a typeclass for all monads that may scan text.

Synopsis

Documentation

class Monad m => ChScanner m where Source

A typeclass for all monads that may read input.

Minimal complete definition

mscan1, mscanL, mscannable, mready

Methods

mscan1 :: m Char Source

Read one single character

mscanL :: m String Source

Lazily read all the input.

mscannable :: m Bool Source

Input readable? (not EOF)

mscanh :: m (Maybe Handle) Source

Return FD handle, if available

mready :: m Bool Source

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 a Source

Run InRedirT with handle

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

Run InRedir with handle

runInRedirFT :: (Functor m, MonadIO m, ChFinalizer m) => InRedirT m a -> FilePath -> m a Source

Run InRedirT with a filename

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

Run InRedir with a filename

mscanLn :: ChScanner m => m String Source

Line-scanning alternative to mscan1/L

mscanN :: ChScanner m => Int -> m String Source

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 where Source

Class for all primitive redirection sources.

Methods

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

Redirection

class RedirectionHeredoc t mt a r | t -> mt, t a -> r where Source

Class for all Here-Documents

Methods

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

Redirection