monoids-0.1.36: Monoids, specialized containers and a general map/reduce frameworkSource codeContentsIndex
Data.Generator.Compressive.RLE
Portabilityportable
Stabilityexperimental
Maintainerekmett@gmail.com
Description
Compression algorithms are all about exploiting redundancy. When applying an expensive Reducer to a redundant source, it may be better to extract the structural redundancy that is present. Run length encoding can do so for long runs of identical inputs.
Synopsis
module Data.Generator
newtype RLE f a = RLE {
getRLE :: f (Run a)
}
data Run a = Run a !!Int
decode :: Foldable f => RLE f a -> [a]
encode :: (Generator c, Eq (Elem c)) => c -> RLE Seq (Elem c)
encodeList :: Eq a => [a] -> RLE [] a
prop_decode_encode :: (Generator c, Eq (Elem c)) => c -> Bool
prop_decode_encodeList :: Eq a => [a] -> Bool
Documentation
module Data.Generator
newtype RLE f a Source
A Generator which supports efficient mapReduce operations over run-length encoded data.
Constructors
RLE
getRLE :: f (Run a)
show/hide Instances
Eq a => Reducer a (RLE Seq a)
Functor f => Functor (RLE f)
Eq a => Monoid (RLE Seq a)
Foldable f => Generator (RLE f a)
data Run a Source
A single run with a strict length.
Constructors
Run a !!Int
show/hide Instances
Functor Run
Pointed Run
decode :: Foldable f => RLE f a -> [a]Source
encode :: (Generator c, Eq (Elem c)) => c -> RLE Seq (Elem c)Source
encodeList :: Eq a => [a] -> RLE [] aSource
naive left to right encoder, which can handle infinite data
prop_decode_encode :: (Generator c, Eq (Elem c)) => c -> BoolSource
prop_decode_encodeList :: Eq a => [a] -> BoolSource
QuickCheck property: decode . encode = id
Produced by Haddock version 2.3.0