pipes-text-1.0.0: properly streaming text
Safe HaskellSafe-Inferred
LanguageHaskell2010

Pipes.Text

Description

The module Pipes.Text closely follows Pipes.ByteString from the pipes-bytestring package. A draft tutorial can be found in Pipes.Text.Tutorial.

Synopsis

Producers

fromLazy :: Monad m => Text -> Producer' Text m () Source #

Convert a lazy Text into a Producer of strict Texts. Producers in IO can be found in IO or in pipes-bytestring, employed with the decoding lenses in Encoding

Pipes

map :: Monad m => (Char -> Char) -> Pipe Text Text m r Source #

Apply a transformation to each Char in the stream

concatMap :: Monad m => (Char -> Text) -> Pipe Text Text m r Source #

Map a function over the characters of a text stream and concatenate the results

take :: (Monad m, Integral a) => a -> Pipe Text Text m () Source #

(take n) only allows n individual characters to pass; contrast Pipes.Prelude.take which would let n chunks pass.

takeWhile :: Monad m => (Char -> Bool) -> Pipe Text Text m () Source #

Take characters until they fail the predicate

filter :: Monad m => (Char -> Bool) -> Pipe Text Text m r Source #

Only allows Chars to pass if they satisfy the predicate

toCaseFold :: Monad m => Pipe Text Text m r Source #

toCaseFold, toLower, toUpper and stripStart are standard Text utilities, here acting as Text pipes, rather as they would on a lazy text

toLower :: Monad m => Pipe Text Text m r Source #

lowercase incoming Text

toUpper :: Monad m => Pipe Text Text m r Source #

uppercase incoming Text

stripStart :: Monad m => Pipe Text Text m r Source #

Remove leading white space from an incoming succession of Texts

scan :: Monad m => (Char -> Char -> Char) -> Char -> Pipe Text Text m r Source #

Strict left scan over the characters >>> let margaret = ["Margaret, are you grievingnOver Golde","ngrove unleaving?":: Text] >>> let title_caser a x = case a of ' ' -> Data.Char.toUpper x; _ -> x >>> toLazy $ each margaret >-> scan title_caser ' ' " Margaret, Are You GrievingnOver Goldengrove Unleaving?"

Folds

toLazy :: Producer Text Identity () -> Text Source #

Fold a pure Producer of strict Texts into a lazy Text

toLazyM :: Monad m => Producer Text m () -> m Text Source #

Fold an effectful Producer of strict Texts into a lazy Text

Note: toLazyM is not an idiomatic use of pipes, but I provide it for simple testing purposes. Idiomatic pipes style consumes the chunks immediately as they are generated instead of loading them all into memory.

foldChars :: Monad m => (x -> Char -> x) -> x -> (x -> r) -> Producer Text m () -> m r Source #

Reduce the text stream using a strict left fold over characters

head :: Monad m => Producer Text m () -> m (Maybe Char) Source #

Retrieve the first Char

last :: Monad m => Producer Text m () -> m (Maybe Char) Source #

Retrieve the last Char

null :: Monad m => Producer Text m () -> m Bool Source #

Determine if the stream is empty

length :: (Monad m, Num n) => Producer Text m () -> m n Source #

Count the number of characters in the stream

any :: Monad m => (Char -> Bool) -> Producer Text m () -> m Bool Source #

Fold that returns whether Any received Chars satisfy the predicate

all :: Monad m => (Char -> Bool) -> Producer Text m () -> m Bool Source #

Fold that returns whether All received Chars satisfy the predicate

maximum :: Monad m => Producer Text m () -> m (Maybe Char) Source #

Return the maximum Char within a text stream

minimum :: Monad m => Producer Text m () -> m (Maybe Char) Source #

Return the minimum Char within a text stream (surely very useful!)

find :: Monad m => (Char -> Bool) -> Producer Text m () -> m (Maybe Char) Source #

Find the first element in the stream that matches the predicate

index :: (Monad m, Integral a) => a -> Producer Text m () -> m (Maybe Char) Source #

Index into a text stream

Primitive Character Parsers

nextChar :: Monad m => Producer Text m r -> m (Either r (Char, Producer Text m r)) Source #

Consume the first character from a stream of Text

next either fails with a Left if the Producer has no more characters or succeeds with a Right providing the next character and the remainder of the Producer.

drawChar :: Monad m => Parser Text m (Maybe Char) Source #

Draw one Char from a stream of Text, returning Left if the Producer is empty

unDrawChar :: Monad m => Char -> Parser Text m () Source #

Push back a Char onto the underlying Producer

peekChar :: Monad m => Parser Text m (Maybe Char) Source #

peekChar checks the first Char in the stream, but uses unDrawChar to push the Char back

peekChar = do
    x <- drawChar
    case x of
        Left  _  -> return ()
        Right c -> unDrawChar c
    return x

isEndOfChars :: Monad m => Parser Text m Bool Source #

Check if the underlying Producer has no more characters

Note that this will skip over empty Text chunks, unlike isEndOfInput from pipes-parse, which would consider an empty Text a valid bit of input.

isEndOfChars = liftM isLeft peekChar

Parsing Lenses

splitAt :: (Monad m, Integral n) => n -> Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Splits a Producer after the given number of characters

span :: Monad m => (Char -> Bool) -> Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Split a text stream in two, producing the longest consecutive group of characters that satisfies the predicate and returning the rest

break :: Monad m => (Char -> Bool) -> Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Split a text stream in two, producing the longest consecutive group of characters that don't satisfy the predicate

groupBy :: Monad m => (Char -> Char -> Bool) -> Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Improper lens that splits after the first group of equivalent Chars, as defined by the given equivalence relation

group :: Monad m => Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Improper lens that splits after the first succession of identical Char s

word :: Monad m => Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Improper lens that splits a Producer after the first word

Unlike words, this does not drop leading whitespace

line :: Monad m => Lens' (Producer Text m r) (Producer Text m (Producer Text m r)) Source #

Transforming Text and Character Streams

drop :: (Monad m, Integral n) => n -> Producer Text m r -> Producer Text m r Source #

(drop n) drops the first n characters

dropWhile :: Monad m => (Char -> Bool) -> Producer Text m r -> Producer Text m r Source #

Drop characters until they fail the predicate

pack :: Monad m => Lens' (Producer Char m r) (Producer Text m r) Source #

Improper lens from unpacked Word8s to packaged ByteStrings

unpack :: Monad m => Lens' (Producer Text m r) (Producer Char m r) Source #

Improper lens from packed ByteStrings to unpacked Word8s

intersperse :: Monad m => Char -> Producer Text m r -> Producer Text m r Source #

Intersperse a Char in between the characters of stream of Text

FreeT Transformations

chunksOf :: (Monad m, Integral n) => n -> Lens' (Producer Text m r) (FreeT (Producer Text m) m r) Source #

Split a text stream into FreeT-delimited text streams of fixed size

splitsWith :: Monad m => (Char -> Bool) -> Producer Text m r -> FreeT (Producer Text m) m r Source #

Split a text stream into sub-streams delimited by characters that satisfy the predicate

splits :: Monad m => Char -> Lens' (Producer Text m r) (FreeT (Producer Text m) m r) Source #

Split a text stream using the given Char as the delimiter

groupsBy :: Monad m => (Char -> Char -> Bool) -> Lens' (Producer Text m x) (FreeT (Producer Text m) m x) Source #

Isomorphism between a stream of Text and groups of equivalent Chars , using the given equivalence relation

groups :: Monad m => Lens' (Producer Text m x) (FreeT (Producer Text m) m x) Source #

Like groupsBy, where the equality predicate is (==)

lines :: Monad m => Lens' (Producer Text m r) (FreeT (Producer Text m) m r) Source #

Split a text stream into FreeT-delimited lines

unlines :: Monad m => Lens' (FreeT (Producer Text m) m r) (Producer Text m r) Source #

words :: Monad m => Lens' (Producer Text m r) (FreeT (Producer Text m) m r) Source #

Split a text stream into FreeT-delimited words. Note that roundtripping with e.g. over words id eliminates extra space characters as with Prelude.unwords . Prelude.words

unwords :: Monad m => Lens' (FreeT (Producer Text m) m r) (Producer Text m r) Source #

intercalate :: Monad m => Producer Text m () -> FreeT (Producer Text m) m r -> Producer Text m r Source #

intercalate concatenates the FreeT-delimited text streams after interspersing a text stream in between them

Re-exports

Data.Text re-exports the Text type.

Pipes.Parse re-exports input, concat, FreeT (the type) and the Parse synonym.

data ByteString #

A space-efficient representation of a Word8 vector, supporting many efficient operations.

A ByteString contains 8-bit bytes, or by using the operations from Data.ByteString.Char8 it can be interpreted as containing 8-bit characters.

Instances

Instances details
Eq ByteString 
Instance details

Defined in Data.ByteString.Internal

Data ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ByteString -> c ByteString #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ByteString #

toConstr :: ByteString -> Constr #

dataTypeOf :: ByteString -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ByteString) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ByteString) #

gmapT :: (forall b. Data b => b -> b) -> ByteString -> ByteString #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ByteString -> r #

gmapQ :: (forall d. Data d => d -> u) -> ByteString -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ByteString -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ByteString -> m ByteString #

Ord ByteString 
Instance details

Defined in Data.ByteString.Internal

Read ByteString 
Instance details

Defined in Data.ByteString.Internal

Show ByteString 
Instance details

Defined in Data.ByteString.Internal

IsString ByteString 
Instance details

Defined in Data.ByteString.Internal

Semigroup ByteString 
Instance details

Defined in Data.ByteString.Internal

Monoid ByteString 
Instance details

Defined in Data.ByteString.Internal

NFData ByteString 
Instance details

Defined in Data.ByteString.Internal

Methods

rnf :: ByteString -> () #

Hashable ByteString 
Instance details

Defined in Data.Hashable.Class

data Text #

A space efficient, packed, unboxed Unicode text type.

Instances

Instances details
Hashable Text 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSalt :: Int -> Text -> Int #

hash :: Text -> Int #

type Item Text 
Instance details

Defined in Data.Text

type Item Text = Char

type Parser a (m :: Type -> Type) r = forall x. StateT (Producer a m x) m r #

A Parser is an action that reads from and writes to a stored Producer

data FreeF (f :: Type -> Type) a b #

The base functor for a free monad.

Constructors

Pure a 
Free (f b) 

Instances

Instances details
Traversable f => Bitraversable (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

bitraverse :: Applicative f0 => (a -> f0 c) -> (b -> f0 d) -> FreeF f a b -> f0 (FreeF f c d) #

Foldable f => Bifoldable (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

bifold :: Monoid m => FreeF f m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> FreeF f a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> FreeF f a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> FreeF f a b -> c #

Functor f => Bifunctor (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

bimap :: (a -> b) -> (c -> d) -> FreeF f a c -> FreeF f b d #

first :: (a -> b) -> FreeF f a c -> FreeF f b c #

second :: (b -> c) -> FreeF f a b -> FreeF f a c #

Eq1 f => Eq2 (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> FreeF f a c -> FreeF f b d -> Bool #

Ord1 f => Ord2 (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> FreeF f a c -> FreeF f b d -> Ordering #

Read1 f => Read2 (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (FreeF f a b) #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [FreeF f a b] #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (FreeF f a b) #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [FreeF f a b] #

Show1 f => Show2 (FreeF f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> FreeF f a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [FreeF f a b] -> ShowS #

Generic1 (FreeF f a :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Free

Associated Types

type Rep1 (FreeF f a) :: k -> Type #

Methods

from1 :: forall (a0 :: k). FreeF f a a0 -> Rep1 (FreeF f a) a0 #

to1 :: forall (a0 :: k). Rep1 (FreeF f a) a0 -> FreeF f a a0 #

Functor f => Functor (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

fmap :: (a0 -> b) -> FreeF f a a0 -> FreeF f a b #

(<$) :: a0 -> FreeF f a b -> FreeF f a a0 #

Foldable f => Foldable (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

fold :: Monoid m => FreeF f a m -> m #

foldMap :: Monoid m => (a0 -> m) -> FreeF f a a0 -> m #

foldMap' :: Monoid m => (a0 -> m) -> FreeF f a a0 -> m #

foldr :: (a0 -> b -> b) -> b -> FreeF f a a0 -> b #

foldr' :: (a0 -> b -> b) -> b -> FreeF f a a0 -> b #

foldl :: (b -> a0 -> b) -> b -> FreeF f a a0 -> b #

foldl' :: (b -> a0 -> b) -> b -> FreeF f a a0 -> b #

foldr1 :: (a0 -> a0 -> a0) -> FreeF f a a0 -> a0 #

foldl1 :: (a0 -> a0 -> a0) -> FreeF f a a0 -> a0 #

toList :: FreeF f a a0 -> [a0] #

null :: FreeF f a a0 -> Bool #

length :: FreeF f a a0 -> Int #

elem :: Eq a0 => a0 -> FreeF f a a0 -> Bool #

maximum :: Ord a0 => FreeF f a a0 -> a0 #

minimum :: Ord a0 => FreeF f a a0 -> a0 #

sum :: Num a0 => FreeF f a a0 -> a0 #

product :: Num a0 => FreeF f a a0 -> a0 #

Traversable f => Traversable (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

traverse :: Applicative f0 => (a0 -> f0 b) -> FreeF f a a0 -> f0 (FreeF f a b) #

sequenceA :: Applicative f0 => FreeF f a (f0 a0) -> f0 (FreeF f a a0) #

mapM :: Monad m => (a0 -> m b) -> FreeF f a a0 -> m (FreeF f a b) #

sequence :: Monad m => FreeF f a (m a0) -> m (FreeF f a a0) #

(Eq1 f, Eq a) => Eq1 (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftEq :: (a0 -> b -> Bool) -> FreeF f a a0 -> FreeF f a b -> Bool #

(Ord1 f, Ord a) => Ord1 (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftCompare :: (a0 -> b -> Ordering) -> FreeF f a a0 -> FreeF f a b -> Ordering #

(Read1 f, Read a) => Read1 (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftReadsPrec :: (Int -> ReadS a0) -> ReadS [a0] -> Int -> ReadS (FreeF f a a0) #

liftReadList :: (Int -> ReadS a0) -> ReadS [a0] -> ReadS [FreeF f a a0] #

liftReadPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec (FreeF f a a0) #

liftReadListPrec :: ReadPrec a0 -> ReadPrec [a0] -> ReadPrec [FreeF f a a0] #

(Show1 f, Show a) => Show1 (FreeF f a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftShowsPrec :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> Int -> FreeF f a a0 -> ShowS #

liftShowList :: (Int -> a0 -> ShowS) -> ([a0] -> ShowS) -> [FreeF f a a0] -> ShowS #

(Eq a, Eq (f b)) => Eq (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(==) :: FreeF f a b -> FreeF f a b -> Bool #

(/=) :: FreeF f a b -> FreeF f a b -> Bool #

(Ord a, Ord (f b)) => Ord (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

compare :: FreeF f a b -> FreeF f a b -> Ordering #

(<) :: FreeF f a b -> FreeF f a b -> Bool #

(<=) :: FreeF f a b -> FreeF f a b -> Bool #

(>) :: FreeF f a b -> FreeF f a b -> Bool #

(>=) :: FreeF f a b -> FreeF f a b -> Bool #

max :: FreeF f a b -> FreeF f a b -> FreeF f a b #

min :: FreeF f a b -> FreeF f a b -> FreeF f a b #

(Read a, Read (f b)) => Read (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

readsPrec :: Int -> ReadS (FreeF f a b) #

readList :: ReadS [FreeF f a b] #

readPrec :: ReadPrec (FreeF f a b) #

readListPrec :: ReadPrec [FreeF f a b] #

(Show a, Show (f b)) => Show (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

showsPrec :: Int -> FreeF f a b -> ShowS #

show :: FreeF f a b -> String #

showList :: [FreeF f a b] -> ShowS #

Generic (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

Associated Types

type Rep (FreeF f a b) :: Type -> Type #

Methods

from :: FreeF f a b -> Rep (FreeF f a b) x #

to :: Rep (FreeF f a b) x -> FreeF f a b #

type Rep1 (FreeF f a :: Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Free

type Rep1 (FreeF f a :: Type -> Type) = D1 ('MetaData "FreeF" "Control.Monad.Trans.Free" "free-5.1.4-KZMakTlalxeJUVsOBweZX3" 'False) (C1 ('MetaCons "Pure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Free" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 f)))
type Rep (FreeF f a b) 
Instance details

Defined in Control.Monad.Trans.Free

type Rep (FreeF f a b) = D1 ('MetaData "FreeF" "Control.Monad.Trans.Free" "free-5.1.4-KZMakTlalxeJUVsOBweZX3" 'False) (C1 ('MetaCons "Pure" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a)) :+: C1 ('MetaCons "Free" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (f b))))

newtype FreeT (f :: Type -> Type) (m :: Type -> Type) a #

The "free monad transformer" for a functor f

Constructors

FreeT 

Fields

Instances

Instances details
(Functor f, Monad m) => MonadFree f (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

wrap :: f (FreeT f m a) -> FreeT f m a #

(Functor f, MonadBase b m) => MonadBase b (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftBase :: b α -> FreeT f m α #

(Functor f, MonadWriter w m) => MonadWriter w (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

writer :: (a, w) -> FreeT f m a #

tell :: w -> FreeT f m () #

listen :: FreeT f m a -> FreeT f m (a, w) #

pass :: FreeT f m (a, w -> w) -> FreeT f m a #

(Functor f, MonadState s m) => MonadState s (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

get :: FreeT f m s #

put :: s -> FreeT f m () #

state :: (s -> (a, s)) -> FreeT f m a #

(Functor f, MonadReader r m) => MonadReader r (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

ask :: FreeT f m r #

local :: (r -> r) -> FreeT f m a -> FreeT f m a #

reader :: (r -> a) -> FreeT f m a #

(Functor f, MonadError e m) => MonadError e (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

throwError :: e -> FreeT f m a #

catchError :: FreeT f m a -> (e -> FreeT f m a) -> FreeT f m a #

MonadTrans (FreeT f) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

lift :: Monad m => m a -> FreeT f m a #

(Functor f, Monad m) => Monad (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(>>=) :: FreeT f m a -> (a -> FreeT f m b) -> FreeT f m b #

(>>) :: FreeT f m a -> FreeT f m b -> FreeT f m b #

return :: a -> FreeT f m a #

(Functor f, Monad m) => Functor (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

fmap :: (a -> b) -> FreeT f m a -> FreeT f m b #

(<$) :: a -> FreeT f m b -> FreeT f m a #

(Functor f, MonadFail m) => MonadFail (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

fail :: String -> FreeT f m a #

(Functor f, Monad m) => Applicative (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

pure :: a -> FreeT f m a #

(<*>) :: FreeT f m (a -> b) -> FreeT f m a -> FreeT f m b #

liftA2 :: (a -> b -> c) -> FreeT f m a -> FreeT f m b -> FreeT f m c #

(*>) :: FreeT f m a -> FreeT f m b -> FreeT f m b #

(<*) :: FreeT f m a -> FreeT f m b -> FreeT f m a #

(Foldable m, Foldable f) => Foldable (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

fold :: Monoid m0 => FreeT f m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> FreeT f m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> FreeT f m a -> m0 #

foldr :: (a -> b -> b) -> b -> FreeT f m a -> b #

foldr' :: (a -> b -> b) -> b -> FreeT f m a -> b #

foldl :: (b -> a -> b) -> b -> FreeT f m a -> b #

foldl' :: (b -> a -> b) -> b -> FreeT f m a -> b #

foldr1 :: (a -> a -> a) -> FreeT f m a -> a #

foldl1 :: (a -> a -> a) -> FreeT f m a -> a #

toList :: FreeT f m a -> [a] #

null :: FreeT f m a -> Bool #

length :: FreeT f m a -> Int #

elem :: Eq a => a -> FreeT f m a -> Bool #

maximum :: Ord a => FreeT f m a -> a #

minimum :: Ord a => FreeT f m a -> a #

sum :: Num a => FreeT f m a -> a #

product :: Num a => FreeT f m a -> a #

(Monad m, Traversable m, Traversable f) => Traversable (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

traverse :: Applicative f0 => (a -> f0 b) -> FreeT f m a -> f0 (FreeT f m b) #

sequenceA :: Applicative f0 => FreeT f m (f0 a) -> f0 (FreeT f m a) #

mapM :: Monad m0 => (a -> m0 b) -> FreeT f m a -> m0 (FreeT f m b) #

sequence :: Monad m0 => FreeT f m (m0 a) -> m0 (FreeT f m a) #

(Eq1 f, Eq1 m) => Eq1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftEq :: (a -> b -> Bool) -> FreeT f m a -> FreeT f m b -> Bool #

(Ord1 f, Ord1 m) => Ord1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftCompare :: (a -> b -> Ordering) -> FreeT f m a -> FreeT f m b -> Ordering #

(Read1 f, Read1 m) => Read1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (FreeT f m a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [FreeT f m a] #

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (FreeT f m a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [FreeT f m a] #

(Show1 f, Show1 m) => Show1 (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> FreeT f m a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [FreeT f m a] -> ShowS #

(Functor f, MonadIO m) => MonadIO (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

liftIO :: IO a -> FreeT f m a #

(Functor f, MonadPlus m) => Alternative (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

empty :: FreeT f m a #

(<|>) :: FreeT f m a -> FreeT f m a -> FreeT f m a #

some :: FreeT f m a -> FreeT f m [a] #

many :: FreeT f m a -> FreeT f m [a] #

(Functor f, MonadPlus m) => MonadPlus (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

mzero :: FreeT f m a #

mplus :: FreeT f m a -> FreeT f m a -> FreeT f m a #

(Functor f, MonadThrow m) => MonadThrow (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

throwM :: Exception e => e -> FreeT f m a #

(Functor f, MonadCatch m) => MonadCatch (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

catch :: Exception e => FreeT f m a -> (e -> FreeT f m a) -> FreeT f m a #

(Functor f, MonadCont m) => MonadCont (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

callCC :: ((a -> FreeT f m b) -> FreeT f m a) -> FreeT f m a #

(Functor f, Monad m) => Apply (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(<.>) :: FreeT f m (a -> b) -> FreeT f m a -> FreeT f m b #

(.>) :: FreeT f m a -> FreeT f m b -> FreeT f m b #

(<.) :: FreeT f m a -> FreeT f m b -> FreeT f m a #

liftF2 :: (a -> b -> c) -> FreeT f m a -> FreeT f m b -> FreeT f m c #

(Functor f, Monad m) => Bind (FreeT f m) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(>>-) :: FreeT f m a -> (a -> FreeT f m b) -> FreeT f m b #

join :: FreeT f m (FreeT f m a) -> FreeT f m a #

(Eq1 f, Eq1 m, Eq a) => Eq (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

(==) :: FreeT f m a -> FreeT f m a -> Bool #

(/=) :: FreeT f m a -> FreeT f m a -> Bool #

(Ord1 f, Ord1 m, Ord a) => Ord (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

compare :: FreeT f m a -> FreeT f m a -> Ordering #

(<) :: FreeT f m a -> FreeT f m a -> Bool #

(<=) :: FreeT f m a -> FreeT f m a -> Bool #

(>) :: FreeT f m a -> FreeT f m a -> Bool #

(>=) :: FreeT f m a -> FreeT f m a -> Bool #

max :: FreeT f m a -> FreeT f m a -> FreeT f m a #

min :: FreeT f m a -> FreeT f m a -> FreeT f m a #

(Read1 f, Read1 m, Read a) => Read (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

readsPrec :: Int -> ReadS (FreeT f m a) #

readList :: ReadS [FreeT f m a] #

readPrec :: ReadPrec (FreeT f m a) #

readListPrec :: ReadPrec [FreeT f m a] #

(Show1 f, Show1 m, Show a) => Show (FreeT f m a) 
Instance details

Defined in Control.Monad.Trans.Free

Methods

showsPrec :: Int -> FreeT f m a -> ShowS #

show :: FreeT f m a -> String #

showList :: [FreeT f m a] -> ShowS #

concats :: forall (m :: Type -> Type) a x. Monad m => FreeT (Producer a m) m x -> Producer a m x #

Join a FreeT-delimited stream of Producers into a single Producer

concats :: Monad m => Joiner a m x

intercalates :: forall (m :: Type -> Type) a x. Monad m => Producer a m () -> FreeT (Producer a m) m x -> Producer a m x #

Join a FreeT-delimited stream of Producers into a single Producer by intercalating a Producer in between them

intercalates :: Monad m => Producer a m () -> Joiner a m x

folds #

Arguments

:: forall (m :: Type -> Type) x a b r. Monad m 
=> (x -> a -> x)

Step function

-> x

Initial accumulator

-> (x -> b)

Extraction function

-> FreeT (Producer a m) m r 
-> Producer b m r 

Fold each Producer of a FreeT

purely folds :: Monad m => Fold a b -> Groups a m r -> Producer b m r

maps :: forall (m :: Type -> Type) g f x. (Monad m, Functor g) => (forall r. f r -> g r) -> FreeT f m x -> FreeT g m x #

Transform each individual functor layer of a FreeT

You can think of this as:

maps
    :: (forall r . Producer a m r -> Producer b m r)
    -> FreeT (Producer a m) m x -> FreeT (Producer b m) m x

This is just a synonym for transFreeT