{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Text.Lazy.Sized
(
SizedText,
SizedLazyText,
pack,
unpack,
singleton,
fromChunks,
toChunks,
toStrict,
fromStrict,
cons,
snoc,
uncons,
unsnoc,
head,
last,
tail,
init,
length,
compareLength,
map,
intercalate,
intersperse,
transpose,
reverse,
replace,
toCaseFold,
toLower,
toUpper,
toTitle,
justifyLeft,
justifyRight,
center,
foldl,
foldl',
foldl1,
foldl1',
foldr,
foldr1,
concat,
concatMap,
any,
all,
maximum,
minimum,
scanl,
scanl1,
scanr,
scanr1,
mapAccumL,
mapAccumR,
replicate,
cycle,
iterate,
take,
takeEnd,
drop,
dropEnd,
takeWhile,
takeWhileEnd,
dropWhile,
dropWhileEnd,
dropAround,
strip,
stripStart,
stripEnd,
splitAt,
breakOn,
breakOnEnd,
break,
span,
group,
groupBy,
inits,
tails,
splitOn,
split,
chunksOf,
lines,
words,
unlines,
unwords,
isPrefixOf,
isSuffixOf,
isInfixOf,
stripPrefix,
stripSuffix,
commonPrefixes,
filter,
breakOnAll,
find,
#if MIN_VERSION_text(1,2,5)
elem,
#endif
partition,
index,
count,
zip,
zipWith,
)
where
import Data.Bifunctor(bimap, first)
import Data.Proxy
import Data.Int (Int64)
import Data.Sized
import qualified Data.Text.Lazy as T
import Data.Text.Sized (SizedStrictText)
import GHC.Stack
import GHC.TypeNats
import Prelude (Bool (..), Char, Maybe (..), Ordering, String, fmap, fst, snd, uncurry, ($), (.), fromInteger, fromIntegral)
import GHC.Natural (naturalToInteger)
type SizedLazyText s = Sized s T.Text
type SizedText s = SizedLazyText s
instance SizedSingleton T.Text where
type SizedSingletonElement T.Text = Char
sizedSingleton :: Proxy Text -> SizedSingletonElement Text -> Text
sizedSingleton Proxy Text
_ = Char -> Text
SizedSingletonElement Text -> Text
T.singleton
instance SizedFromContainer T.Text where
calculateSize :: Text -> Int
calculateSize = Int64 -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int64 -> Int) -> (Text -> Int64) -> Text -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Int64
T.length
pack :: Sized s String -> SizedLazyText s
pack :: Sized s String -> SizedLazyText s
pack = (String -> Text) -> Sized s String -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized String -> Text
T.pack
{-# INLINE pack #-}
unpack :: HasCallStack => SizedLazyText s -> Sized s String
unpack :: SizedLazyText s -> Sized s String
unpack = (Text -> String) -> SizedLazyText s -> Sized s String
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> String
T.unpack
{-# INLINE unpack #-}
fromChunks :: Sized s [SizedStrictText s'] -> SizedLazyText (s <*> s')
fromChunks :: Sized s [SizedStrictText s'] -> SizedLazyText (s <*> s')
fromChunks = ([SizedStrictText s'] -> Text)
-> Sized s [SizedStrictText s'] -> SizedLazyText (s <*> s')
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized (([SizedStrictText s'] -> Text)
-> Sized s [SizedStrictText s'] -> SizedLazyText (s <*> s'))
-> ([SizedStrictText s'] -> Text)
-> Sized s [SizedStrictText s']
-> SizedLazyText (s <*> s')
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.fromChunks ([Text] -> Text)
-> ([SizedStrictText s'] -> [Text]) -> [SizedStrictText s'] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizedStrictText s' -> Text) -> [SizedStrictText s'] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SizedStrictText s' -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE fromChunks #-}
toChunks :: SizedLazyText s -> Sized (RestrictAtMost s) [SizedStrictText (RestrictAtMost s)]
toChunks :: SizedLazyText s
-> Sized (RestrictAtMost s) [SizedStrictText (RestrictAtMost s)]
toChunks = (Text -> [SizedStrictText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedStrictText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedStrictText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedStrictText (RestrictAtMost s)])
-> (Text -> [SizedStrictText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedStrictText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedStrictText (RestrictAtMost s))
-> [Text] -> [SizedStrictText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedStrictText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedStrictText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedStrictText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.toChunks
{-# INLINE toChunks #-}
toStrict :: SizedLazyText s -> SizedStrictText s
toStrict :: SizedLazyText s -> SizedStrictText s
toStrict = (Text -> Text) -> SizedLazyText s -> SizedStrictText s
forall a b s. (a -> b) -> Sized s a -> Sized s b
overSized Text -> Text
T.toStrict
{-# INLINE toStrict #-}
fromStrict :: SizedStrictText s -> SizedLazyText s
fromStrict :: SizedStrictText s -> SizedLazyText s
fromStrict = (Text -> Text) -> SizedStrictText s -> SizedLazyText s
forall a b s. (a -> b) -> Sized s a -> Sized s b
overSized Text -> Text
T.fromStrict
{-# INLINE fromStrict #-}
cons :: Char -> SizedLazyText s -> SizedLazyText (Exactly 1 <+> s)
cons :: Char -> SizedLazyText s -> SizedLazyText (Exactly 1 <+> s)
cons Char
c = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (Exactly 1 <+> s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (Exactly 1 <+> s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (Exactly 1 <+> s)
forall a b. (a -> b) -> a -> b
$ Char -> Text -> Text
T.cons Char
c
{-# INLINE cons #-}
infixr 5 `cons`
snoc :: SizedLazyText s -> Char -> SizedLazyText (s <+> Exactly 1)
snoc :: SizedLazyText s -> Char -> SizedLazyText (s <+> Exactly 1)
snoc SizedLazyText s
t Char
c = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <+> Exactly 1)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized (Text -> Char -> Text
`T.snoc` Char
c) SizedLazyText s
t
{-# INLINE snoc #-}
head :: IsNotEmpty s => SizedLazyText s -> Char
head :: SizedLazyText s -> Char
head = (Char, SizedLazyText (Exactly 1 <+> s)) -> Char
forall a b. (a, b) -> a
fst ((Char, SizedLazyText (Exactly 1 <+> s)) -> Char)
-> (SizedLazyText s -> (Char, SizedLazyText (Exactly 1 <+> s)))
-> SizedLazyText s
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (Char, SizedLazyText (Exactly 1 <+> s))
forall s s'.
(IsNotEmpty s, (Exactly 1 <+> s) ~ s') =>
SizedLazyText s -> (Char, SizedLazyText s')
uncons
{-# INLINE head #-}
uncons :: (IsNotEmpty s, (Exactly 1 <+> s) ~ s') => SizedLazyText s -> (Char, SizedLazyText s')
uncons :: SizedLazyText s -> (Char, SizedLazyText s')
uncons = (Text -> SizedLazyText s')
-> (Char, Text) -> (Char, SizedLazyText s')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText s'
forall a s. a -> Sized s a
trustedSized ((Char, Text) -> (Char, SizedLazyText s'))
-> (SizedLazyText s -> (Char, Text))
-> SizedLazyText s
-> (Char, SizedLazyText s')
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> Maybe (Char, Text)) -> SizedLazyText s -> (Char, Text)
forall a b s. (a -> Maybe b) -> Sized s a -> b
withSized Text -> Maybe (Char, Text)
T.uncons
{-# INLINE uncons #-}
last :: (IsNotEmpty s, (Exactly 1 <+> s) ~ s') => SizedLazyText s -> Char
last :: SizedLazyText s -> Char
last = (SizedLazyText (s <+> Exactly 1), Char) -> Char
forall a b. (a, b) -> b
snd ((SizedLazyText (s <+> Exactly 1), Char) -> Char)
-> (SizedLazyText s -> (SizedLazyText (s <+> Exactly 1), Char))
-> SizedLazyText s
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (SizedLazyText (s <+> Exactly 1), Char)
forall s s'.
(IsNotEmpty s, (s <+> Exactly 1) ~ s') =>
SizedLazyText s -> (SizedLazyText s', Char)
unsnoc
{-# INLINE last #-}
tail :: (IsNotEmpty s, (Exactly 1 <+> s) ~ s') => SizedLazyText s -> SizedLazyText s'
tail :: SizedLazyText s -> SizedLazyText s'
tail = (Char, SizedLazyText s') -> SizedLazyText s'
forall a b. (a, b) -> b
snd ((Char, SizedLazyText s') -> SizedLazyText s')
-> (SizedLazyText s -> (Char, SizedLazyText s'))
-> SizedLazyText s
-> SizedLazyText s'
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (Char, SizedLazyText s')
forall s s'.
(IsNotEmpty s, (Exactly 1 <+> s) ~ s') =>
SizedLazyText s -> (Char, SizedLazyText s')
uncons
{-# INLINE tail #-}
init :: (IsNotEmpty s, (s <+> Exactly 1) ~ s') => SizedLazyText s -> SizedLazyText s'
init :: SizedLazyText s -> SizedLazyText s'
init = (SizedLazyText s', Char) -> SizedLazyText s'
forall a b. (a, b) -> a
fst ((SizedLazyText s', Char) -> SizedLazyText s')
-> (SizedLazyText s -> (SizedLazyText s', Char))
-> SizedLazyText s
-> SizedLazyText s'
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (SizedLazyText s', Char)
forall s s'.
(IsNotEmpty s, (s <+> Exactly 1) ~ s') =>
SizedLazyText s -> (SizedLazyText s', Char)
unsnoc
{-# INLINE init #-}
unsnoc :: (IsNotEmpty s, (s <+> Exactly 1) ~ s') => SizedLazyText s -> (SizedLazyText s', Char)
unsnoc :: SizedLazyText s -> (SizedLazyText s', Char)
unsnoc = (Text -> SizedLazyText s')
-> (Text, Char) -> (SizedLazyText s', Char)
forall (p :: * -> * -> *) a b c.
Bifunctor p =>
(a -> b) -> p a c -> p b c
first Text -> SizedLazyText s'
forall a s. a -> Sized s a
trustedSized ((Text, Char) -> (SizedLazyText s', Char))
-> (SizedLazyText s -> (Text, Char))
-> SizedLazyText s
-> (SizedLazyText s', Char)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Text -> Maybe (Text, Char)) -> SizedLazyText s -> (Text, Char)
forall a b s. (a -> Maybe b) -> Sized s a -> b
withSized Text -> Maybe (Text, Char)
T.unsnoc
{-# INLINE unsnoc #-}
length :: SizedLazyText s -> Int64
length :: SizedLazyText s -> Int64
length = Text -> Int64
T.length (Text -> Int64)
-> (SizedLazyText s -> Text) -> SizedLazyText s -> Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE length #-}
compareLength :: (KnownNat n, Includes s n) => SizedLazyText s -> Proxy n -> Ordering
compareLength :: SizedLazyText s -> Proxy n -> Ordering
compareLength SizedLazyText s
x = Text -> Int64 -> Ordering
T.compareLength (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (Int64 -> Ordering) -> (Proxy n -> Int64) -> Proxy n -> Ordering
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN
{-# INLINE compareLength #-}
map :: (Char -> Char) -> SizedLazyText s -> SizedLazyText s
map :: (Char -> Char) -> SizedLazyText s -> SizedLazyText s
map Char -> Char
f = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText s)
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b. (a -> b) -> a -> b
$ (Char -> Char) -> Text -> Text
T.map Char -> Char
f
{-# INLINE map #-}
intercalate :: T.Text -> Sized s [SizedLazyText s'] -> SizedLazyText (s <*> s')
intercalate :: Text -> Sized s [SizedLazyText s'] -> SizedLazyText (s <*> s')
intercalate Text
e = Text -> SizedLazyText (s <*> s')
forall a s. a -> Sized s a
trustedSized (Text -> SizedLazyText (s <*> s'))
-> (Sized s [SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> s')
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text] -> Text
T.intercalate Text
e ([Text] -> Text)
-> (Sized s [SizedLazyText s'] -> [Text])
-> Sized s [SizedLazyText s']
-> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizedLazyText s' -> Text) -> [SizedLazyText s'] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized ([SizedLazyText s'] -> [Text])
-> (Sized s [SizedLazyText s'] -> [SizedLazyText s'])
-> Sized s [SizedLazyText s']
-> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Sized s [SizedLazyText s'] -> [SizedLazyText s']
forall s a. Sized s a -> a
getSized
{-# INLINE intercalate #-}
intersperse :: Char -> SizedLazyText s -> SizedLazyText (s <*> Exactly 2 <-> Exactly 1)
intersperse :: Char
-> SizedLazyText s
-> SizedLazyText ((s <*> Exactly 2) <-> Exactly 1)
intersperse Char
c = (Text -> Text)
-> SizedLazyText s
-> SizedLazyText ((s <*> Exactly 2) <-> Exactly 1)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s
-> SizedLazyText ((s <*> Exactly 2) <-> Exactly 1))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText ((s <*> Exactly 2) <-> Exactly 1)
forall a b. (a -> b) -> a -> b
$ Char -> Text -> Text
T.intersperse Char
c
{-# INLINE intersperse #-}
reverse :: HasCallStack => SizedLazyText s -> SizedLazyText s
reverse :: SizedLazyText s -> SizedLazyText s
reverse = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> Text
T.reverse
{-# INLINE reverse #-}
replace ::
SizedLazyText s0 ->
SizedLazyText s1 ->
SizedLazyText s2 ->
SizedLazyText Unknown
replace :: SizedLazyText s0
-> SizedLazyText s1 -> SizedLazyText s2 -> SizedLazyText Unknown
replace = (Text -> Text -> Text -> Text)
-> SizedLazyText s0
-> SizedLazyText s1
-> SizedLazyText s2
-> SizedLazyText Unknown
forall a b c d s0 s1 s2 s3.
(a -> b -> c -> d)
-> Sized s0 a -> Sized s1 b -> Sized s2 c -> Sized s3 d
trustedChangeOverSized3 Text -> Text -> Text -> Text
T.replace
toCaseFold :: SizedLazyText s -> SizedLazyText s
toCaseFold :: SizedLazyText s -> SizedLazyText s
toCaseFold = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> Text
T.toCaseFold
{-# INLINE toCaseFold #-}
toLower :: SizedLazyText s -> SizedLazyText s
toLower :: SizedLazyText s -> SizedLazyText s
toLower = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> Text
T.toLower
{-# INLINE toLower #-}
toUpper :: SizedLazyText s -> SizedLazyText s
toUpper :: SizedLazyText s -> SizedLazyText s
toUpper = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> Text
T.toUpper
{-# INLINE toUpper #-}
toTitle :: SizedLazyText s -> SizedLazyText s
toTitle :: SizedLazyText s -> SizedLazyText s
toTitle = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> Text
T.toTitle
{-# INLINE toTitle #-}
justifyLeft :: KnownNat n => Proxy n -> Char -> SizedLazyText s -> SizedLazyText (AtLeast n)
justifyLeft :: Proxy n -> Char -> SizedLazyText s -> SizedLazyText (AtLeast n)
justifyLeft Proxy n
p Char
c = (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n))
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Char -> Text -> Text
T.justifyLeft (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
p) Char
c
{-# INLINE justifyLeft #-}
justifyRight :: KnownNat n => Proxy n -> Char -> SizedLazyText s -> SizedLazyText (AtLeast n)
justifyRight :: Proxy n -> Char -> SizedLazyText s -> SizedLazyText (AtLeast n)
justifyRight Proxy n
p Char
c = (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n))
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Char -> Text -> Text
T.justifyRight (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
p) Char
c
{-# INLINE justifyRight #-}
center :: KnownNat n => Proxy n -> Char -> SizedLazyText s -> SizedLazyText (AtLeast n)
center :: Proxy n -> Char -> SizedLazyText s -> SizedLazyText (AtLeast n)
center Proxy n
p Char
c = (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n))
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Char -> Text -> Text
T.center (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
p) Char
c
{-# INLINE center #-}
transpose :: Sized s [SizedLazyText s'] -> Sized s' [SizedLazyText s]
transpose :: Sized s [SizedLazyText s'] -> Sized s' [SizedLazyText s]
transpose = ([SizedLazyText s'] -> [SizedLazyText s])
-> Sized s [SizedLazyText s'] -> Sized s' [SizedLazyText s]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized (([SizedLazyText s'] -> [SizedLazyText s])
-> Sized s [SizedLazyText s'] -> Sized s' [SizedLazyText s])
-> ([SizedLazyText s'] -> [SizedLazyText s])
-> Sized s [SizedLazyText s']
-> Sized s' [SizedLazyText s]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText s) -> [Text] -> [SizedLazyText s]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText s
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText s])
-> ([SizedLazyText s'] -> [Text])
-> [SizedLazyText s']
-> [SizedLazyText s]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Text] -> [Text]
T.transpose ([Text] -> [Text])
-> ([SizedLazyText s'] -> [Text]) -> [SizedLazyText s'] -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizedLazyText s' -> Text) -> [SizedLazyText s'] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized
foldl :: (a -> Char -> a) -> a -> SizedLazyText s -> a
foldl :: (a -> Char -> a) -> a -> SizedLazyText s -> a
foldl a -> Char -> a
f a
a = (a -> Char -> a) -> a -> Text -> a
forall a. (a -> Char -> a) -> a -> Text -> a
T.foldl a -> Char -> a
f a
a (Text -> a) -> (SizedLazyText s -> Text) -> SizedLazyText s -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE foldl #-}
foldl' :: (a -> Char -> a) -> a -> SizedLazyText s -> a
foldl' :: (a -> Char -> a) -> a -> SizedLazyText s -> a
foldl' a -> Char -> a
f a
a = (a -> Char -> a) -> a -> Text -> a
forall a. (a -> Char -> a) -> a -> Text -> a
T.foldl' a -> Char -> a
f a
a (Text -> a) -> (SizedLazyText s -> Text) -> SizedLazyText s -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE foldl' #-}
foldl1 :: IsNotEmpty s => (Char -> Char -> Char) -> SizedLazyText s -> Char
foldl1 :: (Char -> Char -> Char) -> SizedLazyText s -> Char
foldl1 Char -> Char -> Char
f = (Char -> Text -> Char) -> (Char, Text) -> Char
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ((Char -> Char -> Char) -> Char -> Text -> Char
forall a. (a -> Char -> a) -> a -> Text -> a
T.foldl Char -> Char -> Char
f) ((Char, Text) -> Char)
-> (SizedLazyText s -> (Char, Text)) -> SizedLazyText s -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sized (Exactly 1 <+> s) Text -> Text)
-> (Char, Sized (Exactly 1 <+> s) Text) -> (Char, Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sized (Exactly 1 <+> s) Text -> Text
forall s a. Sized s a -> a
getSized ((Char, Sized (Exactly 1 <+> s) Text) -> (Char, Text))
-> (SizedLazyText s -> (Char, Sized (Exactly 1 <+> s) Text))
-> SizedLazyText s
-> (Char, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (Char, Sized (Exactly 1 <+> s) Text)
forall s s'.
(IsNotEmpty s, (Exactly 1 <+> s) ~ s') =>
SizedLazyText s -> (Char, SizedLazyText s')
uncons
{-# INLINE foldl1 #-}
foldl1' :: IsNotEmpty s => (Char -> Char -> Char) -> SizedLazyText s -> Char
foldl1' :: (Char -> Char -> Char) -> SizedLazyText s -> Char
foldl1' Char -> Char -> Char
f = (Char -> Text -> Char) -> (Char, Text) -> Char
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ((Char -> Char -> Char) -> Char -> Text -> Char
forall a. (a -> Char -> a) -> a -> Text -> a
T.foldl' Char -> Char -> Char
f) ((Char, Text) -> Char)
-> (SizedLazyText s -> (Char, Text)) -> SizedLazyText s -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sized (Exactly 1 <+> s) Text -> Text)
-> (Char, Sized (Exactly 1 <+> s) Text) -> (Char, Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sized (Exactly 1 <+> s) Text -> Text
forall s a. Sized s a -> a
getSized ((Char, Sized (Exactly 1 <+> s) Text) -> (Char, Text))
-> (SizedLazyText s -> (Char, Sized (Exactly 1 <+> s) Text))
-> SizedLazyText s
-> (Char, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (Char, Sized (Exactly 1 <+> s) Text)
forall s s'.
(IsNotEmpty s, (Exactly 1 <+> s) ~ s') =>
SizedLazyText s -> (Char, SizedLazyText s')
uncons
{-# INLINE foldl1' #-}
foldr :: (Char -> a -> a) -> a -> SizedLazyText s -> a
foldr :: (Char -> a -> a) -> a -> SizedLazyText s -> a
foldr Char -> a -> a
f a
a = (Char -> a -> a) -> a -> Text -> a
forall a. (Char -> a -> a) -> a -> Text -> a
T.foldr Char -> a -> a
f a
a (Text -> a) -> (SizedLazyText s -> Text) -> SizedLazyText s -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE foldr #-}
foldr1 :: IsNotEmpty s => (Char -> Char -> Char) -> SizedLazyText s -> Char
foldr1 :: (Char -> Char -> Char) -> SizedLazyText s -> Char
foldr1 Char -> Char -> Char
f = (Char -> Text -> Char) -> (Char, Text) -> Char
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ((Char -> Char -> Char) -> Char -> Text -> Char
forall a. (Char -> a -> a) -> a -> Text -> a
T.foldr Char -> Char -> Char
f) ((Char, Text) -> Char)
-> (SizedLazyText s -> (Char, Text)) -> SizedLazyText s -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Sized (Exactly 1 <+> s) Text -> Text)
-> (Char, Sized (Exactly 1 <+> s) Text) -> (Char, Text)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Sized (Exactly 1 <+> s) Text -> Text
forall s a. Sized s a -> a
getSized ((Char, Sized (Exactly 1 <+> s) Text) -> (Char, Text))
-> (SizedLazyText s -> (Char, Sized (Exactly 1 <+> s) Text))
-> SizedLazyText s
-> (Char, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> (Char, Sized (Exactly 1 <+> s) Text)
forall s s'.
(IsNotEmpty s, (Exactly 1 <+> s) ~ s') =>
SizedLazyText s -> (Char, SizedLazyText s')
uncons
{-# INLINE foldr1 #-}
concat :: Sized s [SizedLazyText s'] -> SizedLazyText (s <*> s')
concat :: Sized s [SizedLazyText s'] -> SizedLazyText (s <*> s')
concat = ([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s'] -> SizedLazyText (s <*> s')
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized (([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s'] -> SizedLazyText (s <*> s'))
-> ([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> s')
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.concat ([Text] -> Text)
-> ([SizedLazyText s'] -> [Text]) -> [SizedLazyText s'] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizedLazyText s' -> Text) -> [SizedLazyText s'] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized
concatMap :: (Char -> SizedLazyText s') -> SizedLazyText s -> SizedLazyText (s <*> s')
concatMap :: (Char -> SizedLazyText s')
-> SizedLazyText s -> SizedLazyText (s <*> s')
concatMap Char -> SizedLazyText s'
f = (Text -> Text) -> SizedLazyText s -> SizedLazyText (s <*> s')
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText (s <*> s'))
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText (s <*> s')
forall a b. (a -> b) -> a -> b
$ (Char -> Text) -> Text -> Text
T.concatMap ((Char -> Text) -> Text -> Text) -> (Char -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
$ SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized (SizedLazyText s' -> Text)
-> (Char -> SizedLazyText s') -> Char -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> SizedLazyText s'
f
{-# INLINE concatMap #-}
any :: (Char -> Bool) -> SizedLazyText s -> Bool
any :: (Char -> Bool) -> SizedLazyText s -> Bool
any Char -> Bool
p = (Char -> Bool) -> Text -> Bool
T.any Char -> Bool
p (Text -> Bool)
-> (SizedLazyText s -> Text) -> SizedLazyText s -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE any #-}
all :: (Char -> Bool) -> SizedLazyText s -> Bool
all :: (Char -> Bool) -> SizedLazyText s -> Bool
all Char -> Bool
p = (Char -> Bool) -> Text -> Bool
T.all Char -> Bool
p (Text -> Bool)
-> (SizedLazyText s -> Text) -> SizedLazyText s -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE all #-}
maximum :: IsNotEmpty s => SizedLazyText s -> Char
maximum :: SizedLazyText s -> Char
maximum = Text -> Char
T.maximum (Text -> Char)
-> (SizedLazyText s -> Text) -> SizedLazyText s -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE maximum #-}
minimum :: IsNotEmpty s => SizedLazyText s -> Char
minimum :: SizedLazyText s -> Char
minimum = Text -> Char
T.minimum (Text -> Char)
-> (SizedLazyText s -> Text) -> SizedLazyText s -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE minimum #-}
scanl :: (Char -> Char -> Char) -> Char -> SizedLazyText s -> SizedLazyText s
scanl :: (Char -> Char -> Char)
-> Char -> SizedLazyText s -> SizedLazyText s
scanl Char -> Char -> Char
f Char
s = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText s)
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Char -> Text -> Text
T.scanl Char -> Char -> Char
f Char
s
{-# INLINE scanl #-}
scanl1 :: IsNotEmpty s =>(Char -> Char -> Char) -> SizedLazyText s -> SizedLazyText s
scanl1 :: (Char -> Char -> Char) -> SizedLazyText s -> SizedLazyText s
scanl1 Char -> Char -> Char
f = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText s)
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Text -> Text
T.scanl1 Char -> Char -> Char
f
{-# INLINE scanl1 #-}
scanr :: (Char -> Char -> Char) -> Char -> SizedLazyText s -> SizedLazyText s
scanr :: (Char -> Char -> Char)
-> Char -> SizedLazyText s -> SizedLazyText s
scanr Char -> Char -> Char
f Char
s = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText s)
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Char -> Text -> Text
T.scanr Char -> Char -> Char
f Char
s
{-# INLINE scanr #-}
scanr1 :: IsNotEmpty s => (Char -> Char -> Char) -> SizedLazyText s -> SizedLazyText s
scanr1 :: (Char -> Char -> Char) -> SizedLazyText s -> SizedLazyText s
scanr1 Char -> Char -> Char
f = (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText s)
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText s
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Text -> Text
T.scanr1 Char -> Char -> Char
f
{-# INLINE scanr1 #-}
mapAccumL :: forall a s. (a -> Char -> (a, Char)) -> a -> SizedLazyText s -> (a, SizedLazyText s)
mapAccumL :: (a -> Char -> (a, Char))
-> a -> SizedLazyText s -> (a, SizedLazyText s)
mapAccumL a -> Char -> (a, Char)
f a
s = (Text -> SizedLazyText s) -> (a, Text) -> (a, SizedLazyText s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText s
forall a s. a -> Sized s a
trustedSized ((a, Text) -> (a, SizedLazyText s))
-> (SizedLazyText s -> (a, Text))
-> SizedLazyText s
-> (a, SizedLazyText s)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
forall a. (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
T.mapAccumL a -> Char -> (a, Char)
f a
s (Text -> (a, Text))
-> (SizedLazyText s -> Text) -> SizedLazyText s -> (a, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE mapAccumL #-}
mapAccumR :: forall a s. (a -> Char -> (a, Char)) -> a -> SizedLazyText s -> (a, SizedLazyText s)
mapAccumR :: (a -> Char -> (a, Char))
-> a -> SizedLazyText s -> (a, SizedLazyText s)
mapAccumR a -> Char -> (a, Char)
f a
s = (Text -> SizedLazyText s) -> (a, Text) -> (a, SizedLazyText s)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText s
forall a s. a -> Sized s a
trustedSized ((a, Text) -> (a, SizedLazyText s))
-> (SizedLazyText s -> (a, Text))
-> SizedLazyText s
-> (a, SizedLazyText s)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
forall a. (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
T.mapAccumR a -> Char -> (a, Char)
f a
s (Text -> (a, Text))
-> (SizedLazyText s -> Text) -> SizedLazyText s -> (a, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE mapAccumR #-}
replicate :: KnownNat n => Proxy n -> SizedLazyText s -> SizedLazyText (s <*> Exactly n)
replicate :: Proxy n -> SizedLazyText s -> SizedLazyText (s <*> Exactly n)
replicate Proxy n
n = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <*> Exactly n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <*> Exactly n))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (s <*> Exactly n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Text -> Text
T.replicate (Int64 -> Text -> Text) -> Int64 -> Text -> Text
forall a b. (a -> b) -> a -> b
$ Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
n
{-# INLINE replicate #-}
cycle :: SizedLazyText s -> SizedLazyText (AtLeast 0)
cycle :: SizedLazyText s -> SizedLazyText (AtLeast 0)
cycle = (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtLeast 0)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized Text -> Text
T.cycle
{-# INLINE cycle #-}
iterate :: (Char -> Char) -> Char -> SizedLazyText (AtLeast 0)
iterate :: (Char -> Char) -> Char -> SizedLazyText (AtLeast 0)
iterate Char -> Char
f = Text -> SizedLazyText (AtLeast 0)
forall a s. a -> Sized s a
trustedSized (Text -> SizedLazyText (AtLeast 0))
-> (Char -> Text) -> Char -> SizedLazyText (AtLeast 0)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Char) -> Char -> Text
T.iterate Char -> Char
f
{-# INLINE iterate #-}
take :: (KnownNat n, Includes s n) => Proxy n -> SizedLazyText s -> SizedLazyText (AtMost n)
take :: Proxy n -> SizedLazyText s -> SizedLazyText (AtMost n)
take Proxy n
n = (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtMost n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText (AtMost n))
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtMost n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Text -> Text
T.take (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
n)
{-# INLINE take #-}
takeEnd :: (KnownNat n, Includes s n) => Proxy n -> SizedLazyText s -> SizedLazyText (AtMost n)
takeEnd :: Proxy n -> SizedLazyText s -> SizedLazyText (AtMost n)
takeEnd Proxy n
n = (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtMost n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text) -> SizedLazyText s -> SizedLazyText (AtMost n))
-> (Text -> Text) -> SizedLazyText s -> SizedLazyText (AtMost n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Text -> Text
T.takeEnd (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
n)
{-# INLINE takeEnd #-}
drop :: (KnownNat n, Includes s n) => Proxy n -> SizedLazyText s -> SizedLazyText (s <-> Exactly n)
drop :: Proxy n -> SizedLazyText s -> SizedLazyText (s <-> Exactly n)
drop Proxy n
n = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <-> Exactly n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <-> Exactly n))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (s <-> Exactly n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Text -> Text
T.drop (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
n)
{-# INLINE drop #-}
dropEnd :: (KnownNat n, Includes s n) => Proxy n -> SizedLazyText s -> SizedLazyText (s <-> Exactly n)
dropEnd :: Proxy n -> SizedLazyText s -> SizedLazyText (s <-> Exactly n)
dropEnd Proxy n
n = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <-> Exactly n)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (s <-> Exactly n))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (s <-> Exactly n)
forall a b. (a -> b) -> a -> b
$ Int64 -> Text -> Text
T.dropEnd (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
n)
{-# INLINE dropEnd #-}
takeWhile :: (Char -> Bool) -> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
takeWhile :: (Char -> Bool)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
takeWhile Char -> Bool
p = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.takeWhile Char -> Bool
p
{-# INLINE takeWhile #-}
takeWhileEnd :: (Char -> Bool) -> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
takeWhileEnd :: (Char -> Bool)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
takeWhileEnd Char -> Bool
p = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.takeWhileEnd Char -> Bool
p
{-# INLINE takeWhileEnd #-}
dropWhile :: (Char -> Bool) -> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
dropWhile :: (Char -> Bool)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
dropWhile Char -> Bool
p = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.dropWhile Char -> Bool
p
{-# INLINE dropWhile #-}
dropWhileEnd :: (Char -> Bool) -> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
dropWhileEnd :: (Char -> Bool)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
dropWhileEnd Char -> Bool
p = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.dropWhileEnd Char -> Bool
p
{-# INLINE dropWhileEnd #-}
dropAround :: (Char -> Bool) -> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
dropAround :: (Char -> Bool)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
dropAround Char -> Bool
p = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.dropAround Char -> Bool
p
{-# INLINE dropAround #-}
stripStart :: SizedLazyText s -> SizedLazyText (RestrictAtMost s)
stripStart :: SizedLazyText s -> SizedLazyText (RestrictAtMost s)
stripStart = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ Text -> Text
T.stripStart
{-# INLINE stripStart #-}
stripEnd :: SizedLazyText s -> SizedLazyText (RestrictAtMost s)
stripEnd :: SizedLazyText s -> SizedLazyText (RestrictAtMost s)
stripEnd = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ Text -> Text
T.stripEnd
{-# INLINE stripEnd #-}
strip :: SizedLazyText s -> SizedLazyText (RestrictAtMost s)
strip :: SizedLazyText s -> SizedLazyText (RestrictAtMost s)
strip = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ Text -> Text
T.strip
{-# INLINE strip #-}
splitAt :: (KnownNat n, Includes s n) => Proxy n -> SizedLazyText s -> (SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))
splitAt :: Proxy n
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
splitAt Proxy n
n = (Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> (SizedLazyText s -> (Text, Text))
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Text -> (Text, Text)
T.splitAt (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
n) (Text -> (Text, Text))
-> (SizedLazyText s -> Text) -> SizedLazyText s -> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE splitAt #-}
span :: (Char -> Bool) -> SizedLazyText s -> (SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))
span :: (Char -> Bool)
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
span Char -> Bool
p = (Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> (SizedLazyText s -> (Text, Text))
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> Text -> (Text, Text)
T.span Char -> Bool
p (Text -> (Text, Text))
-> (SizedLazyText s -> Text) -> SizedLazyText s -> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE span #-}
break :: (Char -> Bool) -> SizedLazyText s -> (SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))
break :: (Char -> Bool)
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
break Char -> Bool
p = (Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> (SizedLazyText s -> (Text, Text))
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> Text -> (Text, Text)
T.break Char -> Bool
p (Text -> (Text, Text))
-> (SizedLazyText s -> Text) -> SizedLazyText s -> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE break #-}
groupBy :: (Char -> Char -> Bool) -> SizedLazyText s -> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
groupBy :: (Char -> Char -> Bool)
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
groupBy Char -> Char -> Bool
p = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Char -> Bool) -> Text -> [Text]
T.groupBy Char -> Char -> Bool
p
{-# INLINE groupBy #-}
group :: SizedLazyText s -> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
group :: SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
group = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.group
{-# INLINE group #-}
inits :: SizedLazyText s -> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
inits :: SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
inits = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.inits
{-# INLINE inits #-}
tails :: SizedLazyText s -> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
tails :: SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
tails = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (s <+> Exactly 1) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.tails
{-# INLINE tails #-}
splitOn ::
SizedLazyText s ->
SizedLazyText s' ->
Sized (RestrictAtMost s') [SizedLazyText (RestrictAtMost s')]
splitOn :: SizedLazyText s
-> SizedLazyText s'
-> Sized (RestrictAtMost s') [SizedLazyText (RestrictAtMost s')]
splitOn = (Text -> Text -> [SizedLazyText (RestrictAtMost s')])
-> SizedLazyText s
-> SizedLazyText s'
-> Sized (RestrictAtMost s') [SizedLazyText (RestrictAtMost s')]
forall a b c s0 s1 s2.
(a -> b -> c) -> Sized s0 a -> Sized s1 b -> Sized s2 c
trustedChangeOverSized2 ((Text -> Text -> [SizedLazyText (RestrictAtMost s')])
-> SizedLazyText s
-> SizedLazyText s'
-> Sized (RestrictAtMost s') [SizedLazyText (RestrictAtMost s')])
-> (Text -> Text -> [SizedLazyText (RestrictAtMost s')])
-> SizedLazyText s
-> SizedLazyText s'
-> Sized (RestrictAtMost s') [SizedLazyText (RestrictAtMost s')]
forall a b. (a -> b) -> a -> b
$ \Text
x Text
y -> (Text -> SizedLazyText (RestrictAtMost s'))
-> [Text] -> [SizedLazyText (RestrictAtMost s')]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s')
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s')])
-> [Text] -> [SizedLazyText (RestrictAtMost s')]
forall a b. (a -> b) -> a -> b
$ Text -> Text -> [Text]
T.splitOn Text
x Text
y
{-# INLINE splitOn #-}
split :: (Char -> Bool) -> SizedLazyText s -> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
split :: (Char -> Bool)
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
split Char -> Bool
p = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> Text -> [Text]
T.split Char -> Bool
p
{-# INLINE split #-}
chunksOf :: (KnownNat n, Includes s n) => Proxy n -> SizedLazyText s -> Sized (AtMost d) [SizedLazyText (RestrictAtMost s)]
chunksOf :: Proxy n
-> SizedLazyText s
-> Sized (AtMost d) [SizedLazyText (RestrictAtMost s)]
chunksOf Proxy n
p = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (AtMost d) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (AtMost d) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (AtMost d) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Text -> [Text]
T.chunksOf (Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN Proxy n
p)
{-# INLINE chunksOf #-}
#if MIN_VERSION_text(1,2,5)
elem :: Char -> SizedLazyText s -> Bool
elem p = T.elem p . getSized
{-# INLINE elem #-}
#endif
find :: (Char -> Bool) -> SizedLazyText s -> Maybe Char
find :: (Char -> Bool) -> SizedLazyText s -> Maybe Char
find Char -> Bool
p = (Char -> Bool) -> Text -> Maybe Char
T.find Char -> Bool
p (Text -> Maybe Char)
-> (SizedLazyText s -> Text) -> SizedLazyText s -> Maybe Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE find #-}
partition :: (Char -> Bool) -> SizedLazyText s -> (SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))
partition :: (Char -> Bool)
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
partition Char -> Bool
p = (Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> (SizedLazyText s -> (Text, Text))
-> SizedLazyText s
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> Text -> (Text, Text)
T.partition Char -> Bool
p (Text -> (Text, Text))
-> (SizedLazyText s -> Text) -> SizedLazyText s -> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE partition #-}
filter :: (Char -> Bool) -> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
filter :: (Char -> Bool)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
filter Char -> Bool
p = (Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s)
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> Text)
-> SizedLazyText s -> SizedLazyText (RestrictAtMost s))
-> (Text -> Text)
-> SizedLazyText s
-> SizedLazyText (RestrictAtMost s)
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> Text
T.filter Char -> Bool
p
{-# INLINE filter #-}
breakOn :: SizedLazyText s -> SizedLazyText s' -> (SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))
breakOn :: SizedLazyText s
-> SizedLazyText s'
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
breakOn SizedLazyText s
t = (Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> (SizedLazyText s' -> (Text, Text))
-> SizedLazyText s'
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> (Text, Text)
T.breakOn (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
t) (Text -> (Text, Text))
-> (SizedLazyText s' -> Text) -> SizedLazyText s' -> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE breakOn #-}
breakOnEnd :: SizedLazyText s -> SizedLazyText s' -> (SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))
breakOnEnd :: SizedLazyText s
-> SizedLazyText s'
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
breakOnEnd SizedLazyText s
t = (Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> (SizedLazyText s' -> (Text, Text))
-> SizedLazyText s'
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Text -> (Text, Text)
T.breakOnEnd (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
t) (Text -> (Text, Text))
-> (SizedLazyText s' -> Text) -> SizedLazyText s' -> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE breakOnEnd #-}
breakOnAll ::
SizedLazyText s ->
SizedLazyText s' ->
Sized (RestrictAtMost s) [(SizedLazyText (RestrictAtMost s), SizedLazyText (RestrictAtMost s))]
breakOnAll :: SizedLazyText s
-> SizedLazyText s'
-> Sized
(RestrictAtMost s)
[(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
breakOnAll SizedLazyText s
x SizedLazyText s'
y = [(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
-> Sized
(RestrictAtMost s)
[(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
forall a s. a -> Sized s a
trustedSized ([(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
-> Sized
(RestrictAtMost s)
[(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))])
-> [(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
-> Sized
(RestrictAtMost s)
[(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
forall a b. (a -> b) -> a -> b
$ ((Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s)))
-> [(Text, Text)]
-> [(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Text -> SizedLazyText (RestrictAtMost s))
-> (Text -> SizedLazyText (RestrictAtMost s))
-> (Text, Text)
-> (SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))
forall (p :: * -> * -> *) a b c d.
Bifunctor p =>
(a -> b) -> (c -> d) -> p a c -> p b d
bimap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized) ([(Text, Text)]
-> [(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))])
-> [(Text, Text)]
-> [(SizedLazyText (RestrictAtMost s),
SizedLazyText (RestrictAtMost s))]
forall a b. (a -> b) -> a -> b
$ Text -> Text -> [(Text, Text)]
T.breakOnAll (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE breakOnAll #-}
index :: (KnownNat n, Includes s n, HasCallStack) => SizedLazyText s -> Proxy n -> Char
index :: SizedLazyText s -> Proxy n -> Char
index SizedLazyText s
x = Text -> Int64 -> Char
T.index (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (Int64 -> Char) -> (Proxy n -> Int64) -> Proxy n -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy n -> Int64
forall (n :: Nat). KnownNat n => Proxy n -> Int64
getN
{-# INLINE index #-}
count :: SizedLazyText s -> SizedLazyText s' -> Int64
count :: SizedLazyText s -> SizedLazyText s' -> Int64
count SizedLazyText s
x SizedLazyText s'
y = Text -> Text -> Int64
T.count (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE count #-}
zip :: SizedLazyText s -> SizedLazyText s -> Sized s [(Char, Char)]
zip :: SizedLazyText s -> SizedLazyText s -> Sized s [(Char, Char)]
zip = (Text -> Text -> [(Char, Char)])
-> SizedLazyText s -> SizedLazyText s -> Sized s [(Char, Char)]
forall a b c s0 s1 s2.
(a -> b -> c) -> Sized s0 a -> Sized s1 b -> Sized s2 c
trustedChangeOverSized2 Text -> Text -> [(Char, Char)]
T.zip
{-# INLINE zip #-}
zipWith :: (Char -> Char -> Char) -> SizedLazyText s -> SizedLazyText s -> SizedLazyText s
zipWith :: (Char -> Char -> Char)
-> SizedLazyText s -> SizedLazyText s -> SizedLazyText s
zipWith Char -> Char -> Char
p = (Text -> Text -> Text)
-> SizedLazyText s -> SizedLazyText s -> SizedLazyText s
forall a b c s0 s1 s2.
(a -> b -> c) -> Sized s0 a -> Sized s1 b -> Sized s2 c
trustedChangeOverSized2 ((Text -> Text -> Text)
-> SizedLazyText s -> SizedLazyText s -> SizedLazyText s)
-> (Text -> Text -> Text)
-> SizedLazyText s
-> SizedLazyText s
-> SizedLazyText s
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Text -> Text -> Text
T.zipWith Char -> Char -> Char
p
{-# INLINE zipWith #-}
words :: SizedLazyText s -> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
words :: SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
words = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.words
{-# INLINE words #-}
lines :: SizedLazyText s -> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
lines :: SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
lines = (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized ((Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)])
-> (Text -> [SizedLazyText (RestrictAtMost s)])
-> SizedLazyText s
-> Sized (RestrictAtMost s) [SizedLazyText (RestrictAtMost s)]
forall a b. (a -> b) -> a -> b
$ (Text -> SizedLazyText (RestrictAtMost s))
-> [Text] -> [SizedLazyText (RestrictAtMost s)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (RestrictAtMost s)
forall a s. a -> Sized s a
trustedSized ([Text] -> [SizedLazyText (RestrictAtMost s)])
-> (Text -> [Text]) -> Text -> [SizedLazyText (RestrictAtMost s)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.lines
{-# INLINE lines #-}
unlines :: Sized s [SizedLazyText s'] -> SizedLazyText (s <*> (s' <+> Exactly 1))
unlines :: Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1))
unlines = ([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1))
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized (([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1)))
-> ([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1))
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.unlines ([Text] -> Text)
-> ([SizedLazyText s'] -> [Text]) -> [SizedLazyText s'] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizedLazyText s' -> Text) -> [SizedLazyText s'] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE unlines #-}
unwords :: Sized s [SizedLazyText s'] -> SizedLazyText (s <*> (s' <+> Exactly 1))
unwords :: Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1))
unwords = ([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1))
forall a b s0 s1. (a -> b) -> Sized s0 a -> Sized s1 b
trustedChangeOverSized (([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1)))
-> ([SizedLazyText s'] -> Text)
-> Sized s [SizedLazyText s']
-> SizedLazyText (s <*> (s' <+> Exactly 1))
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.unwords ([Text] -> Text)
-> ([SizedLazyText s'] -> [Text]) -> [SizedLazyText s'] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (SizedLazyText s' -> Text) -> [SizedLazyText s'] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized
{-# INLINE unwords #-}
isPrefixOf :: IsMoreGeneral s' s => SizedLazyText s -> SizedLazyText s' -> Bool
isPrefixOf :: SizedLazyText s -> SizedLazyText s' -> Bool
isPrefixOf SizedLazyText s
x SizedLazyText s'
y = Text -> Text -> Bool
T.isPrefixOf (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE isPrefixOf #-}
isSuffixOf :: IsMoreGeneral s' s => SizedLazyText s -> SizedLazyText s' -> Bool
isSuffixOf :: SizedLazyText s -> SizedLazyText s' -> Bool
isSuffixOf SizedLazyText s
x SizedLazyText s'
y = Text -> Text -> Bool
T.isSuffixOf (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE isSuffixOf #-}
isInfixOf :: (IsMoreGeneral s' s, HasCallStack) => SizedLazyText s -> SizedLazyText s' -> Bool
isInfixOf :: SizedLazyText s -> SizedLazyText s' -> Bool
isInfixOf SizedLazyText s
x SizedLazyText s'
y = Text -> Text -> Bool
T.isInfixOf (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE isInfixOf #-}
stripPrefix :: SizedLazyText s -> SizedLazyText s' -> Maybe (SizedLazyText (s <-> s'))
stripPrefix :: SizedLazyText s
-> SizedLazyText s' -> Maybe (SizedLazyText (s <-> s'))
stripPrefix SizedLazyText s
x SizedLazyText s'
y = (Text -> SizedLazyText (s <-> s'))
-> Maybe Text -> Maybe (SizedLazyText (s <-> s'))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (s <-> s')
forall a s. a -> Sized s a
trustedSized (Maybe Text -> Maybe (SizedLazyText (s <-> s')))
-> Maybe Text -> Maybe (SizedLazyText (s <-> s'))
forall a b. (a -> b) -> a -> b
$ Text -> Text -> Maybe Text
T.stripPrefix (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE stripPrefix #-}
commonPrefixes :: SizedLazyText s -> SizedLazyText s' -> Maybe (T.Text, T.Text, T.Text)
commonPrefixes :: SizedLazyText s -> SizedLazyText s' -> Maybe (Text, Text, Text)
commonPrefixes SizedLazyText s
x SizedLazyText s'
y = Text -> Text -> Maybe (Text, Text, Text)
T.commonPrefixes (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE commonPrefixes #-}
stripSuffix :: SizedLazyText s -> SizedLazyText s' -> Maybe (SizedLazyText (s <-> s'))
stripSuffix :: SizedLazyText s
-> SizedLazyText s' -> Maybe (SizedLazyText (s <-> s'))
stripSuffix SizedLazyText s
x SizedLazyText s'
y = (Text -> SizedLazyText (s <-> s'))
-> Maybe Text -> Maybe (SizedLazyText (s <-> s'))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> SizedLazyText (s <-> s')
forall a s. a -> Sized s a
trustedSized (Maybe Text -> Maybe (SizedLazyText (s <-> s')))
-> Maybe Text -> Maybe (SizedLazyText (s <-> s'))
forall a b. (a -> b) -> a -> b
$ Text -> Text -> Maybe Text
T.stripSuffix (SizedLazyText s -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s
x) (SizedLazyText s' -> Text
forall s a. Sized s a -> a
getSized SizedLazyText s'
y)
{-# INLINE stripSuffix #-}
getN :: KnownNat n => Proxy n -> Int64
getN :: Proxy n -> Int64
getN = Integer -> Int64
forall a. Num a => Integer -> a
fromInteger (Integer -> Int64) -> (Proxy n -> Integer) -> Proxy n -> Int64
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Natural -> Integer
naturalToInteger (Natural -> Integer) -> (Proxy n -> Natural) -> Proxy n -> Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Proxy n -> Natural
forall (n :: Nat) (proxy :: Nat -> *).
KnownNat n =>
proxy n -> Natural
natVal