sdp4text-0.2: SDP wrapper for Text.
Copyright(c) Andrey Mulik 2021
LicenseBSD-style
Maintainerwork.a.mulik@gmail.com
Portabilitynon-portable (requires non-portable module)
Safe HaskellSafe-Inferred
LanguageHaskell2010

SDP.Text.Builder

Description

SDP.Text.Builder provides sdp instances for text Builder.

Note that Builder is a service type for efficient Text creation which isn't intended for element-wise operations and content changes. Linear instance provided for convenience and many functions (folds, selections, etc.) creates intermediate structures (text, string, etc.).

Synopsis

Export

module SDP.Linear

Builder

data Builder #

A Builder is an efficient way to build lazy Text values. There are several functions for constructing builders, but only one to inspect them: to extract any data, you have to turn them into lazy Text values using toLazyText.

Internally, a builder constructs a lazy Text by filling arrays piece by piece. As each buffer is filled, it is 'popped' off, to become a new chunk of the resulting lazy Text. All this is hidden from the user of the Builder.

Instances

Instances details
Eq Builder 
Instance details

Defined in Data.Text.Internal.Builder

Methods

(==) :: Builder -> Builder -> Bool #

(/=) :: Builder -> Builder -> Bool #

Ord Builder 
Instance details

Defined in Data.Text.Internal.Builder

Show Builder 
Instance details

Defined in Data.Text.Internal.Builder

IsString Builder 
Instance details

Defined in Data.Text.Internal.Builder

Methods

fromString :: String -> Builder #

Semigroup Builder 
Instance details

Defined in Data.Text.Internal.Builder

Monoid Builder 
Instance details

Defined in Data.Text.Internal.Builder

Nullable Builder Source # 
Instance details

Defined in SDP.Text.Builder

Methods

lzero :: Builder #

isNull :: Builder -> Bool #

IsFile Builder Source # 
Instance details

Defined in SDP.Text.Builder

Methods

hGetContents :: MonadIO io => Handle -> io Builder #

hPutContents :: MonadIO io => Handle -> Builder -> io () #

IsTextFile Builder Source # 
Instance details

Defined in SDP.Text.Builder

Methods

hGetLine :: MonadIO io => Handle -> io Builder #

hPutStr :: MonadIO io => Handle -> Builder -> io () #

hPutStrLn :: MonadIO io => Handle -> Builder -> io () #

Linear Builder Char Source # 
Instance details

Defined in SDP.Text.Builder

Methods

uncons :: Builder -> (Char, Builder) #

uncons' :: Builder -> Maybe (Char, Builder) #

toHead :: Char -> Builder -> Builder #

head :: Builder -> Char #

tail :: Builder -> Builder #

unsnoc :: Builder -> (Builder, Char) #

unsnoc' :: Builder -> Maybe (Builder, Char) #

toLast :: Builder -> Char -> Builder #

init :: Builder -> Builder #

last :: Builder -> Char #

single :: Char -> Builder #

(++) :: Builder -> Builder -> Builder #

replicate :: Int -> Char -> Builder #

fromList :: [Char] -> Builder #

fromListN :: Int -> [Char] -> Builder #

listR :: Builder -> [Char] #

listL :: Builder -> [Char] #

fromFoldable :: Foldable f => f Char -> Builder #

(!^) :: Builder -> Int -> Char #

write :: Builder -> Int -> Char -> Builder #

concat :: Foldable f => f Builder -> Builder #

concatMap :: Foldable f => (a -> Builder) -> f a -> Builder #

intersperse :: Char -> Builder -> Builder #

filter :: (Char -> Bool) -> Builder -> Builder #

except :: (Char -> Bool) -> Builder -> Builder #

partition :: (Char -> Bool) -> Builder -> (Builder, Builder) #

partitions :: Foldable f => f (Char -> Bool) -> Builder -> [Builder] #

select :: (Char -> Maybe a) -> Builder -> [a] #

select' :: (t Char ~ Builder, Linear1 t a) => (Char -> Maybe a) -> Builder -> t a #

extract :: (Char -> Maybe a) -> Builder -> ([a], Builder) #

extract' :: (t Char ~ Builder, Linear1 t a) => (Char -> Maybe a) -> Builder -> (t a, Builder) #

selects :: Foldable f => f (Char -> Maybe a) -> Builder -> ([[a]], Builder) #

selects' :: (Foldable f, t Char ~ Builder, Linear1 t a) => f (Char -> Maybe a) -> Builder -> ([t a], Builder) #

isSubseqOf :: Builder -> Builder -> Bool #

reverse :: Builder -> Builder #

force :: Builder -> Builder #

subsequences :: Builder -> [Builder] #

iterate :: Int -> (Char -> Char) -> Char -> Builder #

nub :: Builder -> Builder #

nubBy :: Equal Char -> Builder -> Builder #

ofoldr :: (Int -> Char -> b -> b) -> b -> Builder -> b #

ofoldl :: (Int -> b -> Char -> b) -> b -> Builder -> b #

ofoldr' :: (Int -> Char -> b -> b) -> b -> Builder -> b #

ofoldl' :: (Int -> b -> Char -> b) -> b -> Builder -> b #

o_foldr :: (Char -> b -> b) -> b -> Builder -> b #

o_foldl :: (b -> Char -> b) -> b -> Builder -> b #

o_foldr' :: (Char -> b -> b) -> b -> Builder -> b #

o_foldl' :: (b -> Char -> b) -> b -> Builder -> b #

fromText :: Text -> Builder #

O(1). A Builder taking a Text, satisfying

toLazyText :: Builder -> Text #

O(n). Extract a lazy Text from a Builder with a default buffer size. The construction work takes place if and when the relevant part of the lazy Text is demanded.

fromLazyText :: Text -> Builder #

O(1). A Builder taking a lazy Text, satisfying

flush :: Builder #

O(1). Pop the strict Text we have constructed so far, if any, yielding a new chunk in the result lazy Text.

Orphan instances

Nullable Builder Source # 
Instance details

Methods

lzero :: Builder #

isNull :: Builder -> Bool #

IsFile Builder Source # 
Instance details

Methods

hGetContents :: MonadIO io => Handle -> io Builder #

hPutContents :: MonadIO io => Handle -> Builder -> io () #

IsTextFile Builder Source # 
Instance details

Methods

hGetLine :: MonadIO io => Handle -> io Builder #

hPutStr :: MonadIO io => Handle -> Builder -> io () #

hPutStrLn :: MonadIO io => Handle -> Builder -> io () #

Linear Builder Char Source # 
Instance details

Methods

uncons :: Builder -> (Char, Builder) #

uncons' :: Builder -> Maybe (Char, Builder) #

toHead :: Char -> Builder -> Builder #

head :: Builder -> Char #

tail :: Builder -> Builder #

unsnoc :: Builder -> (Builder, Char) #

unsnoc' :: Builder -> Maybe (Builder, Char) #

toLast :: Builder -> Char -> Builder #

init :: Builder -> Builder #

last :: Builder -> Char #

single :: Char -> Builder #

(++) :: Builder -> Builder -> Builder #

replicate :: Int -> Char -> Builder #

fromList :: [Char] -> Builder #

fromListN :: Int -> [Char] -> Builder #

listR :: Builder -> [Char] #

listL :: Builder -> [Char] #

fromFoldable :: Foldable f => f Char -> Builder #

(!^) :: Builder -> Int -> Char #

write :: Builder -> Int -> Char -> Builder #

concat :: Foldable f => f Builder -> Builder #

concatMap :: Foldable f => (a -> Builder) -> f a -> Builder #

intersperse :: Char -> Builder -> Builder #

filter :: (Char -> Bool) -> Builder -> Builder #

except :: (Char -> Bool) -> Builder -> Builder #

partition :: (Char -> Bool) -> Builder -> (Builder, Builder) #

partitions :: Foldable f => f (Char -> Bool) -> Builder -> [Builder] #

select :: (Char -> Maybe a) -> Builder -> [a] #

select' :: (t Char ~ Builder, Linear1 t a) => (Char -> Maybe a) -> Builder -> t a #

extract :: (Char -> Maybe a) -> Builder -> ([a], Builder) #

extract' :: (t Char ~ Builder, Linear1 t a) => (Char -> Maybe a) -> Builder -> (t a, Builder) #

selects :: Foldable f => f (Char -> Maybe a) -> Builder -> ([[a]], Builder) #

selects' :: (Foldable f, t Char ~ Builder, Linear1 t a) => f (Char -> Maybe a) -> Builder -> ([t a], Builder) #

isSubseqOf :: Builder -> Builder -> Bool #

reverse :: Builder -> Builder #

force :: Builder -> Builder #

subsequences :: Builder -> [Builder] #

iterate :: Int -> (Char -> Char) -> Char -> Builder #

nub :: Builder -> Builder #

nubBy :: Equal Char -> Builder -> Builder #

ofoldr :: (Int -> Char -> b -> b) -> b -> Builder -> b #

ofoldl :: (Int -> b -> Char -> b) -> b -> Builder -> b #

ofoldr' :: (Int -> Char -> b -> b) -> b -> Builder -> b #

ofoldl' :: (Int -> b -> Char -> b) -> b -> Builder -> b #

o_foldr :: (Char -> b -> b) -> b -> Builder -> b #

o_foldl :: (b -> Char -> b) -> b -> Builder -> b #

o_foldr' :: (Char -> b -> b) -> b -> Builder -> b #

o_foldl' :: (b -> Char -> b) -> b -> Builder -> b #