rope-0.4: Tools for manipulating fingertrees of bytestrings with optional annotationsSource codeContentsIndex
Data.Rope
Contents
Size
Slicing
Walking
construction
Deconstructing Ropes
Synopsis
data Rope
length :: Rope -> Int
null :: Rope -> Bool
class Breakable a where
break :: (a -> Bool) -> Rope -> (Rope, Rope)
span :: (a -> Bool) -> Rope -> (Rope, Rope)
takeWhile :: (a -> Bool) -> Rope -> Rope
dropWhile :: (a -> Bool) -> Rope -> Rope
splitAt :: Int -> Rope -> (Rope, Rope)
take :: Int -> Rope -> Rope
drop :: Int -> Rope -> Rope
class Monoid m => Reducer c m where
unit :: c -> m
snoc :: m -> c -> m
cons :: c -> m -> m
empty :: Rope
fromByteString :: ByteString -> Rope
fromChunks :: [ByteString] -> Rope
fromLazyByteString :: ByteString -> Rope
fromWords :: [Word8] -> Rope
fromChar :: Char -> Rope
fromWord8 :: Word8 -> Rope
fromString :: String -> Rope
class Unpackable a where
unpack :: Rope -> [a]
head :: Rope -> a
last :: Rope -> a
uncons :: Rope -> Maybe (a, Rope)
unsnoc :: Rope -> Maybe (Rope, a)
toChunks :: Rope -> [ByteString]
toLazyByteString :: Rope -> ByteString
toString :: Rope -> String
Size
data Rope Source
show/hide Instances
length :: Rope -> IntSource
null :: Rope -> BoolSource
Slicing
class Breakable a whereSource
Methods
break :: (a -> Bool) -> Rope -> (Rope, Rope)Source
span :: (a -> Bool) -> Rope -> (Rope, Rope)Source
takeWhile :: (a -> Bool) -> Rope -> RopeSource
dropWhile :: (a -> Bool) -> Rope -> RopeSource
show/hide Instances
splitAt :: Int -> Rope -> (Rope, Rope)Source
take :: Int -> Rope -> RopeSource
drop :: Int -> Rope -> RopeSource
Walking
construction
class Monoid m => Reducer c m whereSource

This type may be best read infix. A c Reducer m is a Monoid m that maps values of type c through unit to values of type m. A c-Reducer may also supply operations which tack-on another c to an existing Monoid m on the left or right. These specialized reductions may be more efficient in some scenarios and are used when appropriate by a Generator. The names cons and snoc work by analogy to the synonymous operations in the list monoid.

This class deliberately avoids functional-dependencies, so that () can be a c-Reducer for all c, and so many common reducers can work over multiple types, for instance, First and Last may reduce both a and Maybe a. Since a Generator has a fixed element type, the input to the reducer is generally known and extracting from the monoid usually is sufficient to fix the result type. Combinators are available for most scenarios where this is not the case, and the few remaining cases can be handled by using an explicit type annotation.

Minimal definition: unit or snoc

Methods
unit :: c -> mSource
Convert a value into a Monoid
snoc :: m -> c -> mSource
Append a value to a Monoid for use in left-to-right reduction
cons :: c -> m -> mSource
Prepend a value onto a Monoid for use during right-to-left reduction
show/hide Instances
Reducer Bool All
Reducer Bool All
Reducer Bool Any
Reducer Bool Any
Reducer Char Rope
Reducer Char Rope
Reducer Word8 Rope
Reducer Word8 Rope
Reducer String Rope
Reducer String Rope
Reducer c ()
Reducer ByteString ByteString
Reducer ByteString ByteString
Reducer ByteString ByteString
Reducer ByteString Body
Reducer ByteString Body
Reducer ByteString Rope
Reducer ByteString Rope
Reducer ByteString Rope
Reducer ByteString Rope
Reducer Chunk Rope
Reducer Chunk Rope
Reducer Rope Rope
Reducer a (Last a)
Reducer a (First a)
Num a => Reducer a (Product a)
Num a => Reducer a (Sum a)
Monoid a => Reducer a (Dual a)
Reducer c ([] c)
Measured v a => Reducer a (FingerTree v a)
(Reducer c m, Reducer c n) => Reducer c ((,) m n)
(Reducer c m, Reducer c n, Reducer c o) => Reducer c ((,,) m n o)
(Reducer c m, Reducer c n, Reducer c o, Reducer c p) => Reducer c ((,,,) m n o p)
Reducer ([] Word8) Rope
Reducer ([] Word8) Rope
Reducer (Maybe a) (Last a)
Reducer (Maybe a) (Last a)
Reducer (Maybe a) (First a)
Reducer (Maybe a) (First a)
Reducer (a -> a) (Endo a)
Reducer (a -> a) (Endo a)
empty :: RopeSource
fromByteString :: ByteString -> RopeSource
fromChunks :: [ByteString] -> RopeSource
fromLazyByteString :: ByteString -> RopeSource
fromWords :: [Word8] -> RopeSource
fromChar :: Char -> RopeSource
fromWord8 :: Word8 -> RopeSource
fromString :: String -> RopeSource
Deconstructing Ropes
class Unpackable a whereSource
Methods
unpack :: Rope -> [a]Source
head :: Rope -> aSource
last :: Rope -> aSource
uncons :: Rope -> Maybe (a, Rope)Source
unsnoc :: Rope -> Maybe (Rope, a)Source
show/hide Instances
toChunks :: Rope -> [ByteString]Source
toLazyByteString :: Rope -> ByteStringSource
toString :: Rope -> StringSource
Produced by Haddock version 2.4.2