-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Zipping folds -- -- ZipFold is a small package zipping folds, as described in a collection -- of blog posts, http://conal.net/blog/tag/zip, inspired by a -- post by Max Rabkin -- http://squing.blogspot.com/2008/11/beautiful-folding.html. -- -- Project wiki page: http://haskell.org/haskellwiki/ZipFold -- -- © 2008 by Conal Elliott; BSD3 license. @package ZipFold @version 0.1.4 -- | Add continuation module Data.WithCont -- | Add a continuation. data WithCont z c WC :: (z a) -> (a -> c) -> WithCont z c instance Zip z => Applicative (WithCont z) instance Zip z => Monoidal (WithCont z) instance Monoidal ((->) a) instance Zip z => Zip (WithCont z) instance Functor (WithCont z) -- | Zipping of non-strict left folds. -- -- See http://conal.net/blog/tag/zip. Inspired by Beautiful -- FoldLs by Max Rabkin -- http://squing.blogspot.com/2008/11/beautiful-folding.html module Data.Zip.FoldL -- | Data representation of a left fold data FoldL b a F :: (a -> b -> a) -> a -> FoldL b a -- | Interpretation of a FoldL as non-strict cfoldl :: FoldL b a -> [b] -> a -- | Interpretation of a FoldL as non-strict cfoldl' :: FoldL b a -> [b] -> a unitL :: FoldL b () -- | Add a continuation. data WithCont z c -- | Non-strict left fold with continuation. type FoldLC b = WithCont (FoldL b) -- | Interpretation of a FoldLC cfoldlc :: FoldLC b a -> [b] -> a -- | Like WithCont but with pair-strict '(*)' data WithCont' z c -- | Strict left fold with continuation. type FoldLC' b = WithCont' (FoldL b) -- | Interpretation of a FoldLC cfoldlc' :: FoldLC' b a -> [b] -> a -- | Strict generalized zip class Zip' f zip' :: Zip' f => f a -> f b -> f (P a b) -- | Strict pairs data P c c' P :: !c -> !c' -> P c c' instance Zip' IO instance Zip' ((->) u) instance Monoid u => Zip' ((,) u) instance Zip' [] instance Zip' z => Applicative (WithCont' z) instance Functor (WithCont' z) instance Zip' (FoldL b) instance Zip (FoldL b) -- | Zipping of non-strict right folds. -- -- 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.FoldR -- | Data representation of a right fold data FoldR b a F :: (b -> a -> a) -> a -> FoldR b a -- | Interpretation of a FoldR as non-strict cfoldr :: FoldR b a -> [b] -> a -- | Add a continuation. data WithCont z c -- | Non-strict right fold with continuation. type FoldRC b = WithCont (FoldR b) -- | Interpretation of a FoldRC cfoldrc :: FoldRC b a -> [b] -> a instance Zip (FoldR b)