{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Text.NonEmpty
(
NonEmptyText,
NonEmptyStrictText,
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.Function (on)
import Data.NonEmpty
import qualified Data.Text as T
import GHC.Stack
import Prelude (Bool (..), Char, Int, Maybe (..), Ord (..), Ordering, String, error, fmap, fst, not, snd, uncurry, ($), (.))
type NonEmptyStrictText = NonEmpty T.Text
type NonEmptyText = NonEmptyStrictText
instance NonEmptySingleton T.Text where
type NonEmptySingletonElement T.Text = Char
nonEmptySingleton :: Proxy Text -> NonEmptySingletonElement Text -> Text
nonEmptySingleton Proxy Text
_ = Char -> Text
NonEmptySingletonElement Text -> Text
T.singleton
instance NonEmptyFromContainer T.Text where
isNonEmpty :: Text -> Bool
isNonEmpty = Bool -> Bool
not (Bool -> Bool) -> (Text -> Bool) -> Text -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Bool
T.null
pack :: NonEmpty String -> NonEmptyStrictText
pack :: NonEmpty String -> NonEmptyStrictText
pack = (String -> Text) -> NonEmpty String -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty String -> Text
T.pack
{-# INLINE pack #-}
unpack :: HasCallStack => NonEmptyStrictText -> NonEmpty String
unpack :: NonEmptyStrictText -> NonEmpty String
unpack = (Text -> String) -> NonEmptyStrictText -> NonEmpty String
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> String
T.unpack
{-# INLINE unpack #-}
cons :: Char -> NonEmptyStrictText -> NonEmptyStrictText
cons :: Char -> NonEmptyStrictText -> NonEmptyStrictText
cons Char
c = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ Char -> Text -> Text
T.cons Char
c
{-# INLINE cons #-}
infixr 5 `cons`
snoc :: NonEmptyStrictText -> Char -> NonEmptyStrictText
snoc :: NonEmptyStrictText -> Char -> NonEmptyStrictText
snoc NonEmptyStrictText
t Char
c = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty (Text -> Char -> Text
`T.snoc` Char
c) NonEmptyStrictText
t
{-# INLINE snoc #-}
head :: NonEmptyStrictText -> Char
head :: NonEmptyStrictText -> Char
head = (Char, Text) -> Char
forall a b. (a, b) -> a
fst ((Char, Text) -> Char)
-> (NonEmptyStrictText -> (Char, Text))
-> NonEmptyStrictText
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Char, Text)
uncons
{-# INLINE head #-}
uncons :: NonEmptyStrictText -> (Char, T.Text)
uncons :: NonEmptyStrictText -> (Char, Text)
uncons = (Text -> Maybe (Char, Text)) -> NonEmptyStrictText -> (Char, Text)
forall a b. (a -> Maybe b) -> NonEmpty a -> b
withNonEmpty Text -> Maybe (Char, Text)
T.uncons
{-# INLINE uncons #-}
last :: NonEmptyStrictText -> Char
last :: NonEmptyStrictText -> Char
last = (Text, Char) -> Char
forall a b. (a, b) -> b
snd ((Text, Char) -> Char)
-> (NonEmptyStrictText -> (Text, Char))
-> NonEmptyStrictText
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Text, Char)
unsnoc
{-# INLINE last #-}
tail :: NonEmptyStrictText -> T.Text
tail :: NonEmptyStrictText -> Text
tail = (Char, Text) -> Text
forall a b. (a, b) -> b
snd ((Char, Text) -> Text)
-> (NonEmptyStrictText -> (Char, Text))
-> NonEmptyStrictText
-> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Char, Text)
uncons
{-# INLINE tail #-}
init :: NonEmptyStrictText -> T.Text
init :: NonEmptyStrictText -> Text
init = (Text, Char) -> Text
forall a b. (a, b) -> a
fst ((Text, Char) -> Text)
-> (NonEmptyStrictText -> (Text, Char))
-> NonEmptyStrictText
-> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Text, Char)
unsnoc
{-# INLINE init #-}
unsnoc :: NonEmptyStrictText -> (T.Text, Char)
unsnoc :: NonEmptyStrictText -> (Text, Char)
unsnoc = (Text -> Maybe (Text, Char)) -> NonEmptyStrictText -> (Text, Char)
forall a b. (a -> Maybe b) -> NonEmpty a -> b
withNonEmpty Text -> Maybe (Text, Char)
T.unsnoc
{-# INLINE unsnoc #-}
length :: NonEmptyStrictText -> Int
length :: NonEmptyStrictText -> Int
length = Text -> Int
T.length (Text -> Int)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE length #-}
compareLength :: NonEmptyStrictText -> Int -> Ordering
compareLength :: NonEmptyStrictText -> Int -> Ordering
compareLength NonEmptyStrictText
x = Text -> Int -> Ordering
T.compareLength (NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty NonEmptyStrictText
x)
{-# INLINE compareLength #-}
map :: (Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText
map :: (Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText
map Char -> Char
f = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ (Char -> Char) -> Text -> Text
T.map Char -> Char
f
{-# INLINE map #-}
intercalate :: T.Text -> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
intercalate :: Text -> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
intercalate Text
e = Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty (Text -> NonEmptyStrictText)
-> (NonEmpty [NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText]
-> NonEmptyStrictText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text] -> Text
T.intercalate Text
e ([Text] -> Text)
-> (NonEmpty [NonEmptyStrictText] -> [Text])
-> NonEmpty [NonEmptyStrictText]
-> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonEmptyStrictText -> Text) -> [NonEmptyStrictText] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty ([NonEmptyStrictText] -> [Text])
-> (NonEmpty [NonEmptyStrictText] -> [NonEmptyStrictText])
-> NonEmpty [NonEmptyStrictText]
-> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty [NonEmptyStrictText] -> [NonEmptyStrictText]
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE intercalate #-}
intersperse :: Char -> NonEmptyStrictText -> NonEmptyStrictText
intersperse :: Char -> NonEmptyStrictText -> NonEmptyStrictText
intersperse Char
c = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ Char -> Text -> Text
T.intersperse Char
c
{-# INLINE intersperse #-}
reverse :: HasCallStack => NonEmptyStrictText -> NonEmptyStrictText
reverse :: NonEmptyStrictText -> NonEmptyStrictText
reverse = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> Text
T.reverse
{-# INLINE reverse #-}
replace ::
NonEmptyStrictText ->
NonEmptyStrictText ->
NonEmptyStrictText ->
NonEmptyStrictText
replace :: NonEmptyStrictText
-> NonEmptyStrictText -> NonEmptyStrictText -> NonEmptyStrictText
replace = (Text -> Text -> Text -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> NonEmptyStrictText
-> NonEmptyStrictText
forall a b c d.
(a -> b -> c -> d)
-> NonEmpty a -> NonEmpty b -> NonEmpty c -> NonEmpty d
overNonEmpty3 Text -> Text -> Text -> Text
T.replace
toCaseFold :: NonEmptyStrictText -> NonEmptyStrictText
toCaseFold :: NonEmptyStrictText -> NonEmptyStrictText
toCaseFold = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> Text
T.toCaseFold
{-# INLINE toCaseFold #-}
toLower :: NonEmptyStrictText -> NonEmptyStrictText
toLower :: NonEmptyStrictText -> NonEmptyStrictText
toLower = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> Text
T.toLower
{-# INLINE toLower #-}
toUpper :: NonEmptyStrictText -> NonEmptyStrictText
toUpper :: NonEmptyStrictText -> NonEmptyStrictText
toUpper = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> Text
T.toUpper
{-# INLINE toUpper #-}
toTitle :: NonEmptyStrictText -> NonEmptyStrictText
toTitle :: NonEmptyStrictText -> NonEmptyStrictText
toTitle = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> Text
T.toTitle
{-# INLINE toTitle #-}
justifyLeft :: Int -> Char -> NonEmptyStrictText -> NonEmptyStrictText
justifyLeft :: Int -> Char -> NonEmptyStrictText -> NonEmptyStrictText
justifyLeft Int
p Char
c = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ Int -> Char -> Text -> Text
T.justifyLeft Int
p Char
c
{-# INLINE justifyLeft #-}
justifyRight :: Int -> Char -> NonEmptyStrictText -> NonEmptyStrictText
justifyRight :: Int -> Char -> NonEmptyStrictText -> NonEmptyStrictText
justifyRight Int
p Char
c = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ Int -> Char -> Text -> Text
T.justifyRight Int
p Char
c
{-# INLINE justifyRight #-}
center :: Int -> Char -> NonEmptyStrictText -> NonEmptyStrictText
center :: Int -> Char -> NonEmptyStrictText -> NonEmptyStrictText
center Int
p Char
c = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ Int -> Char -> Text -> Text
T.center Int
p Char
c
{-# INLINE center #-}
transpose :: NonEmpty [NonEmptyStrictText] -> NonEmpty [NonEmptyStrictText]
transpose :: NonEmpty [NonEmptyStrictText] -> NonEmpty [NonEmptyStrictText]
transpose = ([NonEmptyStrictText] -> [NonEmptyStrictText])
-> NonEmpty [NonEmptyStrictText] -> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty (([NonEmptyStrictText] -> [NonEmptyStrictText])
-> NonEmpty [NonEmptyStrictText] -> NonEmpty [NonEmptyStrictText])
-> ([NonEmptyStrictText] -> [NonEmptyStrictText])
-> NonEmpty [NonEmptyStrictText]
-> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> a -> b
$ (Text -> NonEmptyStrictText) -> [Text] -> [NonEmptyStrictText]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty ([Text] -> [NonEmptyStrictText])
-> ([NonEmptyStrictText] -> [Text])
-> [NonEmptyStrictText]
-> [NonEmptyStrictText]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Text] -> [Text]
T.transpose ([Text] -> [Text])
-> ([NonEmptyStrictText] -> [Text])
-> [NonEmptyStrictText]
-> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonEmptyStrictText -> Text) -> [NonEmptyStrictText] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
foldl :: (a -> Char -> a) -> a -> NonEmptyStrictText -> a
foldl :: (a -> Char -> a) -> a -> NonEmptyStrictText -> 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)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE foldl #-}
foldl' :: (a -> Char -> a) -> a -> NonEmptyStrictText -> a
foldl' :: (a -> Char -> a) -> a -> NonEmptyStrictText -> 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)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE foldl' #-}
foldl1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> Char
foldl1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> 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)
-> (NonEmptyStrictText -> (Char, Text))
-> NonEmptyStrictText
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Char, Text)
uncons
{-# INLINE foldl1 #-}
foldl1' :: (Char -> Char -> Char) -> NonEmptyStrictText -> Char
foldl1' :: (Char -> Char -> Char) -> NonEmptyStrictText -> 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)
-> (NonEmptyStrictText -> (Char, Text))
-> NonEmptyStrictText
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Char, Text)
uncons
{-# INLINE foldl1' #-}
foldr :: (Char -> a -> a) -> a -> NonEmptyStrictText -> a
foldr :: (Char -> a -> a) -> a -> NonEmptyStrictText -> 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)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE foldr #-}
foldr1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> Char
foldr1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> 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)
-> (NonEmptyStrictText -> (Char, Text))
-> NonEmptyStrictText
-> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> (Char, Text)
uncons
{-# INLINE foldr1 #-}
concat :: NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
concat :: NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
concat = ([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty (([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText)
-> ([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText]
-> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.concat ([Text] -> Text)
-> ([NonEmptyStrictText] -> [Text]) -> [NonEmptyStrictText] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonEmptyStrictText -> Text) -> [NonEmptyStrictText] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
concatMap :: (Char -> NonEmptyStrictText) -> NonEmptyStrictText -> NonEmptyStrictText
concatMap :: (Char -> NonEmptyStrictText)
-> NonEmptyStrictText -> NonEmptyStrictText
concatMap Char -> NonEmptyStrictText
f = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
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
$ NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty (NonEmptyStrictText -> Text)
-> (Char -> NonEmptyStrictText) -> Char -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> NonEmptyStrictText
f
{-# INLINE concatMap #-}
any :: (Char -> Bool) -> NonEmptyStrictText -> Bool
any :: (Char -> Bool) -> NonEmptyStrictText -> Bool
any Char -> Bool
p = (Char -> Bool) -> Text -> Bool
T.any Char -> Bool
p (Text -> Bool)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE any #-}
all :: (Char -> Bool) -> NonEmptyStrictText -> Bool
all :: (Char -> Bool) -> NonEmptyStrictText -> Bool
all Char -> Bool
p = (Char -> Bool) -> Text -> Bool
T.all Char -> Bool
p (Text -> Bool)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE all #-}
maximum :: NonEmptyStrictText -> Char
maximum :: NonEmptyStrictText -> Char
maximum = Text -> Char
T.maximum (Text -> Char)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE maximum #-}
minimum :: NonEmptyStrictText -> Char
minimum :: NonEmptyStrictText -> Char
minimum = Text -> Char
T.minimum (Text -> Char)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE minimum #-}
scanl :: (Char -> Char -> Char) -> Char -> NonEmptyStrictText -> NonEmptyStrictText
scanl :: (Char -> Char -> Char)
-> Char -> NonEmptyStrictText -> NonEmptyStrictText
scanl Char -> Char -> Char
f Char
s = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Char -> Text -> Text
T.scanl Char -> Char -> Char
f Char
s
{-# INLINE scanl #-}
scanl1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText
scanl1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText
scanl1 Char -> Char -> Char
f = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
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 -> NonEmptyStrictText -> NonEmptyStrictText
scanr :: (Char -> Char -> Char)
-> Char -> NonEmptyStrictText -> NonEmptyStrictText
scanr Char -> Char -> Char
f Char
s = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Char -> Text -> Text
T.scanr Char -> Char -> Char
f Char
s
{-# INLINE scanr #-}
scanr1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText
scanr1 :: (Char -> Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText
scanr1 Char -> Char -> Char
f = (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Text -> Text
T.scanr1 Char -> Char -> Char
f
{-# INLINE scanr1 #-}
mapAccumL :: forall a. (a -> Char -> (a, Char)) -> a -> NonEmptyStrictText -> (a, NonEmptyStrictText)
mapAccumL :: (a -> Char -> (a, Char))
-> a -> NonEmptyStrictText -> (a, NonEmptyStrictText)
mapAccumL a -> Char -> (a, Char)
f a
s = (Text -> NonEmptyStrictText)
-> (a, Text) -> (a, NonEmptyStrictText)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty ((a, Text) -> (a, NonEmptyStrictText))
-> (NonEmptyStrictText -> (a, Text))
-> NonEmptyStrictText
-> (a, NonEmptyStrictText)
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))
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> (a, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE mapAccumL #-}
mapAccumR :: forall a. (a -> Char -> (a, Char)) -> a -> NonEmptyStrictText -> (a, NonEmptyStrictText)
mapAccumR :: (a -> Char -> (a, Char))
-> a -> NonEmptyStrictText -> (a, NonEmptyStrictText)
mapAccumR a -> Char -> (a, Char)
f a
s = (Text -> NonEmptyStrictText)
-> (a, Text) -> (a, NonEmptyStrictText)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty ((a, Text) -> (a, NonEmptyStrictText))
-> (NonEmptyStrictText -> (a, Text))
-> NonEmptyStrictText
-> (a, NonEmptyStrictText)
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))
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> (a, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE mapAccumR #-}
replicate :: Int -> NonEmptyStrictText -> NonEmptyStrictText
replicate :: Int -> NonEmptyStrictText -> NonEmptyStrictText
replicate Int
n NonEmptyStrictText
x =
if Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
0
then (Text -> Text) -> NonEmptyStrictText -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty (Int -> Text -> Text
T.replicate Int
n) NonEmptyStrictText
x
else String -> NonEmptyStrictText
forall a. HasCallStack => String -> a
error String
"replicate.n should be strictly positive"
{-# INLINE replicate #-}
take :: Int -> NonEmptyStrictText -> T.Text
take :: Int -> NonEmptyStrictText -> Text
take Int
n = Int -> Text -> Text
T.take Int
n (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE take #-}
takeEnd :: Int -> NonEmptyStrictText -> T.Text
takeEnd :: Int -> NonEmptyStrictText -> Text
takeEnd Int
n = Int -> Text -> Text
T.takeEnd Int
n (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE takeEnd #-}
drop :: Int -> NonEmptyStrictText -> T.Text
drop :: Int -> NonEmptyStrictText -> Text
drop Int
n = Int -> Text -> Text
T.drop Int
n (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE drop #-}
dropEnd :: Int -> NonEmptyStrictText -> T.Text
dropEnd :: Int -> NonEmptyStrictText -> Text
dropEnd Int
n = Int -> Text -> Text
T.dropEnd Int
n (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE dropEnd #-}
takeWhile :: (Char -> Bool) -> NonEmptyStrictText -> T.Text
takeWhile :: (Char -> Bool) -> NonEmptyStrictText -> Text
takeWhile Char -> Bool
p = (Char -> Bool) -> Text -> Text
T.takeWhile Char -> Bool
p (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE takeWhile #-}
takeWhileEnd :: (Char -> Bool) -> NonEmptyStrictText -> T.Text
takeWhileEnd :: (Char -> Bool) -> NonEmptyStrictText -> Text
takeWhileEnd Char -> Bool
p = (Char -> Bool) -> Text -> Text
T.takeWhileEnd Char -> Bool
p (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE takeWhileEnd #-}
dropWhile :: (Char -> Bool) -> NonEmptyStrictText -> T.Text
dropWhile :: (Char -> Bool) -> NonEmptyStrictText -> Text
dropWhile Char -> Bool
p = (Char -> Bool) -> Text -> Text
T.dropWhile Char -> Bool
p (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE dropWhile #-}
dropWhileEnd :: (Char -> Bool) -> NonEmptyStrictText -> T.Text
dropWhileEnd :: (Char -> Bool) -> NonEmptyStrictText -> Text
dropWhileEnd Char -> Bool
p = (Char -> Bool) -> Text -> Text
T.dropWhileEnd Char -> Bool
p (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE dropWhileEnd #-}
dropAround :: (Char -> Bool) -> NonEmptyStrictText -> T.Text
dropAround :: (Char -> Bool) -> NonEmptyStrictText -> Text
dropAround Char -> Bool
p = (Char -> Bool) -> Text -> Text
T.dropAround Char -> Bool
p (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE dropAround #-}
stripStart :: NonEmptyStrictText -> T.Text
stripStart :: NonEmptyStrictText -> Text
stripStart = Text -> Text
T.stripStart (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE stripStart #-}
stripEnd :: NonEmptyStrictText -> T.Text
stripEnd :: NonEmptyStrictText -> Text
stripEnd = Text -> Text
T.stripEnd (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE stripEnd #-}
strip :: NonEmptyStrictText -> T.Text
strip :: NonEmptyStrictText -> Text
strip = Text -> Text
T.strip (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE strip #-}
splitAt :: Int -> NonEmptyStrictText -> (T.Text, T.Text)
splitAt :: Int -> NonEmptyStrictText -> (Text, Text)
splitAt Int
n = Int -> Text -> (Text, Text)
T.splitAt Int
n (Text -> (Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE splitAt #-}
span :: (Char -> Bool) -> NonEmptyStrictText -> (T.Text, T.Text)
span :: (Char -> Bool) -> NonEmptyStrictText -> (Text, Text)
span Char -> Bool
p = (Char -> Bool) -> Text -> (Text, Text)
T.span Char -> Bool
p (Text -> (Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE span #-}
break :: (Char -> Bool) -> NonEmptyStrictText -> (T.Text, T.Text)
break :: (Char -> Bool) -> NonEmptyStrictText -> (Text, Text)
break Char -> Bool
p = (Char -> Bool) -> Text -> (Text, Text)
T.break Char -> Bool
p (Text -> (Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE break #-}
groupBy :: (Char -> Char -> Bool) -> NonEmptyStrictText -> NonEmpty [T.Text]
groupBy :: (Char -> Char -> Bool) -> NonEmptyStrictText -> NonEmpty [Text]
groupBy Char -> Char -> Bool
p = (Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text])
-> (Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text]
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Bool) -> Text -> [Text]
T.groupBy Char -> Char -> Bool
p
{-# INLINE groupBy #-}
group :: NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
group :: NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
group = (Text -> [NonEmptyStrictText])
-> NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> [NonEmptyStrictText])
-> NonEmptyStrictText -> NonEmpty [NonEmptyStrictText])
-> (Text -> [NonEmptyStrictText])
-> NonEmptyStrictText
-> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> a -> b
$ (Text -> NonEmptyStrictText) -> [Text] -> [NonEmptyStrictText]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty ([Text] -> [NonEmptyStrictText])
-> (Text -> [Text]) -> Text -> [NonEmptyStrictText]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.group
{-# INLINE group #-}
inits :: NonEmptyStrictText -> NonEmpty [T.Text]
inits :: NonEmptyStrictText -> NonEmpty [Text]
inits = (Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> [Text]
T.inits
{-# INLINE inits #-}
tails :: NonEmptyStrictText -> NonEmpty [T.Text]
tails :: NonEmptyStrictText -> NonEmpty [Text]
tails = (Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty Text -> [Text]
T.tails
{-# INLINE tails #-}
splitOn ::
NonEmptyStrictText ->
NonEmptyStrictText ->
NonEmpty [T.Text]
splitOn :: NonEmptyStrictText -> NonEmptyStrictText -> NonEmpty [Text]
splitOn = (Text -> Text -> [Text])
-> NonEmptyStrictText -> NonEmptyStrictText -> NonEmpty [Text]
forall a b c.
(a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
overNonEmpty2 Text -> Text -> [Text]
T.splitOn
{-# INLINE splitOn #-}
split :: (Char -> Bool) -> NonEmptyStrictText -> NonEmpty [T.Text]
split :: (Char -> Bool) -> NonEmptyStrictText -> NonEmpty [Text]
split Char -> Bool
p = (Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text])
-> (Text -> [Text]) -> NonEmptyStrictText -> NonEmpty [Text]
forall a b. (a -> b) -> a -> b
$ (Char -> Bool) -> Text -> [Text]
T.split Char -> Bool
p
{-# INLINE split #-}
chunksOf :: Int -> NonEmptyStrictText -> [T.Text]
chunksOf :: Int -> NonEmptyStrictText -> [Text]
chunksOf Int
p = Int -> Text -> [Text]
T.chunksOf Int
p (Text -> [Text])
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE chunksOf #-}
#if MIN_VERSION_text(1,2,5)
elem :: Char -> NonEmptyStrictText -> Bool
elem p = T.elem p . getNonEmpty
{-# INLINE elem #-}
#endif
find :: (Char -> Bool) -> NonEmptyStrictText -> Maybe Char
find :: (Char -> Bool) -> NonEmptyStrictText -> Maybe Char
find Char -> Bool
p = (Char -> Bool) -> Text -> Maybe Char
T.find Char -> Bool
p (Text -> Maybe Char)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Maybe Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE find #-}
partition :: (Char -> Bool) -> NonEmptyStrictText -> (T.Text, T.Text)
partition :: (Char -> Bool) -> NonEmptyStrictText -> (Text, Text)
partition Char -> Bool
p = (Char -> Bool) -> Text -> (Text, Text)
T.partition Char -> Bool
p (Text -> (Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE partition #-}
filter :: (Char -> Bool) -> NonEmptyStrictText -> T.Text
filter :: (Char -> Bool) -> NonEmptyStrictText -> Text
filter Char -> Bool
p = (Char -> Bool) -> Text -> Text
T.filter Char -> Bool
p (Text -> Text)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE filter #-}
breakOn :: NonEmptyStrictText -> NonEmptyStrictText -> (T.Text, T.Text)
breakOn :: NonEmptyStrictText -> NonEmptyStrictText -> (Text, Text)
breakOn NonEmptyStrictText
t = Text -> Text -> (Text, Text)
T.breakOn (NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty NonEmptyStrictText
t) (Text -> (Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE breakOn #-}
breakOnEnd :: NonEmptyStrictText -> NonEmptyStrictText -> (T.Text, T.Text)
breakOnEnd :: NonEmptyStrictText -> NonEmptyStrictText -> (Text, Text)
breakOnEnd NonEmptyStrictText
t = Text -> Text -> (Text, Text)
T.breakOnEnd (NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty NonEmptyStrictText
t) (Text -> (Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> (Text, Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE breakOnEnd #-}
breakOnAll ::
NonEmptyStrictText ->
NonEmptyStrictText ->
[(T.Text, T.Text)]
breakOnAll :: NonEmptyStrictText -> NonEmptyStrictText -> [(Text, Text)]
breakOnAll = Text -> Text -> [(Text, Text)]
T.breakOnAll (Text -> Text -> [(Text, Text)])
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> [(Text, Text)]
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE breakOnAll #-}
index :: HasCallStack => NonEmptyStrictText -> Int -> Char
index :: NonEmptyStrictText -> Int -> Char
index NonEmptyStrictText
x = Text -> Int -> Char
T.index (NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty NonEmptyStrictText
x)
{-# INLINE index #-}
findIndex :: (Char -> Bool) -> NonEmptyStrictText -> Maybe Int
findIndex :: (Char -> Bool) -> NonEmptyStrictText -> Maybe Int
findIndex Char -> Bool
p = (Char -> Bool) -> Text -> Maybe Int
T.findIndex Char -> Bool
p (Text -> Maybe Int)
-> (NonEmptyStrictText -> Text) -> NonEmptyStrictText -> Maybe Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE findIndex #-}
count :: NonEmptyStrictText -> NonEmptyStrictText -> Int
count :: NonEmptyStrictText -> NonEmptyStrictText -> Int
count = Text -> Text -> Int
T.count (Text -> Text -> Int)
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Int
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE count #-}
zip :: NonEmptyStrictText -> NonEmptyStrictText -> NonEmpty [(Char, Char)]
zip :: NonEmptyStrictText -> NonEmptyStrictText -> NonEmpty [(Char, Char)]
zip = (Text -> Text -> [(Char, Char)])
-> NonEmptyStrictText
-> NonEmptyStrictText
-> NonEmpty [(Char, Char)]
forall a b c.
(a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
overNonEmpty2 Text -> Text -> [(Char, Char)]
T.zip
{-# INLINE zip #-}
zipWith :: (Char -> Char -> Char) -> NonEmptyStrictText -> NonEmptyStrictText -> NonEmptyStrictText
zipWith :: (Char -> Char -> Char)
-> NonEmptyStrictText -> NonEmptyStrictText -> NonEmptyStrictText
zipWith Char -> Char -> Char
p = (Text -> Text -> Text)
-> NonEmptyStrictText -> NonEmptyStrictText -> NonEmptyStrictText
forall a b c.
(a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
overNonEmpty2 ((Text -> Text -> Text)
-> NonEmptyStrictText -> NonEmptyStrictText -> NonEmptyStrictText)
-> (Text -> Text -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ (Char -> Char -> Char) -> Text -> Text -> Text
T.zipWith Char -> Char -> Char
p
{-# INLINE zipWith #-}
words :: NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
words :: NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
words = (Text -> [NonEmptyStrictText])
-> NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> [NonEmptyStrictText])
-> NonEmptyStrictText -> NonEmpty [NonEmptyStrictText])
-> (Text -> [NonEmptyStrictText])
-> NonEmptyStrictText
-> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> a -> b
$ (Text -> NonEmptyStrictText) -> [Text] -> [NonEmptyStrictText]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty ([Text] -> [NonEmptyStrictText])
-> (Text -> [Text]) -> Text -> [NonEmptyStrictText]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.words
{-# INLINE words #-}
lines :: NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
lines :: NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
lines = (Text -> [NonEmptyStrictText])
-> NonEmptyStrictText -> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty ((Text -> [NonEmptyStrictText])
-> NonEmptyStrictText -> NonEmpty [NonEmptyStrictText])
-> (Text -> [NonEmptyStrictText])
-> NonEmptyStrictText
-> NonEmpty [NonEmptyStrictText]
forall a b. (a -> b) -> a -> b
$ (Text -> NonEmptyStrictText) -> [Text] -> [NonEmptyStrictText]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Text -> NonEmptyStrictText
forall a. a -> NonEmpty a
trustedNonEmpty ([Text] -> [NonEmptyStrictText])
-> (Text -> [Text]) -> Text -> [NonEmptyStrictText]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
T.lines
{-# INLINE lines #-}
unlines :: NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
unlines :: NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
unlines = ([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty (([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText)
-> ([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText]
-> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.unlines ([Text] -> Text)
-> ([NonEmptyStrictText] -> [Text]) -> [NonEmptyStrictText] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonEmptyStrictText -> Text) -> [NonEmptyStrictText] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE unlines #-}
unwords :: NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
unwords :: NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
unwords = ([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText
forall a b. (a -> b) -> NonEmpty a -> NonEmpty b
overNonEmpty (([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText] -> NonEmptyStrictText)
-> ([NonEmptyStrictText] -> Text)
-> NonEmpty [NonEmptyStrictText]
-> NonEmptyStrictText
forall a b. (a -> b) -> a -> b
$ [Text] -> Text
T.unwords ([Text] -> Text)
-> ([NonEmptyStrictText] -> [Text]) -> [NonEmptyStrictText] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (NonEmptyStrictText -> Text) -> [NonEmptyStrictText] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE unwords #-}
isPrefixOf :: NonEmptyStrictText -> NonEmptyStrictText -> Bool
isPrefixOf :: NonEmptyStrictText -> NonEmptyStrictText -> Bool
isPrefixOf = Text -> Text -> Bool
T.isPrefixOf (Text -> Text -> Bool)
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE isPrefixOf #-}
isSuffixOf :: NonEmptyStrictText -> NonEmptyStrictText -> Bool
isSuffixOf :: NonEmptyStrictText -> NonEmptyStrictText -> Bool
isSuffixOf = Text -> Text -> Bool
T.isSuffixOf (Text -> Text -> Bool)
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE isSuffixOf #-}
isInfixOf :: HasCallStack => NonEmptyStrictText -> NonEmptyStrictText -> Bool
isInfixOf :: NonEmptyStrictText -> NonEmptyStrictText -> Bool
isInfixOf = Text -> Text -> Bool
T.isInfixOf (Text -> Text -> Bool)
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE isInfixOf #-}
stripPrefix :: NonEmptyStrictText -> NonEmptyStrictText -> Maybe T.Text
stripPrefix :: NonEmptyStrictText -> NonEmptyStrictText -> Maybe Text
stripPrefix = Text -> Text -> Maybe Text
T.stripPrefix (Text -> Text -> Maybe Text)
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Maybe Text
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE stripPrefix #-}
commonPrefixes :: NonEmptyStrictText -> NonEmptyStrictText -> Maybe (T.Text, T.Text, T.Text)
commonPrefixes :: NonEmptyStrictText
-> NonEmptyStrictText -> Maybe (Text, Text, Text)
commonPrefixes = Text -> Text -> Maybe (Text, Text, Text)
T.commonPrefixes (Text -> Text -> Maybe (Text, Text, Text))
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Maybe (Text, Text, Text)
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE commonPrefixes #-}
stripSuffix :: NonEmptyStrictText -> NonEmptyStrictText -> Maybe T.Text
stripSuffix :: NonEmptyStrictText -> NonEmptyStrictText -> Maybe Text
stripSuffix = Text -> Text -> Maybe Text
T.stripSuffix (Text -> Text -> Maybe Text)
-> (NonEmptyStrictText -> Text)
-> NonEmptyStrictText
-> NonEmptyStrictText
-> Maybe Text
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
`on` NonEmptyStrictText -> Text
forall a. NonEmpty a -> a
getNonEmpty
{-# INLINE stripSuffix #-}