{-# LANGUAGE CPP
,MultiParamTypeClasses
,FlexibleInstances
,TypeFamilies
,TypeSynonymInstances
,GeneralizedNewtypeDeriving #-}
module Data.ListLike.CharString (
CharString (..)
,CharStringLazy (..)
)
where
import Prelude hiding (length, head, last, null, tail, map, filter, concat,
any, lookup, init, all, foldl, foldr, foldl1, foldr1,
maximum, minimum, iterate, span, break, takeWhile,
dropWhile, reverse, zip, zipWith, sequence,
sequence_, mapM, mapM_, concatMap, and, or, sum,
product, repeat, replicate, cycle, take, drop,
splitAt, elem, notElem, unzip, lines, words,
unlines, unwords)
import Data.ListLike.Base
import Data.ListLike.String
import Data.ListLike.IO
import Data.ListLike.FoldableLL
import Data.Int
#if !MIN_VERSION_base(4,11,0)
import Data.Semigroup (Semigroup(..))
#endif
import Data.String (IsString(..))
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Control.Arrow
import GHC.Exts (IsList(..))
newtype CharString = CS { CharString -> ByteString
unCS :: BS.ByteString }
deriving (ReadPrec [CharString]
ReadPrec CharString
Int -> ReadS CharString
ReadS [CharString]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CharString]
$creadListPrec :: ReadPrec [CharString]
readPrec :: ReadPrec CharString
$creadPrec :: ReadPrec CharString
readList :: ReadS [CharString]
$creadList :: ReadS [CharString]
readsPrec :: Int -> ReadS CharString
$creadsPrec :: Int -> ReadS CharString
Read, Int -> CharString -> ShowS
[CharString] -> ShowS
CharString -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CharString] -> ShowS
$cshowList :: [CharString] -> ShowS
show :: CharString -> String
$cshow :: CharString -> String
showsPrec :: Int -> CharString -> ShowS
$cshowsPrec :: Int -> CharString -> ShowS
Show, CharString -> CharString -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CharString -> CharString -> Bool
$c/= :: CharString -> CharString -> Bool
== :: CharString -> CharString -> Bool
$c== :: CharString -> CharString -> Bool
Eq, Eq CharString
CharString -> CharString -> Bool
CharString -> CharString -> Ordering
CharString -> CharString -> CharString
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CharString -> CharString -> CharString
$cmin :: CharString -> CharString -> CharString
max :: CharString -> CharString -> CharString
$cmax :: CharString -> CharString -> CharString
>= :: CharString -> CharString -> Bool
$c>= :: CharString -> CharString -> Bool
> :: CharString -> CharString -> Bool
$c> :: CharString -> CharString -> Bool
<= :: CharString -> CharString -> Bool
$c<= :: CharString -> CharString -> Bool
< :: CharString -> CharString -> Bool
$c< :: CharString -> CharString -> Bool
compare :: CharString -> CharString -> Ordering
$ccompare :: CharString -> CharString -> Ordering
Ord, NonEmpty CharString -> CharString
CharString -> CharString -> CharString
forall b. Integral b => b -> CharString -> CharString
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: forall b. Integral b => b -> CharString -> CharString
$cstimes :: forall b. Integral b => b -> CharString -> CharString
sconcat :: NonEmpty CharString -> CharString
$csconcat :: NonEmpty CharString -> CharString
<> :: CharString -> CharString -> CharString
$c<> :: CharString -> CharString -> CharString
Semigroup, Semigroup CharString
CharString
[CharString] -> CharString
CharString -> CharString -> CharString
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [CharString] -> CharString
$cmconcat :: [CharString] -> CharString
mappend :: CharString -> CharString -> CharString
$cmappend :: CharString -> CharString -> CharString
mempty :: CharString
$cmempty :: CharString
Monoid)
instance FoldableLL CharString Char where
foldl :: forall a. (a -> Char -> a) -> a -> CharString -> a
foldl a -> Char -> a
f a
i0 CharString
ls = forall a. (a -> Char -> a) -> a -> ByteString -> a
BS.foldl a -> Char -> a
f a
i0 (CharString -> ByteString
unCS CharString
ls)
foldl' :: forall a. (a -> Char -> a) -> a -> CharString -> a
foldl' a -> Char -> a
f a
i0 CharString
ls = forall a. (a -> Char -> a) -> a -> ByteString -> a
BS.foldl' a -> Char -> a
f a
i0 (CharString -> ByteString
unCS CharString
ls)
foldl1 :: (Char -> Char -> Char) -> CharString -> Char
foldl1 Char -> Char -> Char
f CharString
ls = (Char -> Char -> Char) -> ByteString -> Char
BS.foldl1 Char -> Char -> Char
f (CharString -> ByteString
unCS CharString
ls)
foldr :: forall b. (Char -> b -> b) -> b -> CharString -> b
foldr Char -> b -> b
f b
i0 CharString
ls = forall a. (Char -> a -> a) -> a -> ByteString -> a
BS.foldr Char -> b -> b
f b
i0 (CharString -> ByteString
unCS CharString
ls)
foldr1 :: (Char -> Char -> Char) -> CharString -> Char
foldr1 Char -> Char -> Char
f CharString
ls = (Char -> Char -> Char) -> ByteString -> Char
BS.foldr1 Char -> Char -> Char
f (CharString -> ByteString
unCS CharString
ls)
instance IsList CharString where
type Item CharString = Char
toList :: CharString -> [Item CharString]
toList = ByteString -> String
BS.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
fromList :: [Item CharString] -> CharString
fromList = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
BS.pack
instance ListLike CharString Char where
empty :: CharString
empty = ByteString -> CharString
CS ByteString
BS.empty
singleton :: Char -> CharString
singleton = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ByteString
BS.singleton
cons :: Char -> CharString -> CharString
cons Char
x CharString
l = ByteString -> CharString
CS (Char -> ByteString -> ByteString
BS.cons Char
x (CharString -> ByteString
unCS CharString
l))
snoc :: CharString -> Char -> CharString
snoc CharString
l Char
x = ByteString -> CharString
CS (ByteString -> Char -> ByteString
BS.snoc (CharString -> ByteString
unCS CharString
l) Char
x)
append :: CharString -> CharString -> CharString
append CharString
l CharString
r = ByteString -> CharString
CS forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> ByteString
BS.append (CharString -> ByteString
unCS CharString
l) (CharString -> ByteString
unCS CharString
r)
head :: CharString -> Char
head = ByteString -> Char
BS.head forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
last :: CharString -> Char
last = ByteString -> Char
BS.last forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
tail :: CharString -> CharString
tail = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. HasCallStack => ByteString -> ByteString
BS.tail forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
init :: CharString -> CharString
init = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. HasCallStack => ByteString -> ByteString
BS.init forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
null :: CharString -> Bool
null = ByteString -> Bool
BS.null forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
length :: CharString -> Int
length = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int
BS.length forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
rigidMap :: (Char -> Char) -> CharString -> CharString
rigidMap Char -> Char
f = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Char) -> ByteString -> ByteString
BS.map Char -> Char
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
reverse :: CharString -> CharString
reverse = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
BS.reverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
concat :: forall full'. ListLike full' CharString => full' -> CharString
concat = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> ByteString
BS.concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map CharString -> ByteString
unCS forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. IsList l => l -> [Item l]
toList
rigidConcatMap :: (Char -> CharString) -> CharString -> CharString
rigidConcatMap Char -> CharString
f = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> ByteString) -> ByteString -> ByteString
BS.concatMap (CharString -> ByteString
unCS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> CharString
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
any :: (Char -> Bool) -> CharString -> Bool
any Char -> Bool
p = (Char -> Bool) -> ByteString -> Bool
BS.any Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
all :: (Char -> Bool) -> CharString -> Bool
all Char -> Bool
p = (Char -> Bool) -> ByteString -> Bool
BS.all Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
maximum :: Ord Char => CharString -> Char
maximum = ByteString -> Char
BS.maximum forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
minimum :: Ord Char => CharString -> Char
minimum = ByteString -> Char
BS.minimum forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
replicate :: Int -> Char -> CharString
replicate Int
i = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char -> ByteString
BS.replicate (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i)
take :: Int -> CharString -> CharString
take Int
i = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> ByteString
BS.take (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
drop :: Int -> CharString -> CharString
drop Int
i = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> ByteString
BS.drop (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
splitAt :: Int -> CharString -> (CharString, CharString)
splitAt Int
i = (ByteString -> CharString
CS forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharString
CS) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> (ByteString, ByteString)
BS.splitAt (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
takeWhile :: (Char -> Bool) -> CharString -> CharString
takeWhile Char -> Bool
p = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> ByteString
BS.takeWhile Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
dropWhile :: (Char -> Bool) -> CharString -> CharString
dropWhile Char -> Bool
p = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> ByteString
BS.dropWhile Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
span :: (Char -> Bool) -> CharString -> (CharString, CharString)
span Char -> Bool
p = (ByteString -> CharString
CS forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharString
CS) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> (ByteString, ByteString)
BS.span Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
break :: (Char -> Bool) -> CharString -> (CharString, CharString)
break Char -> Bool
p = (ByteString -> CharString
CS forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharString
CS) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> (ByteString, ByteString)
BS.break Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
group :: forall full'.
(ListLike full' CharString, Eq Char) =>
CharString -> full'
group = forall l. IsList l => [Item l] -> l
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
BS.group forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
inits :: forall full'. ListLike full' CharString => CharString -> full'
inits = forall l. IsList l => [Item l] -> l
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
BS.inits forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
tails :: forall full'. ListLike full' CharString => CharString -> full'
tails = forall l. IsList l => [Item l] -> l
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
BS.tails forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
isPrefixOf :: Eq Char => CharString -> CharString -> Bool
isPrefixOf CharString
p CharString
f = ByteString -> ByteString -> Bool
BS.isPrefixOf (CharString -> ByteString
unCS CharString
p) (CharString -> ByteString
unCS CharString
f)
elem :: Eq Char => Char -> CharString -> Bool
elem Char
x = Char -> ByteString -> Bool
BS.elem Char
x forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
notElem :: Eq Char => Char -> CharString -> Bool
notElem Char
x = Char -> ByteString -> Bool
BS.notElem Char
x forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
find :: (Char -> Bool) -> CharString -> Maybe Char
find Char -> Bool
p = (Char -> Bool) -> ByteString -> Maybe Char
BS.find Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
filter :: (Char -> Bool) -> CharString -> CharString
filter Char -> Bool
p = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> ByteString
BS.filter Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
index :: CharString -> Int -> Char
index CharString
l Int
i = ByteString -> Int -> Char
BS.index (CharString -> ByteString
unCS CharString
l) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i)
elemIndex :: Eq Char => Char -> CharString -> Maybe Int
elemIndex Char
i = Char -> ByteString -> Maybe Int
BS.elemIndex Char
i forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
findIndex :: (Char -> Bool) -> CharString -> Maybe Int
findIndex Char -> Bool
f = (Char -> Bool) -> ByteString -> Maybe Int
BS.findIndex Char -> Bool
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
genericLength :: forall a. Num a => CharString -> a
genericLength = forall a. Num a => Integer -> a
fromInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int
BS.length forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
genericTake :: forall b. Integral b => b -> CharString -> CharString
genericTake a
i = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> ByteString
BS.take (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
genericDrop :: forall b. Integral b => b -> CharString -> CharString
genericDrop a
i = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> ByteString
BS.drop (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
genericSplitAt :: forall a. Integral a => a -> CharString -> (CharString, CharString)
genericSplitAt a
i = (ByteString -> CharString
CS forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharString
CS) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ByteString -> (ByteString, ByteString)
BS.splitAt (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
genericReplicate :: forall a. Integral a => a -> Char -> CharString
genericReplicate a
i = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Char -> ByteString
BS.replicate (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i)
instance ListLikeIO CharString Char where
hGetLine :: Handle -> IO CharString
hGetLine Handle
h = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS forall a b. (a -> b) -> a -> b
$ Handle -> IO ByteString
BS.hGetLine Handle
h
hGetContents :: Handle -> IO CharString
hGetContents = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO ByteString
BS.hGetContents
hGet :: Handle -> Int -> IO CharString
hGet Handle
h Int
n = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS forall a b. (a -> b) -> a -> b
$ Handle -> Int -> IO ByteString
BS.hGet Handle
h Int
n
hGetNonBlocking :: Handle -> Int -> IO CharString
hGetNonBlocking Handle
h Int
n = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS forall a b. (a -> b) -> a -> b
$ Handle -> Int -> IO ByteString
BS.hGetNonBlocking Handle
h Int
n
hPutStr :: Handle -> CharString -> IO ()
hPutStr Handle
h = Handle -> ByteString -> IO ()
BS.hPut Handle
h forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
getLine :: IO CharString
getLine = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS IO ByteString
BS.getLine
getContents :: IO CharString
getContents = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS IO ByteString
BS.getContents
putStr :: CharString -> IO ()
putStr = ByteString -> IO ()
BS.putStr forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
putStrLn :: CharString -> IO ()
putStrLn = ByteString -> IO ()
BS.putStrLn forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
interact :: (CharString -> CharString) -> IO ()
interact CharString -> CharString
f = (ByteString -> ByteString) -> IO ()
BS.interact (CharString -> ByteString
unCS forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> CharString
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> CharString
CS)
readFile :: String -> IO CharString
readFile = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> IO ByteString
BS.readFile
writeFile :: String -> CharString -> IO ()
writeFile String
fp = String -> ByteString -> IO ()
BS.writeFile String
fp forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
appendFile :: String -> CharString -> IO ()
appendFile String
fp = String -> ByteString -> IO ()
BS.appendFile String
fp forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
instance IsString CharString where
fromString :: String -> CharString
fromString = ByteString -> CharString
CS forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
BS.pack
instance StringLike CharString where
toString :: CharString -> String
toString = ByteString -> String
BS.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharString -> ByteString
unCS
newtype CharStringLazy = CSL { CharStringLazy -> ByteString
unCSL :: BSL.ByteString }
deriving (ReadPrec [CharStringLazy]
ReadPrec CharStringLazy
Int -> ReadS CharStringLazy
ReadS [CharStringLazy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CharStringLazy]
$creadListPrec :: ReadPrec [CharStringLazy]
readPrec :: ReadPrec CharStringLazy
$creadPrec :: ReadPrec CharStringLazy
readList :: ReadS [CharStringLazy]
$creadList :: ReadS [CharStringLazy]
readsPrec :: Int -> ReadS CharStringLazy
$creadsPrec :: Int -> ReadS CharStringLazy
Read, Int -> CharStringLazy -> ShowS
[CharStringLazy] -> ShowS
CharStringLazy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CharStringLazy] -> ShowS
$cshowList :: [CharStringLazy] -> ShowS
show :: CharStringLazy -> String
$cshow :: CharStringLazy -> String
showsPrec :: Int -> CharStringLazy -> ShowS
$cshowsPrec :: Int -> CharStringLazy -> ShowS
Show, CharStringLazy -> CharStringLazy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CharStringLazy -> CharStringLazy -> Bool
$c/= :: CharStringLazy -> CharStringLazy -> Bool
== :: CharStringLazy -> CharStringLazy -> Bool
$c== :: CharStringLazy -> CharStringLazy -> Bool
Eq, Eq CharStringLazy
CharStringLazy -> CharStringLazy -> Bool
CharStringLazy -> CharStringLazy -> Ordering
CharStringLazy -> CharStringLazy -> CharStringLazy
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CharStringLazy -> CharStringLazy -> CharStringLazy
$cmin :: CharStringLazy -> CharStringLazy -> CharStringLazy
max :: CharStringLazy -> CharStringLazy -> CharStringLazy
$cmax :: CharStringLazy -> CharStringLazy -> CharStringLazy
>= :: CharStringLazy -> CharStringLazy -> Bool
$c>= :: CharStringLazy -> CharStringLazy -> Bool
> :: CharStringLazy -> CharStringLazy -> Bool
$c> :: CharStringLazy -> CharStringLazy -> Bool
<= :: CharStringLazy -> CharStringLazy -> Bool
$c<= :: CharStringLazy -> CharStringLazy -> Bool
< :: CharStringLazy -> CharStringLazy -> Bool
$c< :: CharStringLazy -> CharStringLazy -> Bool
compare :: CharStringLazy -> CharStringLazy -> Ordering
$ccompare :: CharStringLazy -> CharStringLazy -> Ordering
Ord, NonEmpty CharStringLazy -> CharStringLazy
CharStringLazy -> CharStringLazy -> CharStringLazy
forall b. Integral b => b -> CharStringLazy -> CharStringLazy
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
stimes :: forall b. Integral b => b -> CharStringLazy -> CharStringLazy
$cstimes :: forall b. Integral b => b -> CharStringLazy -> CharStringLazy
sconcat :: NonEmpty CharStringLazy -> CharStringLazy
$csconcat :: NonEmpty CharStringLazy -> CharStringLazy
<> :: CharStringLazy -> CharStringLazy -> CharStringLazy
$c<> :: CharStringLazy -> CharStringLazy -> CharStringLazy
Semigroup, Semigroup CharStringLazy
CharStringLazy
[CharStringLazy] -> CharStringLazy
CharStringLazy -> CharStringLazy -> CharStringLazy
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
mconcat :: [CharStringLazy] -> CharStringLazy
$cmconcat :: [CharStringLazy] -> CharStringLazy
mappend :: CharStringLazy -> CharStringLazy -> CharStringLazy
$cmappend :: CharStringLazy -> CharStringLazy -> CharStringLazy
mempty :: CharStringLazy
$cmempty :: CharStringLazy
Monoid)
instance FoldableLL CharStringLazy Char where
foldl :: forall a. (a -> Char -> a) -> a -> CharStringLazy -> a
foldl a -> Char -> a
f a
i0 CharStringLazy
ls = forall a. (a -> Char -> a) -> a -> ByteString -> a
BSL.foldl a -> Char -> a
f a
i0 (CharStringLazy -> ByteString
unCSL CharStringLazy
ls)
foldl' :: forall a. (a -> Char -> a) -> a -> CharStringLazy -> a
foldl' a -> Char -> a
f a
i0 CharStringLazy
ls = forall a. (a -> Char -> a) -> a -> ByteString -> a
BSL.foldl' a -> Char -> a
f a
i0 (CharStringLazy -> ByteString
unCSL CharStringLazy
ls)
foldl1 :: (Char -> Char -> Char) -> CharStringLazy -> Char
foldl1 Char -> Char -> Char
f CharStringLazy
ls = (Char -> Char -> Char) -> ByteString -> Char
BSL.foldl1 Char -> Char -> Char
f (CharStringLazy -> ByteString
unCSL CharStringLazy
ls)
foldr :: forall b. (Char -> b -> b) -> b -> CharStringLazy -> b
foldr Char -> b -> b
f b
i0 CharStringLazy
ls = forall a. (Char -> a -> a) -> a -> ByteString -> a
BSL.foldr Char -> b -> b
f b
i0 (CharStringLazy -> ByteString
unCSL CharStringLazy
ls)
foldr1 :: (Char -> Char -> Char) -> CharStringLazy -> Char
foldr1 Char -> Char -> Char
f CharStringLazy
ls = (Char -> Char -> Char) -> ByteString -> Char
BSL.foldr1 Char -> Char -> Char
f (CharStringLazy -> ByteString
unCSL CharStringLazy
ls)
mi64toi :: Maybe Int64 -> Maybe Int
mi64toi :: Maybe Int64 -> Maybe Int
mi64toi Maybe Int64
Nothing = forall a. Maybe a
Nothing
mi64toi (Just Int64
x) = forall a. a -> Maybe a
Just (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int64
x)
instance IsList CharStringLazy where
type Item CharStringLazy = Char
toList :: CharStringLazy -> [Item CharStringLazy]
toList = ByteString -> String
BSL.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
fromList :: [Item CharStringLazy] -> CharStringLazy
fromList = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
BSL.pack
instance ListLike CharStringLazy Char where
empty :: CharStringLazy
empty = ByteString -> CharStringLazy
CSL ByteString
BSL.empty
singleton :: Char -> CharStringLazy
singleton = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ByteString
BSL.singleton
cons :: Char -> CharStringLazy -> CharStringLazy
cons Char
x CharStringLazy
l = ByteString -> CharStringLazy
CSL (Char -> ByteString -> ByteString
BSL.cons Char
x (CharStringLazy -> ByteString
unCSL CharStringLazy
l))
snoc :: CharStringLazy -> Char -> CharStringLazy
snoc CharStringLazy
l Char
x = ByteString -> CharStringLazy
CSL (ByteString -> Char -> ByteString
BSL.snoc (CharStringLazy -> ByteString
unCSL CharStringLazy
l) Char
x)
append :: CharStringLazy -> CharStringLazy -> CharStringLazy
append CharStringLazy
l CharStringLazy
r = ByteString -> CharStringLazy
CSL forall a b. (a -> b) -> a -> b
$ ByteString -> ByteString -> ByteString
BSL.append (CharStringLazy -> ByteString
unCSL CharStringLazy
l) (CharStringLazy -> ByteString
unCSL CharStringLazy
r)
head :: CharStringLazy -> Char
head = ByteString -> Char
BSL.head forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
last :: CharStringLazy -> Char
last = ByteString -> Char
BSL.last forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
tail :: CharStringLazy -> CharStringLazy
tail = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. HasCallStack => ByteString -> ByteString
BSL.tail forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
init :: CharStringLazy -> CharStringLazy
init = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. HasCallStack => ByteString -> ByteString
BSL.init forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
null :: CharStringLazy -> Bool
null = ByteString -> Bool
BSL.null forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
length :: CharStringLazy -> Int
length = forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int64
BSL.length forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
rigidMap :: (Char -> Char) -> CharStringLazy -> CharStringLazy
rigidMap Char -> Char
f = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Char) -> ByteString -> ByteString
BSL.map Char -> Char
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
reverse :: CharStringLazy -> CharStringLazy
reverse = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> ByteString
BSL.reverse forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
concat :: forall full'.
ListLike full' CharStringLazy =>
full' -> CharStringLazy
concat = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. [ByteString] -> ByteString
BSL.concat forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map CharStringLazy -> ByteString
unCSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall l. IsList l => l -> [Item l]
toList
rigidConcatMap :: (Char -> CharStringLazy) -> CharStringLazy -> CharStringLazy
rigidConcatMap Char -> CharStringLazy
f = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> ByteString) -> ByteString -> ByteString
BSL.concatMap (CharStringLazy -> ByteString
unCSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> CharStringLazy
f) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
any :: (Char -> Bool) -> CharStringLazy -> Bool
any Char -> Bool
p = (Char -> Bool) -> ByteString -> Bool
BSL.any Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
all :: (Char -> Bool) -> CharStringLazy -> Bool
all Char -> Bool
p = (Char -> Bool) -> ByteString -> Bool
BSL.all Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
maximum :: Ord Char => CharStringLazy -> Char
maximum = ByteString -> Char
BSL.maximum forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
minimum :: Ord Char => CharStringLazy -> Char
minimum = ByteString -> Char
BSL.minimum forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
replicate :: Int -> Char -> CharStringLazy
replicate Int
i = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Char -> ByteString
BSL.replicate (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i)
take :: Int -> CharStringLazy -> CharStringLazy
take Int
i = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> ByteString -> ByteString
BSL.take (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
drop :: Int -> CharStringLazy -> CharStringLazy
drop Int
i = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> ByteString -> ByteString
BSL.drop (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
splitAt :: Int -> CharStringLazy -> (CharStringLazy, CharStringLazy)
splitAt Int
i = (ByteString -> CharStringLazy
CSL forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharStringLazy
CSL) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> ByteString -> (ByteString, ByteString)
BSL.splitAt (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
takeWhile :: (Char -> Bool) -> CharStringLazy -> CharStringLazy
takeWhile Char -> Bool
p = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> ByteString
BSL.takeWhile Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
dropWhile :: (Char -> Bool) -> CharStringLazy -> CharStringLazy
dropWhile Char -> Bool
p = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> ByteString
BSL.dropWhile Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
span :: (Char -> Bool)
-> CharStringLazy -> (CharStringLazy, CharStringLazy)
span Char -> Bool
p = (ByteString -> CharStringLazy
CSL forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharStringLazy
CSL) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> (ByteString, ByteString)
BSL.span Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
break :: (Char -> Bool)
-> CharStringLazy -> (CharStringLazy, CharStringLazy)
break Char -> Bool
p = (ByteString -> CharStringLazy
CSL forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharStringLazy
CSL) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> (ByteString, ByteString)
BSL.break Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
group :: forall full'.
(ListLike full' CharStringLazy, Eq Char) =>
CharStringLazy -> full'
group = forall l. IsList l => [Item l] -> l
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
BSL.group forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
inits :: forall full'.
ListLike full' CharStringLazy =>
CharStringLazy -> full'
inits = forall l. IsList l => [Item l] -> l
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
BSL.inits forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
tails :: forall full'.
ListLike full' CharStringLazy =>
CharStringLazy -> full'
tails = forall l. IsList l => [Item l] -> l
fromList forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall full item full' item'.
(ListLike full item, ListLike full' item') =>
(item -> item') -> full -> full'
map ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> [ByteString]
BSL.tails forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
isPrefixOf :: Eq Char => CharStringLazy -> CharStringLazy -> Bool
isPrefixOf CharStringLazy
p CharStringLazy
f = ByteString -> ByteString -> Bool
BSL.isPrefixOf (CharStringLazy -> ByteString
unCSL CharStringLazy
p) (CharStringLazy -> ByteString
unCSL CharStringLazy
f)
elem :: Eq Char => Char -> CharStringLazy -> Bool
elem Char
x = Char -> ByteString -> Bool
BSL.elem Char
x forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
notElem :: Eq Char => Char -> CharStringLazy -> Bool
notElem Char
x = Char -> ByteString -> Bool
BSL.notElem Char
x forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
find :: (Char -> Bool) -> CharStringLazy -> Maybe Char
find Char -> Bool
p = (Char -> Bool) -> ByteString -> Maybe Char
BSL.find Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
filter :: (Char -> Bool) -> CharStringLazy -> CharStringLazy
filter Char -> Bool
p = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> ByteString
BSL.filter Char -> Bool
p forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
index :: CharStringLazy -> Int -> Char
index CharStringLazy
l Int
i = ByteString -> Int64 -> Char
BSL.index (CharStringLazy -> ByteString
unCSL CharStringLazy
l) (forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i)
elemIndex :: Eq Char => Char -> CharStringLazy -> Maybe Int
elemIndex Char
i = Maybe Int64 -> Maybe Int
mi64toi forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ByteString -> Maybe Int64
BSL.elemIndex Char
i forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
findIndex :: (Char -> Bool) -> CharStringLazy -> Maybe Int
findIndex Char -> Bool
f = Maybe Int64 -> Maybe Int
mi64toi forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> ByteString -> Maybe Int64
BSL.findIndex Char -> Bool
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
genericLength :: forall a. Num a => CharStringLazy -> a
genericLength = forall a. Num a => Integer -> a
fromInteger forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a b. (Integral a, Num b) => a -> b
fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Int64
BSL.length forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
genericTake :: forall b. Integral b => b -> CharStringLazy -> CharStringLazy
genericTake a
i = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> ByteString -> ByteString
BSL.take (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
genericDrop :: forall b. Integral b => b -> CharStringLazy -> CharStringLazy
genericDrop a
i = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> ByteString -> ByteString
BSL.drop (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
genericSplitAt :: forall a.
Integral a =>
a -> CharStringLazy -> (CharStringLazy, CharStringLazy)
genericSplitAt a
i = (ByteString -> CharStringLazy
CSL forall (a :: * -> * -> *) b c b' c'.
Arrow a =>
a b c -> a b' c' -> a (b, b') (c, c')
*** ByteString -> CharStringLazy
CSL) forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> ByteString -> (ByteString, ByteString)
BSL.splitAt (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i) forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
genericReplicate :: forall a. Integral a => a -> Char -> CharStringLazy
genericReplicate a
i = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Char -> ByteString
BSL.replicate (forall a b. (Integral a, Num b) => a -> b
fromIntegral a
i)
strict2lazy :: BS.ByteString -> CharStringLazy
strict2lazy :: ByteString -> CharStringLazy
strict2lazy ByteString
b = ByteString -> CharStringLazy
CSL forall a b. (a -> b) -> a -> b
$ [ByteString] -> ByteString
BSL.fromChunks [ByteString
b]
instance ListLikeIO CharStringLazy Char where
hGetLine :: Handle -> IO CharStringLazy
hGetLine Handle
h = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
strict2lazy forall a b. (a -> b) -> a -> b
$ Handle -> IO ByteString
BS.hGetLine Handle
h
hGetContents :: Handle -> IO CharStringLazy
hGetContents = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. Handle -> IO ByteString
BSL.hGetContents
hGet :: Handle -> Int -> IO CharStringLazy
hGet Handle
h Int
n = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
CSL forall a b. (a -> b) -> a -> b
$ Handle -> Int -> IO ByteString
BSL.hGet Handle
h Int
n
hGetNonBlocking :: Handle -> Int -> IO CharStringLazy
hGetNonBlocking Handle
h Int
n = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
CSL forall a b. (a -> b) -> a -> b
$ Handle -> Int -> IO ByteString
BSL.hGetNonBlocking Handle
h Int
n
hPutStr :: Handle -> CharStringLazy -> IO ()
hPutStr Handle
h = Handle -> ByteString -> IO ()
BSL.hPut Handle
h forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
getLine :: IO CharStringLazy
getLine = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
strict2lazy IO ByteString
BS.getLine
getContents :: IO CharStringLazy
getContents = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
CSL IO ByteString
BSL.getContents
putStr :: CharStringLazy -> IO ()
putStr = ByteString -> IO ()
BSL.putStr forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
putStrLn :: CharStringLazy -> IO ()
putStrLn = ByteString -> IO ()
BSL.putStrLn forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
interact :: (CharStringLazy -> CharStringLazy) -> IO ()
interact CharStringLazy -> CharStringLazy
f = (ByteString -> ByteString) -> IO ()
BSL.interact (CharStringLazy -> ByteString
unCSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> CharStringLazy
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> CharStringLazy
CSL)
readFile :: String -> IO CharStringLazy
readFile = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> IO ByteString
BSL.readFile
writeFile :: String -> CharStringLazy -> IO ()
writeFile String
fp = String -> ByteString -> IO ()
BSL.writeFile String
fp forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
appendFile :: String -> CharStringLazy -> IO ()
appendFile String
fp = String -> ByteString -> IO ()
BSL.appendFile String
fp forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL
instance IsString CharStringLazy where
fromString :: String -> CharStringLazy
fromString = ByteString -> CharStringLazy
CSL forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ByteString
BSL.pack
instance StringLike CharStringLazy where
toString :: CharStringLazy -> String
toString = ByteString -> String
BSL.unpack forall b c a. (b -> c) -> (a -> b) -> a -> c
. CharStringLazy -> ByteString
unCSL