packages feed

compressed 0.1 → 0.1.1

raw patch · 3 files changed

+29/−27 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.Compressed.Internal.LZ78: instance (Read i, Read a) => Read (Entry i a)
+ Data.Compressed.Internal.LZ78: instance (Show i, Show a) => Show (Entry i a)
+ Data.Compressed.Internal.LZ78: instance Adjustable LZ78

Files

Data/Compressed/Internal/LZ78.hs view
@@ -162,6 +162,28 @@ recodeEq :: Eq a => LZ78 a -> LZ78 a  recodeEq = encodeEq . decode  +data Entry i a = Entry !i a deriving (Show,Read)++instance Functor (Entry i) where+  fmap f (Entry i a) = Entry i (f a)++instance Extend (Entry i) where+  extend f e@(Entry i _) = Entry i (f e)+  duplicate e@(Entry i _) = Entry i e++instance Comonad (Entry i) where+  extract (Entry _ a) = a++instance Eq i => Eq (Entry i a) where+  Entry i _ == Entry j _ = i == j++instance Ord i => Ord (Entry i a) where+  compare (Entry i _) (Entry j _) = compare i j++instance Hashable i => Hashable (Entry i a) where+  hash (Entry i _) = hash i+  hashWithSalt n (Entry i _) = hashWithSalt n i+ -- | exposes internal structure entries :: LZ78 a -> LZ78 (Entry Int a) entries = go 0 where@@ -187,6 +209,9 @@     , Entry j b <- decode (entries (k a))     ] +instance Adjustable LZ78 where+  adjust f i = fmap extract . encode . adjust (Entry (-1) . f . extract) i . decode . entries+ type instance Key LZ78 = Int  instance Lookup LZ78 where@@ -205,26 +230,4 @@     | Entry j b <- decode (entries bs)     ]  --data Entry i a = Entry !i a--instance Functor (Entry i) where-  fmap f (Entry i a) = Entry i (f a)--instance Extend (Entry i) where-  extend f e@(Entry i _) = Entry i (f e)-  duplicate e@(Entry i _) = Entry i e--instance Comonad (Entry i) where-  extract (Entry _ a) = a--instance Eq i => Eq (Entry i a) where-  Entry i _ == Entry j _ = i == j--instance Ord i => Ord (Entry i a) where-  compare (Entry i _) (Entry j _) = compare i j--instance Hashable i => Hashable (Entry i a) where-  hash (Entry i _) = hash i-  hashWithSalt n (Entry i _) = hashWithSalt n i 
Data/Compressed/RunLengthEncoding.hs view
@@ -220,10 +220,9 @@ instance Lookup RLE where   lookup i (RLE xs)      | i < 0 = Nothing-    | otherwise = case viewl r of+    | otherwise = case viewl $ snd $ split (\n -> getCount n > i) xs of       Run _ a :< _ -> Just a       EmptyL       -> Nothing -      where (l,r) = split (\n -> getCount n > i) xs  instance Adjustable RLE where   adjust f i (RLE xs) = RLE $ case viewl r of@@ -232,8 +231,8 @@       let          k = i - getCount (measure l)         infixr 4 <?-        Run 0 _ <? xs = xs-        Run n a <? xs = Run n a <| xs+        Run 0 _ <? ys = ys+        Run m b <? ys = Run m b <| ys      in l >< (Run k a <? Run 1 (f a) <? Run (n - k - 1) a <? r')     where        (l,r) = split (\n -> getCount n > i) xs
compressed.cabal view
@@ -1,6 +1,6 @@ name:          compressed category:      Data, Compression, MapReduce-version:       0.1+version:       0.1.1 license:       BSD3 cabal-version: >= 1.6 license-file:  LICENSE