{-# LANGUAGE MagicHash #-}
{-# LANGUAGE OverloadedStrings #-}
module RIO.Text
(
Data.Text.Text
, Data.Text.pack
, Data.Text.unpack
, Data.Text.singleton
, Data.Text.empty
, Data.Text.cons
, Data.Text.snoc
, Data.Text.append
, Data.Text.uncons
, Data.Text.null
, Data.Text.length
, Data.Text.compareLength
, Data.Text.map
, Data.Text.intercalate
, Data.Text.intersperse
, Data.Text.transpose
, Data.Text.reverse
, Data.Text.toCaseFold
, Data.Text.toLower
, Data.Text.toUpper
, Data.Text.toTitle
, Data.Text.justifyLeft
, Data.Text.justifyRight
, Data.Text.center
, Data.Text.foldl
, Data.Text.foldl'
, Data.Text.foldr
, Data.Text.concat
, Data.Text.concatMap
, Data.Text.any
, Data.Text.all
, Data.Text.scanl
, Data.Text.scanl1
, Data.Text.scanr
, Data.Text.scanr1
, Data.Text.mapAccumL
, Data.Text.mapAccumR
, Data.Text.replicate
, Data.Text.unfoldr
, Data.Text.unfoldrN
, Data.Text.take
, Data.Text.takeEnd
, Data.Text.drop
, Data.Text.dropEnd
, Data.Text.takeWhile
, Data.Text.takeWhileEnd
, Data.Text.dropWhile
, Data.Text.dropWhileEnd
, Data.Text.dropAround
, Data.Text.strip
, Data.Text.stripStart
, Data.Text.stripEnd
, Data.Text.splitAt
, Data.Text.break
, Data.Text.span
, Data.Text.group
, Data.Text.groupBy
, Data.Text.inits
, Data.Text.tails
, Data.Text.split
, Data.Text.chunksOf
, Data.Text.lines
, linesCR
, Data.Text.words
, Data.Text.unlines
, Data.Text.unwords
, Data.Text.isPrefixOf
, Data.Text.isSuffixOf
, Data.Text.isInfixOf
, Data.Text.stripPrefix
, Data.Text.stripSuffix
, dropPrefix
, dropSuffix
, Data.Text.commonPrefixes
, Data.Text.filter
, Data.Text.find
, Data.Text.partition
, Data.Text.index
, Data.Text.findIndex
, Data.Text.zip
, Data.Text.zipWith
, Data.Text.copy
, Data.Text.unpackCString#
, Data.Text.Encoding.encodeUtf8
, Data.Text.Encoding.decodeUtf8With
, Data.Text.Encoding.decodeUtf8'
, Data.Text.Encoding.Error.lenientDecode
) where
import Data.Maybe (fromMaybe)
import Data.Text (Text, stripPrefix, stripSuffix)
import qualified Data.Text
import qualified Data.Text.Encoding
import qualified Data.Text.Encoding.Error
dropPrefix :: Text
-> Text
-> Text
dropPrefix :: Text -> Text -> Text
dropPrefix Text
prefix Text
t = Text -> Maybe Text -> Text
forall a. a -> Maybe a -> a
fromMaybe Text
t (Text -> Text -> Maybe Text
stripPrefix Text
prefix Text
t)
dropSuffix :: Text
-> Text
-> Text
dropSuffix :: Text -> Text -> Text
dropSuffix Text
suffix Text
t = Text -> Maybe Text -> Text
forall a. a -> Maybe a -> a
fromMaybe Text
t (Text -> Text -> Maybe Text
stripSuffix Text
suffix Text
t)
linesCR :: Text -> [Text]
linesCR :: Text -> [Text]
linesCR = (Text -> Text) -> [Text] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
map (Text -> Text -> Text
dropSuffix Text
"\r") ([Text] -> [Text]) -> (Text -> [Text]) -> Text -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> [Text]
Data.Text.lines