-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Tools for manipulating annotated ropes of bytestrings
--
-- Tools for manipulating annotated ropes of bytestrings
@package rope
@version 0.1
module Data.Rope.Util.Bifunctor
class Bifunctor f
bimap :: (Bifunctor f) => (a -> b) -> (c -> d) -> f a c -> f b d
first :: (Bifunctor f) => (a -> b) -> f a c -> f b c
second :: (Bifunctor f) => (b -> c) -> f a b -> f a c
instance Bifunctor Either
instance Bifunctor (,)
module Data.Rope.Util.Coproduct
data (:+:) a b
Left' :: !a -> :+: a b
Right' :: !b -> :+: a b
data (:+) a b
Inl :: !a -> :+ a b
Inr :: b -> :+ a b
class (Bifunctor s) => Coproduct s
left :: (Coproduct s) => a -> s a b
right :: (Coproduct s) => b -> s a b
(|||) :: (Coproduct s) => (a -> c) -> (b -> c) -> s a b -> c
codiag :: (Coproduct s) => s a a -> a
counzip :: (Coproduct s, Coproduct s', Functor f) => s (f a) (f b) -> f (s' a b)
instance Coproduct :+:
instance Functor ((:+:) a)
instance Bifunctor :+:
instance Coproduct :+
instance Coproduct Either
instance Monad ((:+) a)
instance Applicative ((:+) a)
instance Functor ((:+) a)
instance Bifunctor :+
module Data.Rope.Util.Comonad
class (Functor w) => Comonad w
extract :: (Comonad w) => w a -> a
duplicate :: (Comonad w) => w a -> w (w a)
extend :: (Comonad w) => (w a -> b) -> w a -> w b
module Data.Rope.Util.Reducer
-- | 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
class (Monoid m) => Reducer c m
unit :: (Reducer c m) => c -> m
snoc :: (Reducer c m) => m -> c -> m
cons :: (Reducer c m) => c -> m -> m
-- | Apply a Reducer to a Foldable container, after mapping
-- the contents into a suitable form for reduction.
foldMapReduce :: (Foldable f, Reducer e m) => (a -> e) -> f a -> m
-- | Apply a Reducer to a Foldable mapping each element
-- through unit
foldReduce :: (Foldable f, Reducer e m) => f e -> m
pureUnit :: (Applicative f, Reducer c n) => c -> f n
returnUnit :: (Monad m, Reducer c n) => c -> m n
instance (Measured v a) => Reducer a (FingerTree v a)
instance Reducer a (Last a)
instance Reducer (Maybe a) (Last a)
instance Reducer a (First a)
instance Reducer (Maybe a) (First a)
instance (Num a) => Reducer a (Product a)
instance (Num a) => Reducer a (Sum a)
instance (Monoid a) => Reducer a (Dual a)
instance Reducer (a -> a) (Endo a)
instance Reducer Bool All
instance Reducer Bool Any
instance Reducer c ()
instance Reducer c [c]
instance Reducer ByteString ByteString
instance Reducer ByteString ByteString
instance (Reducer c m, Reducer c n, Reducer c o, Reducer c p) => Reducer c (m, n, o, p)
instance (Reducer c m, Reducer c n, Reducer c o) => Reducer c (m, n, o)
instance (Reducer c m, Reducer c n) => Reducer c (m, n)
module Data.Rope.Body
type Body = FingerTree Count Chunk
newtype Count
Count :: Int -> Count
getCount :: Count -> Int
newtype Chunk
Chunk :: ByteString -> Chunk
unchunk :: Chunk -> ByteString
measureBody :: (Measured Count a) => FingerTree Count a -> Int
cons' :: ByteString -> Body -> Body
snoc' :: Body -> ByteString -> Body
instance Typeable Chunk
instance Typeable Count
instance Eq Chunk
instance Ord Chunk
instance Show Chunk
instance Read Chunk
instance Data Chunk
instance Eq Count
instance Ord Count
instance Num Count
instance Show Count
instance Read Count
instance Enum Count
instance Data Count
instance Reducer ByteString Body
instance Measured Count Chunk
instance Monoid Count
module Data.Rope.Util.Product
data (:*:) a b
(:*:) :: !a -> !b -> :*: a b
class (Bifunctor p) => Product p
fst :: (Product p) => p a b -> a
snd :: (Product p) => p a b -> b
pair :: (Product p) => a -> b -> p a b
curry :: (Product p) => (p a b -> c) -> a -> b -> c
uncurry :: (Product p) => (a -> b -> c) -> p a b -> c
both :: (Product p) => (a -> b) -> (a -> c) -> a -> p b c
diag :: (Product p) => a -> p a a
bothC :: (Product p, Functor f) => (f a -> b) -> (f c -> d) -> f (p a c) -> p b d
unzip :: (Product p, Functor f) => f (p a b) -> p (f a) (f b)
instance Product (,)
instance Product :*:
instance (Reducer c a, Reducer c b) => Reducer c (a :*: b)
instance (Monoid a, Monoid b) => Monoid (a :*: b)
instance Comonad ((:*:) a)
instance Functor ((:*:) a)
instance Bifunctor :*:
module Data.Rope.Internal
data Rope a
Rope :: !Body -> a -> Rope a
cons8 :: (Reducer ByteString m) => Word8 -> Rope m -> Rope m
empty :: (Monoid m) => Rope m
fromChunks :: (Reducer ByteString m) => [ByteString] -> Rope m
fromByteString :: (Reducer ByteString m) => ByteString -> Rope m
fromLazyByteString :: (Reducer ByteString m) => ByteString -> Rope m
fromString :: (Reducer ByteString m) => String -> Rope m
fromWords :: (Reducer ByteString m) => [Word8] -> Rope m
fromChar :: (Reducer ByteString m) => Char -> Rope m
fromWord8 :: (Reducer ByteString m) => Word8 -> Rope m
length :: Rope m -> Int
null :: Rope m -> Bool
body :: Rope a -> Body
toChunks :: Rope m -> [ByteString]
toLazyByteString :: Rope m -> ByteString
class (Reducer ByteString a) => Annotation a
elide' :: (Annotation a) => Int -> Int -> Rope a -> a
splitAt' :: (Annotation a) => Int -> Rope a -> (a, a)
take' :: (Annotation a) => Int -> Rope a -> a
drop' :: (Annotation a) => Int -> Rope a -> a
elide :: (Annotation a) => Int -> Int -> Rope a -> Rope a
splitAt :: (Annotation a) => Int -> Rope a -> (Rope a, Rope a)
take :: (Annotation a) => Int -> Rope a -> Rope a
drop :: (Annotation a) => Int -> Rope a -> Rope a
uncons8 :: (Annotation m) => Rope m -> Maybe (Word8, Rope m)
unsnoc8 :: (Annotation m) => Rope m -> Maybe (Rope m, Word8)
w2c :: Word8 -> Char
class Packable a
pack :: (Packable a, Annotation m) => a -> Rope m
packl :: (Packable a, Annotation m) => a -> Rope m -> Rope m
packr :: (Packable a, Annotation m) => Rope m -> a -> Rope m
break8 :: (Annotation m) => (Word8 -> Bool) -> Rope m -> (Rope m, Rope m)
findIndexOrEnd :: (Word8 -> Bool) -> ByteString -> Int
instance (Show a) => Show (Rope a)
instance (Packable a, Annotation m) => Reducer a (Rope m)
instance Packable Chunk
instance Packable ByteString
instance Packable ByteString
instance Packable [Word8]
instance Packable String
instance (Annotation n) => Packable (Rope n)
instance Packable Word8
instance Packable Char
instance (Annotation a) => Annotation (Rope a)
instance Annotation Body
instance Annotation ByteString
instance Annotation ByteString
instance (Annotation a, Annotation b) => Annotation (a :*: b)
instance (Annotation a, Annotation b) => Annotation (a, b)
instance Annotation ()
instance Typeable1 Rope
instance (Annotation a, Data a) => Data (Rope a)
instance Traversable Rope
instance Foldable Rope
instance Comonad Rope
instance MonadWriter (Rope ()) Rope
instance Monad Rope
instance Applicative Rope
instance Functor Rope
instance Measured Count (Rope a)
instance (Eq a) => Eq (Rope a)
instance (Monoid a) => Monoid (Rope a)
module Data.Rope.Unpackable
class Unpackable a
unpack :: (Unpackable a) => Rope m -> [a]
head :: (Unpackable a) => Rope m -> a
last :: (Unpackable a) => Rope m -> a
uncons :: (Unpackable a, Annotation m) => Rope m -> Maybe (a, Rope m)
unsnoc :: (Unpackable a, Annotation m) => Rope m -> Maybe (Rope m, a)
instance Unpackable Chunk
instance Unpackable ByteString
instance Unpackable Char
instance Unpackable Word8
instance UTF8Bytes F Int
instance Monoid F
module Data.Rope
data Rope a
length :: Rope m -> Int
null :: Rope m -> Bool
-- | 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
class (Monoid m) => Reducer c m
unit :: (Reducer c m) => c -> m
snoc :: (Reducer c m) => m -> c -> m
cons :: (Reducer c m) => c -> m -> m
class (Reducer ByteString a) => Annotation a
elide' :: (Annotation a) => Int -> Int -> Rope a -> a
splitAt' :: (Annotation a) => Int -> Rope a -> (a, a)
take' :: (Annotation a) => Int -> Rope a -> a
drop' :: (Annotation a) => Int -> Rope a -> a
elide :: (Annotation a) => Int -> Int -> Rope a -> Rope a
splitAt :: (Annotation a) => Int -> Rope a -> (Rope a, Rope a)
take :: (Annotation a) => Int -> Rope a -> Rope a
drop :: (Annotation a) => Int -> Rope a -> Rope a
class Unpackable a
unpack :: (Unpackable a) => Rope m -> [a]
head :: (Unpackable a) => Rope m -> a
last :: (Unpackable a) => Rope m -> a
uncons :: (Unpackable a, Annotation m) => Rope m -> Maybe (a, Rope m)
unsnoc :: (Unpackable a, Annotation m) => Rope m -> Maybe (Rope m, a)
class Packable a
pack :: (Packable a, Annotation m) => a -> Rope m
packl :: (Packable a, Annotation m) => a -> Rope m -> Rope m
packr :: (Packable a, Annotation m) => Rope m -> a -> Rope m
empty :: (Monoid m) => Rope m
fromByteString :: (Reducer ByteString m) => ByteString -> Rope m
fromChunks :: (Reducer ByteString m) => [ByteString] -> Rope m
fromLazyByteString :: (Reducer ByteString m) => ByteString -> Rope m
fromWords :: (Reducer ByteString m) => [Word8] -> Rope m
fromChar :: (Reducer ByteString m) => Char -> Rope m
fromWord8 :: (Reducer ByteString m) => Word8 -> Rope m
fromString :: (Reducer ByteString m) => String -> Rope m
toChunks :: Rope m -> [ByteString]
toLazyByteString :: Rope m -> ByteString
toString :: Rope m -> String