{-# LANGUAGE MagicHash, BangPatterns, UnboxedTuples, TypeFamilies
#-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.JSString ( JSString
, pack
, unpack, unpack'
, singleton
, empty
, cons
, snoc
, append
, uncons
, head
, last
, tail
, init
, null
, 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
, unfoldr
, unfoldrN
, take
, takeEnd
, drop
, dropEnd
, takeWhile
, dropWhile
, dropWhileEnd
, dropAround
, strip
, stripStart
, stripEnd
, splitAt
, breakOn
, breakOnEnd
, break
, span
, group
, group'
, groupBy
, inits
, tails
, splitOn, splitOn'
, split
, chunksOf, chunksOf'
, lines, lines'
, words, words'
, unlines
, unwords
, isPrefixOf
, isSuffixOf
, isInfixOf
, stripPrefix
, stripSuffix
, commonPrefixes
, filter
, breakOnAll, breakOnAll'
, find
, partition
, index
, findIndex
, count
, zip
, zipWith
) where
import Prelude
( Char, Bool(..), Int, Maybe(..), String, Eq(..), Ord(..), Ordering(..), (++)
, Read(..), Show(..), (&&), (||), (+), (-), (.), ($), ($!), (>>)
, not, seq, return, otherwise, quot)
import qualified Prelude as P
import Control.DeepSeq (NFData(..))
import Data.Char (isSpace)
import Data.Coerce (coerce)
import qualified Data.List as L
import Data.Data
import qualified Data.Text as T
import qualified Data.Text.Internal.Fusion as TF
import qualified Data.Text.Internal.Fusion.Common as TF
import GHC.Exts
( Int#, (+#), (-#), (>=#), (>#), isTrue#, chr#, Char(..)
, Int(..), Addr#, tagToEnum#)
import qualified GHC.Exts as Exts
import qualified GHC.CString as GHC
import Unsafe.Coerce
import GHCJS.Prim (JSVal)
import Data.JSString.Internal.Type
import Data.JSString.Internal.Fusion (stream, unstream)
import qualified Data.JSString.Internal.Fusion as S
import qualified Data.JSString.Internal.Fusion.Common as S
instance Exts.IsList JSString where
type Item JSString = Char
fromList :: [Item JSString] -> JSString
fromList = String -> JSString
[Item JSString] -> JSString
pack
toList :: JSString -> [Item JSString]
toList = JSString -> String
JSString -> [Item JSString]
unpack
pack :: String -> JSString
pack :: String -> JSString
pack = (String -> Text) -> String -> JSString
forall a b. Coercible a b => a -> b
coerce String -> Text
T.pack
{-# INLINE [1] pack #-}
{-# RULES
"JSSTRING pack -> fused" [~1] forall x.
pack x = unstream (S.map safe (S.streamList x))
"JSSTRING pack -> unfused" [1] forall x.
unstream (S.map safe (S.streamList x)) = pack x
#-}
unpack :: JSString -> String
unpack :: JSString -> String
unpack = Stream Char -> String
forall a. Stream a -> [a]
S.unstreamList (Stream Char -> String)
-> (JSString -> Stream Char) -> JSString -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. JSString -> Stream Char
stream
{-# INLINE [1] unpack #-}
unpack' :: JSString -> String
unpack' :: JSString -> String
unpack' = (Text -> String) -> JSString -> String
forall a b. Coercible a b => a -> b
coerce Text -> String
T.unpack
{-# INLINE unpack' #-}
unpackCString# :: Addr# -> JSString
unpackCString# :: Addr# -> JSString
unpackCString# = (Addr# -> Text) -> Addr# -> JSString
forall a b. Coercible a b => a -> b
coerce Addr# -> Text
T.unpackCString#
{-# NOINLINE unpackCString# #-}
{-# RULES "JSSTRING literal" forall a.
unstream (S.map safe (S.streamList (GHC.unpackCString# a)))
= unpackCString# a #-}
{-# RULES "JSSTRING literal UTF8" forall a.
unstream (S.map safe (S.streamList (GHC.unpackCStringUtf8# a)))
= unpackCString# a #-}
{-# RULES "JSSTRING empty literal"
unstream (S.map safe (S.streamList []))
= empty_ #-}
{-# RULES "JSSTRING singleton literal" forall a.
unstream (S.map safe (S.streamList [a]))
= singleton a #-}
singleton :: Char -> JSString
singleton :: Char -> JSString
singleton = (Char -> Text) -> Char -> JSString
forall a b. Coercible a b => a -> b
coerce Char -> Text
T.singleton
{-# INLINE [1] singleton #-}
{-# RULES
"JSSTRING singleton -> fused" [~1] forall a.
singleton a = unstream (S.singleton (safe a))
"JSSTRING singleton -> unfused" [1] forall a.
unstream (S.singleton (safe a)) = singleton a
#-}
cons :: Char -> JSString -> JSString
cons :: Char -> JSString -> JSString
cons = (Char -> Text -> Text) -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Char -> Text -> Text
T.cons
{-# INLINE [1] cons #-}
{-# RULES
"JSSTRING cons -> fused" [~1] forall c x.
cons c x = unstream (S.cons (safe c) (stream x))
"JSSTRING cons -> unfused" [1] forall c x.
unstream (S.cons (safe c) (stream x)) = cons c x
#-}
infixr 5 `cons`
snoc :: JSString -> Char -> JSString
snoc :: JSString -> Char -> JSString
snoc = (Text -> Char -> Text) -> JSString -> Char -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Char -> Text
T.snoc
{-# INLINE [1] snoc #-}
{-# RULES
"JSSTRING snoc -> fused" [~1] forall x c.
snoc x c = unstream (S.snoc (stream x) (safe c))
"JSSTRING snoc -> unfused" [1] forall x c.
unstream (S.snoc (stream x) (safe c)) = snoc x c
#-}
append :: JSString -> JSString -> JSString
append :: JSString -> JSString -> JSString
append = (Text -> Text -> Text) -> JSString -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Text
T.append
{-# INLINE [1] append #-}
{-# RULES
"JSSTRING append -> fused" [~1] forall x1 x2.
append x1 x2 = unstream (S.append (stream x1) (stream x2))
"JSSTRING append -> unfused" [1] forall x1 x2.
unstream (S.append (stream x1) (stream x2)) = append x1 x2
#-}
head :: JSString -> Char
head :: JSString -> Char
head = (Text -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Char
Text -> Char
T.head
{-# INLINE [1] head #-}
{-# RULES
"JSSTRING head -> fused" [~1] forall x.
head x = S.head (stream x)
"JSSTRING head -> unfused" [1] forall x.
S.head (stream x) = head x
#-}
uncons :: JSString -> Maybe (Char, JSString)
uncons :: JSString -> Maybe (Char, JSString)
uncons = (Text -> Maybe (Char, Text)) -> JSString -> Maybe (Char, JSString)
forall a b. Coercible a b => a -> b
coerce Text -> Maybe (Char, Text)
T.uncons
{-# INLINE [1] uncons #-}
second :: (b -> c) -> (a,b) -> (a,c)
second :: forall b c a. (b -> c) -> (a, b) -> (a, c)
second b -> c
f (a
a, b
b) = (a
a, b -> c
f b
b)
last :: JSString -> Char
last :: JSString -> Char
last = (Text -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Char
Text -> Char
T.last
{-# INLINE [1] last #-}
{-# RULES
"JSSTRING last -> fused" [~1] forall x.
last x = S.last (stream x)
"JSSTRING last -> unfused" [1] forall x.
S.last (stream x) = last x
#-}
tail :: JSString -> JSString
tail :: JSString -> JSString
tail = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text
Text -> Text
T.tail
{-# INLINE [1] tail #-}
{-# RULES
"JSSTRING tail -> fused" [~1] forall x.
tail x = unstream (S.tail (stream x))
"JSSTRING tail -> unfused" [1] forall x.
unstream (S.tail (stream x)) = tail x
#-}
init :: JSString -> JSString
init :: JSString -> JSString
init = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text
Text -> Text
T.init
{-# INLINE [1] init #-}
{-# RULES
"JSSTRING init -> fused" [~1] forall t.
init t = unstream (S.init (stream t))
"JSSTRING init -> unfused" [1] forall t.
unstream (S.init (stream t)) = init t
#-}
null :: JSString -> Bool
null :: JSString -> Bool
null = (Text -> Bool) -> JSString -> Bool
forall a b. Coercible a b => a -> b
coerce Text -> Bool
T.null
{-# INLINE [1] null #-}
{-# RULES
"JSSTRING null -> fused" [~1] forall t.
null t = S.null (stream t)
"JSSTRING null -> unfused" [1] forall t.
S.null (stream t) = null t
#-}
length :: JSString -> Int
length :: JSString -> Int
length = (Text -> Int) -> JSString -> Int
forall a b. Coercible a b => a -> b
coerce Text -> Int
T.length
{-# INLINE [1] length #-}
{-# RULES
"JSSTRING length -> fused" [~1] forall x.
length x = S.length (stream x)
"JSSTRING length -> unfused" [1] forall x.
S.length (stream x) = length x
#-}
compareLength :: JSString -> Int -> Ordering
compareLength :: JSString -> Int -> Ordering
compareLength = (Text -> Int -> Ordering) -> JSString -> Int -> Ordering
forall a b. Coercible a b => a -> b
coerce Text -> Int -> Ordering
T.compareLength
{-# INLINE [1] compareLength #-}
{-# RULES
"JSSTRING compareN/length -> compareLength" [~1] forall t n.
compare (length t) n = compareLength t n
#-}
{-# RULES
"JSSTRING ==N/length -> compareLength/==EQ" [~1] forall t n.
(==) (length t) n = compareLength t n == EQ
#-}
{-# RULES
"JSSTRING /=N/length -> compareLength//=EQ" [~1] forall t n.
(/=) (length t) n = compareLength t n /= EQ
#-}
{-# RULES
"JSSTRING <N/length -> compareLength/==LT" [~1] forall t n.
(<) (length t) n = compareLength t n == LT
#-}
{-# RULES
"JSSTRING <=N/length -> compareLength//=GT" [~1] forall t n.
(<=) (length t) n = compareLength t n /= GT
#-}
{-# RULES
"JSSTRING >N/length -> compareLength/==GT" [~1] forall t n.
(>) (length t) n = compareLength t n == GT
#-}
{-# RULES
"JSSTRING >=N/length -> compareLength//=LT" [~1] forall t n.
(>=) (length t) n = compareLength t n /= LT
#-}
map :: (Char -> Char) -> JSString -> JSString
map :: (Char -> Char) -> JSString -> JSString
map = ((Char -> Char) -> Text -> Text)
-> (Char -> Char) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Char) -> Text -> Text
T.map
{-# INLINE [1] map #-}
intercalate :: JSString -> [JSString] -> JSString
intercalate :: JSString -> [JSString] -> JSString
intercalate = (Text -> [Text] -> Text) -> JSString -> [JSString] -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> [Text] -> Text
T.intercalate
{-# INLINE [1] intercalate #-}
intersperse :: Char -> JSString -> JSString
intersperse :: Char -> JSString -> JSString
intersperse = (Char -> Text -> Text) -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Char -> Text -> Text
T.intersperse
{-# INLINE [1] intersperse #-}
{-# RULES
"JSSTRING intersperse -> fused" [~1] forall c x.
intersperse c x = unstream (S.intersperse (safe c) (stream x))
"JSSTRING intersperse -> unfused" [1] forall c x.
unstream (S.intersperse (safe c) (stream x)) = intersperse c x
#-}
reverse :: JSString -> JSString
reverse :: JSString -> JSString
reverse = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.reverse
{-# INLINE [1] reverse #-}
{-# RULES
"JSSTRING reverse -> fused" [~1] forall x.
reverse x = S.reverse (stream x)
"JSSTRING reverse -> unfused" [1] forall x.
S.reverse (stream x) = reverse x
#-}
replace :: JSString
-> JSString
-> JSString
-> JSString
replace :: JSString -> JSString -> JSString -> JSString
replace = (Text -> Text -> Text -> Text)
-> JSString -> JSString -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> Text -> Text
Text -> Text -> Text -> Text
T.replace
{-# INLINE replace #-}
toCaseFold :: JSString -> JSString
toCaseFold :: JSString -> JSString
toCaseFold = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.toCaseFold
{-# INLINE [0] toCaseFold #-}
toLower :: JSString -> JSString
toLower :: JSString -> JSString
toLower = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.toLower
{-# INLINE [1] toLower #-}
{-# RULES
"JSSTRING toLower -> fused" [~1] forall x.
toLower x = unstream (S.toLower (stream x))
"JSSTRING toLower -> unfused" [1] forall x.
unstream (S.toLower (stream x)) = toLower x
#-}
toUpper :: JSString -> JSString
toUpper :: JSString -> JSString
toUpper = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.toUpper
{-# INLINE [1] toUpper #-}
{-# RULES
"JSSTRING toUpper -> fused" [~1] forall x.
toUpper x = unstream (S.toUpper(stream x))
"JSSTRING toUpper -> unfused" [1] forall x.
unstream (S.toUpper (stream x)) = toUpper x
#-}
toTitle :: JSString -> JSString
toTitle :: JSString -> JSString
toTitle = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.toTitle
{-# INLINE toTitle #-}
justifyLeft :: Int -> Char -> JSString -> JSString
justifyLeft :: Int -> Char -> JSString -> JSString
justifyLeft = (Int -> Char -> Text -> Text)
-> Int -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Char -> Text -> Text
T.justifyLeft
{-# INLINE [1] justifyLeft #-}
{-# RULES
"JSSTRING justifyLeft -> fused" [~1] forall k c t.
justifyLeft k c t = unstream (S.justifyLeftI k c (stream t))
"JSSTRING justifyLeft -> unfused" [1] forall k c t.
unstream (S.justifyLeftI k c (stream t)) = justifyLeft k c t
#-}
justifyRight :: Int -> Char -> JSString -> JSString
justifyRight :: Int -> Char -> JSString -> JSString
justifyRight = (Int -> Char -> Text -> Text)
-> Int -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Char -> Text -> Text
T.justifyRight
{-# INLINE justifyRight #-}
center :: Int -> Char -> JSString -> JSString
center :: Int -> Char -> JSString -> JSString
center = (Int -> Char -> Text -> Text)
-> Int -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Char -> Text -> Text
T.center
{-# INLINE center #-}
transpose :: [JSString] -> [JSString]
transpose :: [JSString] -> [JSString]
transpose = ([Text] -> [Text]) -> [JSString] -> [JSString]
forall a b. Coercible a b => a -> b
coerce [Text] -> [Text]
T.transpose
foldl :: (a -> Char -> a) -> a -> JSString -> a
foldl :: forall a. (a -> Char -> a) -> a -> JSString -> a
foldl a -> Char -> a
f = (a -> Text -> a) -> a -> JSString -> a
forall a b. Coercible a b => a -> b
coerce ((a -> Char -> a) -> a -> Text -> a
forall a. (a -> Char -> a) -> a -> Text -> a
T.foldl a -> Char -> a
f)
{-# INLINE foldl #-}
foldl' :: (a -> Char -> a) -> a -> JSString -> a
foldl' :: forall a. (a -> Char -> a) -> a -> JSString -> a
foldl' a -> Char -> a
f = (a -> Text -> a) -> a -> JSString -> a
forall a b. Coercible a b => a -> b
coerce ((a -> Char -> a) -> a -> Text -> a
forall a. (a -> Char -> a) -> a -> Text -> a
T.foldl' a -> Char -> a
f)
{-# INLINE foldl' #-}
foldl1 :: (Char -> Char -> Char) -> JSString -> Char
foldl1 :: (Char -> Char -> Char) -> JSString -> Char
foldl1 = ((Char -> Char -> Char) -> Text -> Char)
-> (Char -> Char -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => (Char -> Char -> Char) -> Text -> Char
(Char -> Char -> Char) -> Text -> Char
T.foldl1
{-# INLINE foldl1 #-}
foldl1' :: (Char -> Char -> Char) -> JSString -> Char
foldl1' :: (Char -> Char -> Char) -> JSString -> Char
foldl1' = ((Char -> Char -> Char) -> Text -> Char)
-> (Char -> Char -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => (Char -> Char -> Char) -> Text -> Char
(Char -> Char -> Char) -> Text -> Char
T.foldl1'
{-# INLINE foldl1' #-}
foldr :: (Char -> a -> a) -> a -> JSString -> a
foldr :: forall a. (Char -> a -> a) -> a -> JSString -> a
foldr Char -> a -> a
f = (a -> Text -> a) -> a -> JSString -> a
forall a b. Coercible a b => a -> b
coerce ((Char -> a -> a) -> a -> Text -> a
forall a. (Char -> a -> a) -> a -> Text -> a
T.foldr Char -> a -> a
f)
{-# INLINE foldr #-}
foldr1 :: (Char -> Char -> Char) -> JSString -> Char
foldr1 :: (Char -> Char -> Char) -> JSString -> Char
foldr1 = ((Char -> Char -> Char) -> Text -> Char)
-> (Char -> Char -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => (Char -> Char -> Char) -> Text -> Char
(Char -> Char -> Char) -> Text -> Char
T.foldr1
{-# INLINE foldr1 #-}
concat :: [JSString] -> JSString
concat :: [JSString] -> JSString
concat = ([Text] -> Text) -> [JSString] -> JSString
forall a b. Coercible a b => a -> b
coerce [Text] -> Text
T.concat
concatMap :: (Char -> JSString) -> JSString -> JSString
concatMap :: (Char -> JSString) -> JSString -> JSString
concatMap = ((Char -> Text) -> Text -> Text)
-> (Char -> JSString) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Text) -> Text -> Text
T.concatMap
{-# INLINE concatMap #-}
any :: (Char -> Bool) -> JSString -> Bool
any :: (Char -> Bool) -> JSString -> Bool
any = ((Char -> Bool) -> Text -> Bool)
-> (Char -> Bool) -> JSString -> Bool
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Bool
T.any
{-# INLINE any #-}
all :: (Char -> Bool) -> JSString -> Bool
all :: (Char -> Bool) -> JSString -> Bool
all = ((Char -> Bool) -> Text -> Bool)
-> (Char -> Bool) -> JSString -> Bool
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Bool
T.all
{-# INLINE all #-}
maximum :: JSString -> Char
maximum :: JSString -> Char
maximum = (Text -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Char
Text -> Char
T.maximum
{-# INLINE maximum #-}
minimum :: JSString -> Char
minimum :: JSString -> Char
minimum = (Text -> Char) -> JSString -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Char
Text -> Char
T.minimum
{-# INLINE minimum #-}
scanl :: (Char -> Char -> Char) -> Char -> JSString -> JSString
scanl :: (Char -> Char -> Char) -> Char -> JSString -> JSString
scanl = ((Char -> Char -> Char) -> Char -> Text -> Text)
-> (Char -> Char -> Char) -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Char -> Char) -> Char -> Text -> Text
T.scanl
{-# INLINE scanl #-}
scanl1 :: (Char -> Char -> Char) -> JSString -> JSString
scanl1 :: (Char -> Char -> Char) -> JSString -> JSString
scanl1 = ((Char -> Char -> Char) -> Text -> Text)
-> (Char -> Char -> Char) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Char -> Char) -> Text -> Text
T.scanl1
{-# INLINE scanl1 #-}
scanr :: (Char -> Char -> Char) -> Char -> JSString -> JSString
scanr :: (Char -> Char -> Char) -> Char -> JSString -> JSString
scanr = ((Char -> Char -> Char) -> Char -> Text -> Text)
-> (Char -> Char -> Char) -> Char -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Char -> Char) -> Char -> Text -> Text
T.scanr
{-# INLINE scanr #-}
scanr1 :: (Char -> Char -> Char) -> JSString -> JSString
scanr1 :: (Char -> Char -> Char) -> JSString -> JSString
scanr1 = ((Char -> Char -> Char) -> Text -> Text)
-> (Char -> Char -> Char) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Char -> Char) -> Text -> Text
T.scanr1
{-# INLINE scanr1 #-}
mapAccumL :: (a -> Char -> (a,Char)) -> a -> JSString -> (a, JSString)
mapAccumL :: forall a.
(a -> Char -> (a, Char)) -> a -> JSString -> (a, JSString)
mapAccumL a -> Char -> (a, Char)
f = (a -> Text -> (a, Text)) -> a -> JSString -> (a, JSString)
forall a b. Coercible a b => a -> b
coerce ((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)
{-# INLINE mapAccumL #-}
mapAccumR :: (a -> Char -> (a,Char)) -> a -> JSString -> (a, JSString)
mapAccumR :: forall a.
(a -> Char -> (a, Char)) -> a -> JSString -> (a, JSString)
mapAccumR a -> Char -> (a, Char)
f = (a -> Text -> (a, Text)) -> a -> JSString -> (a, JSString)
forall a b. Coercible a b => a -> b
coerce ((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)
{-# INLINE mapAccumR #-}
replicate :: Int -> JSString -> JSString
replicate :: Int -> JSString -> JSString
replicate = (Int -> Text -> Text) -> Int -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Text -> Text
T.replicate
{-# INLINE [1] replicate #-}
unfoldr :: (a -> Maybe (Char,a)) -> a -> JSString
unfoldr :: forall a. (a -> Maybe (Char, a)) -> a -> JSString
unfoldr a -> Maybe (Char, a)
f = (a -> Text) -> a -> JSString
forall a b. Coercible a b => a -> b
coerce ((a -> Maybe (Char, a)) -> a -> Text
forall a. (a -> Maybe (Char, a)) -> a -> Text
T.unfoldr a -> Maybe (Char, a)
f)
{-# INLINE unfoldr #-}
unfoldrN :: Int -> (a -> Maybe (Char,a)) -> a -> JSString
unfoldrN :: forall a. Int -> (a -> Maybe (Char, a)) -> a -> JSString
unfoldrN Int
n a -> Maybe (Char, a)
f = (a -> Text) -> a -> JSString
forall a b. Coercible a b => a -> b
coerce (Int -> (a -> Maybe (Char, a)) -> a -> Text
forall a. Int -> (a -> Maybe (Char, a)) -> a -> Text
T.unfoldrN Int
n a -> Maybe (Char, a)
f)
{-# INLINE unfoldrN #-}
take :: Int -> JSString -> JSString
take :: Int -> JSString -> JSString
take = (Int -> Text -> Text) -> Int -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Text -> Text
T.take
{-# INLINE [1] take #-}
{-# RULES
"JSSTRING take -> fused" [~1] forall n t.
take n t = unstream (S.take n (stream t))
"JSSTRING take -> unfused" [1] forall n t.
unstream (S.take n (stream t)) = take n t
#-}
takeEnd :: Int -> JSString -> JSString
takeEnd :: Int -> JSString -> JSString
takeEnd = (Int -> Text -> Text) -> Int -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Text -> Text
T.takeEnd
drop :: Int -> JSString -> JSString
drop :: Int -> JSString -> JSString
drop = (Int -> Text -> Text) -> Int -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Text -> Text
T.drop
{-# INLINE [1] drop #-}
{-# RULES
"JSSTRING drop -> fused" [~1] forall n t.
drop n t = unstream (S.drop n (stream t))
"JSSTRING drop -> unfused" [1] forall n t.
unstream (S.drop n (stream t)) = drop n t
#-}
dropEnd :: Int -> JSString -> JSString
dropEnd :: Int -> JSString -> JSString
dropEnd = (Int -> Text -> Text) -> Int -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Int -> Text -> Text
T.dropEnd
takeWhile :: (Char -> Bool) -> JSString -> JSString
takeWhile :: (Char -> Bool) -> JSString -> JSString
takeWhile = ((Char -> Bool) -> Text -> Text)
-> (Char -> Bool) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Text
T.takeWhile
{-# INLINE [1] takeWhile #-}
{-# RULES
"TEXT takeWhile -> fused" [~1] forall p t.
takeWhile p t = unstream (S.takeWhile p (stream t))
"TEXT takeWhile -> unfused" [1] forall p t.
unstream (S.takeWhile p (stream t)) = takeWhile p t
#-}
dropWhile :: (Char -> Bool) -> JSString -> JSString
dropWhile :: (Char -> Bool) -> JSString -> JSString
dropWhile = ((Char -> Bool) -> Text -> Text)
-> (Char -> Bool) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Text
T.dropWhile
{-# INLINE [1] dropWhile #-}
{-# RULES
"TEXT dropWhile -> fused" [~1] forall p t.
dropWhile p t = unstream (S.dropWhile p (stream t))
"TEXT dropWhile -> unfused" [1] forall p t.
unstream (S.dropWhile p (stream t)) = dropWhile p t
#-}
dropWhileEnd :: (Char -> Bool) -> JSString -> JSString
dropWhileEnd :: (Char -> Bool) -> JSString -> JSString
dropWhileEnd = ((Char -> Bool) -> Text -> Text)
-> (Char -> Bool) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Text
T.dropWhileEnd
{-# INLINE [1] dropWhileEnd #-}
{-# RULES
"TEXT dropWhileEnd -> fused" [~1] forall p t.
dropWhileEnd p t = S.reverse (S.dropWhile p (S.reverseStream t))
"TEXT dropWhileEnd -> unfused" [1] forall p t.
S.reverse (S.dropWhile p (S.reverseStream t)) = dropWhileEnd p t
#-}
dropAround :: (Char -> Bool) -> JSString -> JSString
dropAround :: (Char -> Bool) -> JSString -> JSString
dropAround = ((Char -> Bool) -> Text -> Text)
-> (Char -> Bool) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Text
T.dropAround
{-# INLINE [1] dropAround #-}
stripStart :: JSString -> JSString
stripStart :: JSString -> JSString
stripStart = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.stripStart
{-# INLINE [1] stripStart #-}
stripEnd :: JSString -> JSString
stripEnd :: JSString -> JSString
stripEnd = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.stripEnd
{-# INLINE [1] stripEnd #-}
strip :: JSString -> JSString
strip :: JSString -> JSString
strip = (Text -> Text) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text
T.strip
{-# INLINE [1] strip #-}
splitAt :: Int -> JSString -> (JSString, JSString)
splitAt :: Int -> JSString -> (JSString, JSString)
splitAt = (Int -> Text -> (Text, Text))
-> Int -> JSString -> (JSString, JSString)
forall a b. Coercible a b => a -> b
coerce Int -> Text -> (Text, Text)
T.splitAt
{-# INLINE splitAt #-}
span :: (Char -> Bool) -> JSString -> (JSString, JSString)
span :: (Char -> Bool) -> JSString -> (JSString, JSString)
span = ((Char -> Bool) -> Text -> (Text, Text))
-> (Char -> Bool) -> JSString -> (JSString, JSString)
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> (Text, Text)
T.span
{-# INLINE span #-}
break :: (Char -> Bool) -> JSString -> (JSString, JSString)
break :: (Char -> Bool) -> JSString -> (JSString, JSString)
break = ((Char -> Bool) -> Text -> (Text, Text))
-> (Char -> Bool) -> JSString -> (JSString, JSString)
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> (Text, Text)
T.break
{-# INLINE break #-}
groupBy :: (Char -> Char -> Bool) -> JSString -> [JSString]
groupBy :: (Char -> Char -> Bool) -> JSString -> [JSString]
groupBy = ((Char -> Char -> Bool) -> Text -> [Text])
-> (Char -> Char -> Bool) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce (Char -> Char -> Bool) -> Text -> [Text]
T.groupBy
group :: JSString -> [JSString]
group :: JSString -> [JSString]
group = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.group
{-# INLINE group #-}
group' :: JSString -> [JSString]
group' :: JSString -> [JSString]
group' = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.group
{-# INLINE group' #-}
inits :: JSString -> [JSString]
inits :: JSString -> [JSString]
inits = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.inits
tails :: JSString -> [JSString]
tails :: JSString -> [JSString]
tails = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.tails
splitOn :: JSString
-> JSString
-> [JSString]
splitOn :: JSString -> JSString -> [JSString]
splitOn = (Text -> Text -> [Text]) -> JSString -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> [Text]
Text -> Text -> [Text]
T.splitOn
{-# INLINE [1] splitOn #-}
splitOn' :: JSString
-> JSString
-> [JSString]
splitOn' :: JSString -> JSString -> [JSString]
splitOn' = (Text -> Text -> [Text]) -> JSString -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> [Text]
Text -> Text -> [Text]
T.splitOn
{-# NOINLINE splitOn' #-}
split :: (Char -> Bool) -> JSString -> [JSString]
split :: (Char -> Bool) -> JSString -> [JSString]
split = ((Char -> Bool) -> Text -> [Text])
-> (Char -> Bool) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> [Text]
T.split
{-# INLINE split #-}
chunksOf :: Int -> JSString -> [JSString]
chunksOf :: Int -> JSString -> [JSString]
chunksOf = (Int -> Text -> [Text]) -> Int -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Int -> Text -> [Text]
T.chunksOf
{-# INLINE chunksOf #-}
chunksOf' :: Int -> JSString -> [JSString]
chunksOf' :: Int -> JSString -> [JSString]
chunksOf' = (Int -> Text -> [Text]) -> Int -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Int -> Text -> [Text]
T.chunksOf
{-# INLINE chunksOf' #-}
find :: (Char -> Bool) -> JSString -> Maybe Char
find :: (Char -> Bool) -> JSString -> Maybe Char
find = ((Char -> Bool) -> Text -> Maybe Char)
-> (Char -> Bool) -> JSString -> Maybe Char
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Maybe Char
T.find
{-# INLINE find #-}
partition :: (Char -> Bool) -> JSString -> (JSString, JSString)
partition :: (Char -> Bool) -> JSString -> (JSString, JSString)
partition = ((Char -> Bool) -> Text -> (Text, Text))
-> (Char -> Bool) -> JSString -> (JSString, JSString)
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> (Text, Text)
T.partition
{-# INLINE partition #-}
filter :: (Char -> Bool) -> JSString -> JSString
filter :: (Char -> Bool) -> JSString -> JSString
filter = ((Char -> Bool) -> Text -> Text)
-> (Char -> Bool) -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Text
T.filter
{-# INLINE filter #-}
breakOn :: JSString -> JSString -> (JSString, JSString)
breakOn :: JSString -> JSString -> (JSString, JSString)
breakOn = (Text -> Text -> (Text, Text))
-> JSString -> JSString -> (JSString, JSString)
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> (Text, Text)
Text -> Text -> (Text, Text)
T.breakOn
{-# INLINE breakOn #-}
breakOnEnd :: JSString -> JSString -> (JSString, JSString)
breakOnEnd :: JSString -> JSString -> (JSString, JSString)
breakOnEnd = (Text -> Text -> (Text, Text))
-> JSString -> JSString -> (JSString, JSString)
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> (Text, Text)
Text -> Text -> (Text, Text)
T.breakOnEnd
{-# INLINE breakOnEnd #-}
breakOnAll :: JSString
-> JSString
-> [(JSString, JSString)]
breakOnAll :: JSString -> JSString -> [(JSString, JSString)]
breakOnAll = (Text -> Text -> [(Text, Text)])
-> JSString -> JSString -> [(JSString, JSString)]
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> [(Text, Text)]
Text -> Text -> [(Text, Text)]
T.breakOnAll
{-# INLINE breakOnAll #-}
breakOnAll' :: JSString
-> JSString
-> [(JSString, JSString)]
breakOnAll' :: JSString -> JSString -> [(JSString, JSString)]
breakOnAll' = (Text -> Text -> [(Text, Text)])
-> JSString -> JSString -> [(JSString, JSString)]
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> [(Text, Text)]
Text -> Text -> [(Text, Text)]
T.breakOnAll
{-# INLINE breakOnAll' #-}
index :: JSString -> Int -> Char
index :: JSString -> Int -> Char
index = (Text -> Int -> Char) -> JSString -> Int -> Char
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Int -> Char
Text -> Int -> Char
T.index
{-# INLINE index #-}
findIndex :: (Char -> Bool) -> JSString -> Maybe Int
findIndex :: (Char -> Bool) -> JSString -> Maybe Int
findIndex = ((Char -> Bool) -> Text -> Maybe Int)
-> (Char -> Bool) -> JSString -> Maybe Int
forall a b. Coercible a b => a -> b
coerce (Char -> Bool) -> Text -> Maybe Int
T.findIndex
{-# INLINE findIndex #-}
count :: JSString -> JSString -> Int
count :: JSString -> JSString -> Int
count = (Text -> Text -> Int) -> JSString -> JSString -> Int
forall a b. Coercible a b => a -> b
coerce HasCallStack => Text -> Text -> Int
Text -> Text -> Int
T.count
{-# INLINE [1] count #-}
zip :: JSString -> JSString -> [(Char,Char)]
zip :: JSString -> JSString -> [(Char, Char)]
zip = (Text -> Text -> [(Char, Char)])
-> JSString -> JSString -> [(Char, Char)]
forall a b. Coercible a b => a -> b
coerce Text -> Text -> [(Char, Char)]
T.zip
{-# INLINE [0] zip #-}
zipWith :: (Char -> Char -> Char) -> JSString -> JSString -> JSString
zipWith :: (Char -> Char -> Char) -> JSString -> JSString -> JSString
zipWith = ((Char -> Char -> Char) -> Text -> Text -> Text)
-> (Char -> Char -> Char) -> JSString -> JSString -> JSString
forall a b. Coercible a b => a -> b
coerce (Char -> Char -> Char) -> Text -> Text -> Text
T.zipWith
{-# INLINE [0] zipWith #-}
words :: JSString -> [JSString]
words :: JSString -> [JSString]
words = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.words
{-# INLINE words #-}
words' :: JSString -> [JSString]
words' :: JSString -> [JSString]
words' = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.words
{-# INLINE words' #-}
lines :: JSString -> [JSString]
lines :: JSString -> [JSString]
lines = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.lines
{-# INLINE lines #-}
lines' :: JSString -> [JSString]
lines' :: JSString -> [JSString]
lines' = (Text -> [Text]) -> JSString -> [JSString]
forall a b. Coercible a b => a -> b
coerce Text -> [Text]
T.lines
{-# INLINE lines' #-}
unlines :: [JSString] -> JSString
unlines :: [JSString] -> JSString
unlines = ([Text] -> Text) -> [JSString] -> JSString
forall a b. Coercible a b => a -> b
coerce [Text] -> Text
T.unlines
{-# INLINE unlines #-}
unwords :: [JSString] -> JSString
unwords :: [JSString] -> JSString
unwords = ([Text] -> Text) -> [JSString] -> JSString
forall a b. Coercible a b => a -> b
coerce [Text] -> Text
T.unwords
{-# INLINE unwords #-}
isPrefixOf :: JSString -> JSString -> Bool
isPrefixOf :: JSString -> JSString -> Bool
isPrefixOf = (Text -> Text -> Bool) -> JSString -> JSString -> Bool
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Bool
T.isPrefixOf
{-# INLINE [1] isPrefixOf #-}
{-# RULES
"JSSTRING isPrefixOf -> fused" [~1] forall x y.
isPrefixOf x y = S.isPrefixOf (stream x) (stream y)
"JSSTRING isPrefixOf -> unfused" [1] forall x y.
S.isPrefixOf (stream x) (stream y) = isPrefixOf x y
#-}
isSuffixOf :: JSString -> JSString -> Bool
isSuffixOf :: JSString -> JSString -> Bool
isSuffixOf = (Text -> Text -> Bool) -> JSString -> JSString -> Bool
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Bool
T.isSuffixOf
{-# INLINE isSuffixOf #-}
isInfixOf :: JSString -> JSString -> Bool
isInfixOf :: JSString -> JSString -> Bool
isInfixOf = (Text -> Text -> Bool) -> JSString -> JSString -> Bool
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Bool
T.isInfixOf
{-# INLINE [1] isInfixOf #-}
{-# RULES
"JSSTRING isInfixOf/singleton -> S.elem/S.stream" [~1] forall n h.
isInfixOf (singleton n) h = S.elem n (S.stream h)
#-}
stripPrefix :: JSString -> JSString -> Maybe JSString
stripPrefix :: JSString -> JSString -> Maybe JSString
stripPrefix = (Text -> Text -> Maybe Text)
-> JSString -> JSString -> Maybe JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Maybe Text
T.stripPrefix
{-# INLINE stripPrefix #-}
commonPrefixes :: JSString -> JSString -> Maybe (JSString,JSString,JSString)
commonPrefixes :: JSString -> JSString -> Maybe (JSString, JSString, JSString)
commonPrefixes = (Text -> Text -> Maybe (Text, Text, Text))
-> JSString -> JSString -> Maybe (JSString, JSString, JSString)
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Maybe (Text, Text, Text)
T.commonPrefixes
{-# INLINE commonPrefixes #-}
stripSuffix :: JSString -> JSString -> Maybe JSString
stripSuffix :: JSString -> JSString -> Maybe JSString
stripSuffix = (Text -> Text -> Maybe Text)
-> JSString -> JSString -> Maybe JSString
forall a b. Coercible a b => a -> b
coerce Text -> Text -> Maybe Text
T.stripSuffix
{-# INLINE stripSuffix #-}