packages feed

ZipFold 0.0 → 0.1

raw patch · 3 files changed

+25/−28 lines, 3 filesdep ~TypeComposePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: TypeCompose

API changes (from Hackage documentation)

- Data.Zip.FoldL: class Pair' f
- Data.Zip.FoldL: instance (Monoid u) => Pair' ((,) u)
- Data.Zip.FoldL: instance (Pair (h b)) => Applicative (WithCont h b)
- Data.Zip.FoldL: instance (Pair' (h b)) => Applicative (WithCont' h b)
- Data.Zip.FoldL: instance Pair (Fold b)
- Data.Zip.FoldL: instance Pair' ((->) u)
- Data.Zip.FoldL: instance Pair' (Fold b)
- Data.Zip.FoldL: instance Pair' IO
- Data.Zip.FoldL: instance Pair' []
- Data.Zip.FoldL: pair' :: (Pair' f) => f a -> f b -> f (P a b)
+ Data.Zip.FoldL: class Zip' f
+ Data.Zip.FoldL: instance (Monoid u) => Zip' ((,) u)
+ Data.Zip.FoldL: instance (Zip (h b)) => Applicative (WithCont h b)
+ Data.Zip.FoldL: instance (Zip' (h b)) => Applicative (WithCont' h b)
+ Data.Zip.FoldL: instance Zip (Fold b)
+ Data.Zip.FoldL: instance Zip' ((->) u)
+ Data.Zip.FoldL: instance Zip' (Fold b)
+ Data.Zip.FoldL: instance Zip' IO
+ Data.Zip.FoldL: instance Zip' []
+ Data.Zip.FoldL: zip' :: (Zip' f) => f a -> f b -> f (P a b)

Files

ZipFold.cabal view
@@ -1,5 +1,5 @@ Name:                ZipFold-Version:             0.0+Version:             0.1 Cabal-Version:       >= 1.2 Synopsis:            Zipping folds Category:            Data@@ -26,7 +26,7 @@ Library   hs-Source-Dirs:      src   Extensions:-  Build-Depends:       base, TypeCompose+  Build-Depends:       base, TypeCompose >= 0.5.2   Exposed-Modules:                             Data.Zip.FoldL                        
src/Data/Zip/FoldL.hs view
@@ -11,24 +11,24 @@ --  -- Zipping of non-strict left folds. -- --- Based on "Beautiful Folds" by Max Rabkin--- <http://squing.blogspot.com/2008/11/beautiful-folding.html>------ See also <http://conal.net/blog/posts/more-beautiful-fold-zipping>+-- See <http://conal.net/blog/tag/zip>.  Inspired by "Beautiful Folds" by+-- Max Rabkin <http://squing.blogspot.com/2008/11/beautiful-folding.html> ----------------------------------------------------------------------  module Data.Zip.FoldL   ( Fold(..), cfoldl, cfoldl'   , WithCont , FoldC , cfoldlc   , WithCont', FoldC', cfoldlc'-  , Pair'(..), P+  , Zip'(..), P   ) where +import Prelude hiding (zip)+ import Data.Monoid import Control.Applicative import Data.List (foldl') -import Data.Pair+import Data.Zip  -- | Data representation of a left fold data Fold b a = F (a -> b -> a) a@@ -43,7 +43,7 @@  where    (a,a') `op''` b = (a `op` b, a' `op'` b) -instance Pair (Fold b) where pair = zipF+instance Zip (Fold b) where zip = zipF  -- | Interpretation of a 'Fold' as non-strict cfoldl' :: Fold b a -> [b] -> a@@ -56,7 +56,7 @@    P a a' `op''` b = P (a `op` b) (a' `op'` b)  -instance Pair' (Fold b) where pair' = zipF'+instance Zip' (Fold b) where zip' = zipF'   -- | Add a continuation.@@ -65,11 +65,10 @@ instance Functor (WithCont h b) where   fmap g (WC f k) = WC f (fmap g k) -instance Pair (h b) => Applicative (WithCont h b) where+instance Zip (h b) => Applicative (WithCont h b) where   pure a = WC (error "unneeded pre-cont") (pure a)-  WC f k <*> WC f' k' =-    WC (f `pair` f') (\ (a,a') -> (k a) (k' a'))-+  WC hf hk <*> WC xf xk =+    WC (hf `zip` xf) (\ (a,a') -> (hk a) (xk a'))  -- | Non-strict left fold with continuation. type FoldC = WithCont Fold@@ -86,10 +85,10 @@ instance Functor (WithCont' h b) where   fmap g (WC' f k) = WC' f (fmap g k) -instance Pair' (h b) => Applicative (WithCont' h b) where+instance Zip' (h b) => Applicative (WithCont' h b) where   pure a = WC' (error "unneeded pre-cont") (pure a)-  WC' f k <*> WC' f' k' =-    WC' (f `pair'` f') (\ (P a a') -> (k a) (k' a'))+  WC' hf hk <*> WC' xf xk =+    WC' (hf `zip'` xf) (\ (P a a') -> (hk a) (xk a'))  -- | Strict left fold with continuation. type FoldC' = WithCont' Fold@@ -104,11 +103,11 @@ -- | Strict pairs data P c c' = P !c !c' --- | Strict generalized pair-class Pair' f where-  pair' :: f a -> f b -> f (P a b)+-- | Strict generalized zip+class Zip' f where+  zip' :: f a -> f b -> f (P a b) -instance             Pair' []       where pair' = liftA2 P-instance Monoid u => Pair' ((,)  u) where pair' = liftA2 P-instance             Pair' ((->) u) where pair' = liftA2 P-instance             Pair' IO       where pair' = liftA2 P+instance             Zip' []       where zip' = liftA2 P+instance Monoid u => Zip' ((,)  u) where zip' = liftA2 P+instance             Zip' ((->) u) where zip' = liftA2 P+instance             Zip' IO       where zip' = liftA2 P
wikipage.tw view
@@ -2,12 +2,10 @@  == Abstract == -'''ZipFold''' is a small package zipping folds, as described in a [http://conal.net/blog/tag/zip collection of blog posts' and inspired by the post [http://squing.blogspot.com/2008/11/beautiful-folding.html "Beautiful Folds"] by Max Rabkin.+'''ZipFold''' is a small package zipping folds, as described in a [http://conal.net/blog/tag/zip collection of blog posts] and inspired by the post [http://squing.blogspot.com/2008/11/beautiful-folding.html "Beautiful Folding"] by Max Rabkin.  Besides this wiki page, here are more ways to find out about ZipFold: * Visit the [http://hackage.haskell.org/cgi-bin/hackage-scripts/package/ZipFold Hackage page] for library documentation and to download & install. * Or install with <tt>cabal install ZipFold</tt>.-* Get the code repository: <tt>darcs get http://code.haskell.org/ZipFold</tt>.+* Get the code repository: <tt>darcs get http://conal.net/repos/ZipFold</tt>. <!-- * See the [[ZipFold/Versions| version history]]. -->--Please leave comments at the [[Talk:ZipFold|Talk page]].