-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Tools for manipulating fingertrees of bytestrings with optional annotations
--
-- Tools for manipulating fingertrees of bytestrings with optional
-- annotations
@package rope
@version 0.4
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 Offset Chunk
newtype Offset
Offset :: Int -> Offset
getOffset :: Offset -> Int
newtype Chunk
Chunk :: ByteString -> Chunk
unchunk :: Chunk -> ByteString
measureBody :: (Measured Offset a) => FingerTree Offset a -> Int
cons' :: ByteString -> Body -> Body
snoc' :: Body -> ByteString -> Body
instance Typeable Chunk
instance Typeable Offset
instance Eq Chunk
instance Ord Chunk
instance Show Chunk
instance Read Chunk
instance Data Chunk
instance Eq Offset
instance Ord Offset
instance Num Offset
instance Show Offset
instance Read Offset
instance Enum Offset
instance Data Offset
instance Reducer ByteString Body
instance Measured Offset Chunk
instance Monoid Offset
module Data.Rope.Internal
newtype Rope
Rope :: Body -> Rope
body :: Rope -> Body
pack :: (Reducer a Rope) => a -> Rope
empty :: Rope
fromChunks :: [ByteString] -> Rope
fromByteString :: ByteString -> Rope
fromLazyByteString :: ByteString -> Rope
fromString :: String -> Rope
fromWords :: [Word8] -> Rope
fromChar :: Char -> Rope
fromWord8 :: Word8 -> Rope
length :: Rope -> Int
null :: Rope -> Bool
toChunks :: Rope -> [ByteString]
toString :: Rope -> String
toLazyByteString :: Rope -> ByteString
splitAt :: Int -> Rope -> (Rope, Rope)
take :: Int -> Rope -> Rope
drop :: Int -> Rope -> Rope
class Unpackable a
unpack :: (Unpackable a) => Rope -> [a]
head :: (Unpackable a) => Rope -> a
last :: (Unpackable a) => Rope -> a
uncons :: (Unpackable a) => Rope -> Maybe (a, Rope)
unsnoc :: (Unpackable a) => Rope -> Maybe (Rope, a)
class Breakable a
break :: (Breakable a) => (a -> Bool) -> Rope -> (Rope, Rope)
span :: (Breakable a) => (a -> Bool) -> Rope -> (Rope, Rope)
takeWhile :: (Breakable a) => (a -> Bool) -> Rope -> Rope
dropWhile :: (Breakable a) => (a -> Bool) -> Rope -> Rope
w2c :: Word8 -> Char
findIndexOrEnd :: (Word8 -> Bool) -> ByteString -> Int
instance Typeable Rope
instance Show Rope
instance Unpackable Chunk
instance Unpackable ByteString
instance Unpackable Char
instance Unpackable Word8
instance UTF8Bytes Rope Int
instance Reducer Chunk Rope
instance Reducer ByteString Rope
instance Reducer ByteString Rope
instance Reducer [Word8] Rope
instance Reducer String Rope
instance Reducer Rope Rope
instance Reducer Word8 Rope
instance Reducer Char Rope
instance Breakable Word8
instance Data Rope
instance Measured Offset Rope
instance Ord Rope
instance Eq Rope
instance Monoid Rope
module Data.Rope.Annotated.Internal
data A s a
A :: !Rope -> a -> A s a
null :: A s a -> Bool
head :: (Unpackable t) => A s a -> t
last :: (Unpackable t) => A s a -> t
unpack :: (Unpackable t) => A s a -> [t]
instance [incoherent] Traversable (A s)
instance [incoherent] Foldable (A s)
instance [incoherent] Comonad (A s)
instance [incoherent] Functor (A s)
instance [incoherent] Measured Offset (A s a)
module Data.Rope
data Rope
length :: Rope -> Int
null :: Rope -> Bool
class Breakable a
break :: (Breakable a) => (a -> Bool) -> Rope -> (Rope, Rope)
span :: (Breakable a) => (a -> Bool) -> Rope -> (Rope, Rope)
takeWhile :: (Breakable a) => (a -> Bool) -> Rope -> Rope
dropWhile :: (Breakable a) => (a -> Bool) -> Rope -> Rope
splitAt :: Int -> Rope -> (Rope, Rope)
take :: Int -> Rope -> Rope
drop :: Int -> Rope -> Rope
-- | 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
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
unpack :: (Unpackable a) => Rope -> [a]
head :: (Unpackable a) => Rope -> a
last :: (Unpackable a) => Rope -> a
uncons :: (Unpackable a) => Rope -> Maybe (a, Rope)
unsnoc :: (Unpackable a) => Rope -> Maybe (Rope, a)
toChunks :: Rope -> [ByteString]
toLazyByteString :: Rope -> ByteString
toString :: Rope -> String
module Data.Rope.Annotation
class MonoidA f
emptyA :: (MonoidA f) => f a
appendA :: (MonoidA f) => Rope -> f a -> Rope -> f b -> f c
class (MonoidA f) => ReducerA f
unitA :: (ReducerA f) => Rope -> f a
snocA :: (ReducerA f) => Int -> Rope -> f a -> f b
consA :: (ReducerA f) => Int -> Rope -> f a -> f b
class BreakableA f
splitAtA :: (BreakableA f) => Int -> Rope -> f a -> (f b, f c)
takeA :: (BreakableA f) => Int -> Rope -> f a -> f b
dropA :: (BreakableA f) => Int -> Rope -> f a -> f b
module Data.Rope.Annotation.Product
-- | A Rope Annotation product.
data (:*:) f g a
(:*:) :: f a -> g a -> :*: f g a
fstF :: (f :*: g) a -> f a
sndF :: (f :*: g) a -> g a
instance (BreakableA f, BreakableA g) => BreakableA (f :*: g)
instance (ReducerA f, ReducerA g) => ReducerA (f :*: g)
instance (MonoidA f, MonoidA g) => MonoidA (f :*: g)
instance (Traversable f, Traversable g) => Traversable (f :*: g)
instance (Foldable f, Foldable g) => Foldable (f :*: g)
instance (Applicative f, Applicative g) => Applicative (f :*: g)
instance (Functor f, Functor g) => Functor (f :*: g)
module Data.Rope.Annotation.Unit
data Unit a
instance BreakableA Unit
instance ReducerA Unit
instance MonoidA Unit
module Data.Rope.Annotated
data A s a
type Ann a f = A a (f a)
class MonoidA f
class (MonoidA f) => ReducerA f
class BreakableA f
runAnn :: Ann a f -> (forall b. Ann b f -> r) -> r
null :: A s a -> Bool
head :: (Unpackable t) => A s a -> t
last :: (Unpackable t) => A s a -> t
unpack :: (Unpackable t) => A s a -> [t]
empty :: (MonoidA f) => Ann Nil f
append :: (MonoidA f) => Ann a f -> Ann b f -> Ann (a :<> b) f
unit :: (ReducerA f, Reducer t Rope) => t -> (forall a. Ann (Return a) f -> r) -> r
snoc :: (ReducerA f, Reducer t Rope) => Ann a f -> t -> (forall c. Ann (Snoc a c t) f -> r) -> r
cons :: (ReducerA f, Reducer t Rope) => t -> Ann a f -> (forall c. Ann (Cons c t a) f -> r) -> r
splitAt :: (BreakableA f) => Int -> Ann a f -> (forall n. Ann (Take n a) f -> Ann (Drop n a) f -> r) -> r
drop :: (BreakableA f) => Int -> Ann a f -> (forall n. Ann (Drop n a) f -> r) -> r
take :: (BreakableA f) => Int -> Ann a f -> (forall n. Ann (Take n a) f -> r) -> r
break :: (BreakableA f, Breakable t) => (t -> Bool) -> Ann a f -> (forall n. Ann (Take n a) f -> Ann (Drop n a) f -> r) -> r
span :: (BreakableA f, Breakable t) => (t -> Bool) -> Ann a f -> (forall n. Ann (Take n a) f -> Ann (Drop n a) f -> r) -> r
takeWhile :: (BreakableA f, Breakable t) => (t -> Bool) -> Ann a f -> (forall n. Ann (Take n a) f -> r) -> r
dropWhile :: (BreakableA f, Breakable t) => (t -> Bool) -> Ann a f -> (forall n. Ann (Drop n a) f -> r) -> r
uncons :: (BreakableA f, Unpackable t) => Ann a f -> Maybe (t, Ann (Tail t a) f)
unsnoc :: (BreakableA f, Unpackable t) => Ann a f -> Maybe (Ann (Init a t) f, t)
type Snoc a s t = a :<> Return (Token s t)
type Cons s t a = Token s t :> a
type Tail t a = Unit (Tailed t a)
type Init a t = Unit (Inited a t)
type Return a = a :> Nil
data Nil
-- | A Rope Annotation product.
data (:*:) f g a
(:*:) :: f a -> g a -> :*: f g a
fstF :: (f :*: g) a -> f a
sndF :: (f :*: g) a -> g a
data Unit a