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