packages feed

folds 0.7 → 0.7.1

raw patch · 14 files changed

+59/−43 lines, 14 filesdep ~comonaddep ~hlintdep ~pointednew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: comonad, hlint, pointed, transformers, vector

API changes (from Hackage documentation)

- Data.Fold.L: instance Data.Profunctor.Choice Data.Fold.L.L
- Data.Fold.L: instance Data.Profunctor.Costrong Data.Fold.L.L
- Data.Fold.L': instance Data.Profunctor.Choice Data.Fold.L'.L'
- Data.Fold.L': instance Data.Profunctor.Costrong Data.Fold.L'.L'
- Data.Fold.L1: instance Data.Profunctor.Choice Data.Fold.L1.L1
- Data.Fold.L1: instance Data.Profunctor.Costrong Data.Fold.L1.L1
- Data.Fold.L1: instance Data.Profunctor.Strong Data.Fold.L1.L1
- Data.Fold.L1': instance Data.Profunctor.Choice Data.Fold.L1'.L1'
- Data.Fold.L1': instance Data.Profunctor.Costrong Data.Fold.L1'.L1'
- Data.Fold.L1': instance Data.Profunctor.Strong Data.Fold.L1'.L1'
- Data.Fold.M: instance Data.Profunctor.Choice Data.Fold.M.M
- Data.Fold.M: instance Data.Profunctor.Costrong Data.Fold.M.M
- Data.Fold.M1: instance Data.Profunctor.Choice Data.Fold.M1.M1
- Data.Fold.M1: instance Data.Profunctor.Costrong Data.Fold.M1.M1
- Data.Fold.M1: instance Data.Profunctor.Strong Data.Fold.M1.M1
- Data.Fold.R: instance Data.Profunctor.Choice Data.Fold.R.R
- Data.Fold.R: instance Data.Profunctor.Costrong Data.Fold.R.R
- Data.Fold.R1: instance Data.Profunctor.Choice Data.Fold.R1.R1
- Data.Fold.R1: instance Data.Profunctor.Costrong Data.Fold.R1.R1
- Data.Fold.R1: instance Data.Profunctor.Strong Data.Fold.R1.R1
+ Data.Fold.Internal: instance (Data.Semigroup.Semigroup a, Data.Semigroup.Semigroup b) => Data.Semigroup.Semigroup (Data.Fold.Internal.Pair' a b)
+ Data.Fold.Internal: instance Data.Reflection.Reifies s (a -> a -> a, a) => Data.Semigroup.Semigroup (Data.Fold.Internal.N a s)
+ Data.Fold.L: instance Data.Profunctor.Choice.Choice Data.Fold.L.L
+ Data.Fold.L: instance Data.Profunctor.Strong.Costrong Data.Fold.L.L
+ Data.Fold.L': instance Data.Profunctor.Choice.Choice Data.Fold.L'.L'
+ Data.Fold.L': instance Data.Profunctor.Strong.Costrong Data.Fold.L'.L'
+ Data.Fold.L1: instance Data.Profunctor.Choice.Choice Data.Fold.L1.L1
+ Data.Fold.L1: instance Data.Profunctor.Strong.Costrong Data.Fold.L1.L1
+ Data.Fold.L1: instance Data.Profunctor.Strong.Strong Data.Fold.L1.L1
+ Data.Fold.L1': instance Data.Profunctor.Choice.Choice Data.Fold.L1'.L1'
+ Data.Fold.L1': instance Data.Profunctor.Strong.Costrong Data.Fold.L1'.L1'
+ Data.Fold.L1': instance Data.Profunctor.Strong.Strong Data.Fold.L1'.L1'
+ Data.Fold.M: instance Data.Profunctor.Choice.Choice Data.Fold.M.M
+ Data.Fold.M: instance Data.Profunctor.Strong.Costrong Data.Fold.M.M
+ Data.Fold.M1: instance Data.Profunctor.Choice.Choice Data.Fold.M1.M1
+ Data.Fold.M1: instance Data.Profunctor.Strong.Costrong Data.Fold.M1.M1
+ Data.Fold.M1: instance Data.Profunctor.Strong.Strong Data.Fold.M1.M1
+ Data.Fold.R: instance Data.Profunctor.Choice.Choice Data.Fold.R.R
+ Data.Fold.R: instance Data.Profunctor.Strong.Costrong Data.Fold.R.R
+ Data.Fold.R1: instance Data.Profunctor.Choice.Choice Data.Fold.R1.R1
+ Data.Fold.R1: instance Data.Profunctor.Strong.Costrong Data.Fold.R1.R1
+ Data.Fold.R1: instance Data.Profunctor.Strong.Strong Data.Fold.R1.R1
- Data.Fold: class AsRM1 p => AsL1' p where asL1' = asL1' . asL'
+ Data.Fold: class AsRM1 p => AsL1' p
- Data.Fold: class AsRM1 p => AsRM p where asM = asM . asR asR = asR . asM
+ Data.Fold: class AsRM1 p => AsRM p
- Data.Fold: class AsRM1 p where asM1 = asM1 . asR1 asR1 = asR1 . asM1
+ Data.Fold: class AsRM1 p
- Data.Fold: class Scan p => Folding p where prefix = prefixOf folded postfix = postfixOf folded run = runOf folded
+ Data.Fold: class Scan p => Folding p
- Data.Fold: class Choice p => Scan p where prefix1 = prefix . An postfix1 p = postfix p . An run1 = run . An
+ Data.Fold: class Choice p => Scan p
- Data.Fold.Class: class Scan p => Folding p where prefix = prefixOf folded postfix = postfixOf folded run = runOf folded
+ Data.Fold.Class: class Scan p => Folding p
- Data.Fold.Class: class Choice p => Scan p where prefix1 = prefix . An postfix1 p = postfix p . An run1 = run . An
+ Data.Fold.Class: class Choice p => Scan p

Files

.travis.yml view
@@ -30,6 +30,10 @@       compiler: ": #GHC 7.10.2"       addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} +    - env: CABALVER=1.24 GHCVER=8.0.1 BUILD=cabal+      compiler: ": #GHC 8.0.1"+      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+     - env: BUILD=stack STACK_YAML=stack-7.10.yaml STACK_OPTIONS=--skip-ghc-check       addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} 
CHANGELOG.markdown view
@@ -1,3 +1,11 @@+0.7.1+-----+* Support `pointed` 5+* Support `transformers` 0.5+* Support `comonad` 5+* Support GHC 8+* Cleaned up the new warnings caused by `profunctors` 5.2+ 0.7 ----- * Folds are closed, corepresentable profunctors. This observation supplies us with many additional useful instances.
folds.cabal view
@@ -1,6 +1,6 @@ name:          folds category:      Data, Comonads, Enumerator-version:       0.7+version:       0.7.1 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -53,18 +53,18 @@     adjunctions       >= 4.2   && < 5,     base              >= 4     && < 5,     bifunctors        >= 4     && < 6,-    comonad           >= 4     && < 5,+    comonad           >= 4     && < 6,     constraints       >= 0.4   && < 1,     contravariant     >= 0.4.2 && < 2,     data-reify        >= 0.6   && < 0.7,     distributive      >= 0.3   && < 1,     lens              >= 4     && < 5,     mtl               >= 2.2   && < 2.3,-    pointed           >= 4     && < 5,+    pointed           >= 4     && < 6,     profunctors       >= 5     && < 6,     reflection        >= 1.3   && < 3,     semigroupoids     >= 4     && < 6,-    transformers      >= 0.3   && < 0.5,+    transformers      >= 0.3   && < 0.6,     unordered-containers >= 0.2 && < 0.3,     vector            >= 0.10  && < 0.12 @@ -105,7 +105,7 @@   else     build-depends:       base,-      hlint >= 1.7+      hlint >= 1.9.27  test-suite doctests   type:           exitcode-stdio-1.0@@ -113,7 +113,7 @@   ghc-options:    -Wall -threaded   hs-source-dirs: tests -  if !flag(test-doctests)+  if !flag(test-doctests) || impl(ghc >= 8)     buildable: False   else     build-depends:
src/Data/Fold.hs view
@@ -211,9 +211,7 @@ class AsRM1 p => AsL1' p where   -- | Scan homomorphism to a strict Mealy machine   asL1' :: p a b -> L1' a b-#ifndef HLINT   default asL1' :: AsL' p => p a b -> L1' a b-#endif   asL1' = asL1'.asL'  instance AsL1' L1' where
src/Data/Fold/Class.hs view
@@ -21,24 +21,18 @@  class Choice p => Scan p where   prefix1 :: a -> p a b -> p a b-#ifndef HLINT   default prefix1 :: Folding p => a -> p a b -> p a b-#endif   prefix1 = prefix . An   {-# INLINE prefix1 #-}    postfix1 :: p a b -> a -> p a b-#ifndef HLINT   default postfix1 :: Folding p => p a b -> a -> p a b-#endif   postfix1 p = postfix p . An   {-# INLINE postfix1 #-}    -- | Apply a 'Folding' to a single element of input   run1 :: a -> p a b -> b-#ifndef HLINT   default run1 :: Folding p => a -> p a b -> b-#endif   run1 = run . An   {-# INLINE run1 #-} 
src/Data/Fold/Internal.hs view
@@ -122,10 +122,14 @@ newtype N a s = N { runN :: a }   deriving (Eq,Ord,Show,Read,Typeable,Data) +instance Reifies s (a -> a -> a, a) => Semigroup (N a s) where+  N a <> N b = N $ fst (reflect (Proxy :: Proxy s)) a b+  {-# INLINE (<>) #-}+ instance Reifies s (a -> a -> a, a) => Monoid (N a s) where   mempty = N $ snd $ reflect (Proxy :: Proxy s)   {-# INLINE mempty #-}-  mappend (N a) (N b) = N $ fst (reflect (Proxy :: Proxy s)) a b+  mappend = (<>)   {-# INLINE mappend #-}  -- | The shape of a 'foldMap'@@ -160,9 +164,16 @@ -- | Strict Pair data Pair' a b = Pair' !a !b deriving (Eq,Ord,Show,Read,Typeable,Data) +instance (Semigroup a, Semigroup b) => Semigroup (Pair' a b) where+  Pair' a b <> Pair' c d = Pair' (a <> c) (b <> d)+  {-# INLINE (<>) #-}+ instance (Monoid a, Monoid b) => Monoid (Pair' a b) where   mempty = Pair' mempty mempty   {-# INLINE mempty #-}++  -- TODO/FIXME: Once Semigroup becomes a superclass+  -- `#if MIN_VERSION_base`-out this definition   mappend (Pair' a b) (Pair' c d) = Pair' (mappend a c) (mappend b d)   {-# INLINE mappend #-} 
src/Data/Fold/L'.hs view
@@ -24,8 +24,8 @@ import Data.Functor.Extend import Data.Functor.Bind import Data.Functor.Rep as Functor-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Unsafe@@ -112,16 +112,14 @@   extend f (L' k h z)  = L' (f . L' k h) h z   {-# INLINE extend #-} -data Pair a b = Pair !a !b- instance Applicative (L' a) where   pure b = L' (\() -> b) (\() _ -> ()) ()   {-# INLINE pure #-}    L' xf bxx xz <*> L' ya byy yz = L'-    (\(Pair x y) -> xf x $ ya y)-    (\(Pair x y) b -> Pair (bxx x b) (byy y b))-    (Pair xz yz)+    (\(Pair' x y) -> xf x $ ya y)+    (\(Pair' x y) b -> Pair' (bxx x b) (byy y b))+    (Pair' xz yz)   {-# INLINE (<*>) #-}    (<*) m = \_ -> m@@ -141,7 +139,7 @@   m >>= f = L' (\xs a -> run xs (f a)) Snoc Nil <*> m   {-# INLINE (>>=) #-} -  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (L' a) where
src/Data/Fold/L.hs view
@@ -24,8 +24,8 @@ import Data.Functor.Extend import Data.Functor.Bind import Data.Functor.Rep as Functor-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Unsafe@@ -146,7 +146,7 @@   m >>= f = L (\xs a -> run xs (f a)) Snoc Nil <*> m   {-# INLINE (>>=) #-} -  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (L a) where@@ -196,6 +196,9 @@ instance Costrong L where   unfirst = unfirstCorep   unsecond = unsecondCorep++-- | >>> cosieve (L id (+) 0) [1,2,3]+-- 6  instance Cosieve L [] where   cosieve (L k0 h0 z0) as0 = go k0 h0 z0 as0 where
src/Data/Fold/L1'.hs view
@@ -19,8 +19,8 @@ import Data.Functor.Rep as Functor import Data.List.NonEmpty as NonEmpty import Data.Pointed-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Unsafe@@ -72,11 +72,11 @@   {-# INLINE (*>) #-}  instance Monad (L1' a) where-  return x = L1' (\() -> x) (\() _ -> ()) (\_ -> ())+  return = pure   {-# INLINE return #-}   m >>= f = L1' (\xs a -> walk xs (f a)) Snoc1 First <*> m   {-# INLINE (>>=) #-}-  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance Semigroupoid L1' where@@ -158,7 +158,7 @@ {-# INLINE walk #-}  instance Cosieve L1' NonEmpty where-  cosieve (L1' k h z) (a :| as) = k (foldl h (z a) as) where+  cosieve (L1' k h z) (a :| as) = k (foldl h (z a) as)  instance Costrong L1' where   unfirst = unfirstCorep
src/Data/Fold/L1.hs view
@@ -20,8 +20,8 @@ import Data.Functor.Rep as Functor import Data.List.NonEmpty as NonEmpty import Data.Pointed-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Unsafe@@ -73,11 +73,11 @@   {-# INLINE (*>) #-}  instance Monad (L1 a) where-  return x = L1 (\() -> x) (\() _ -> ()) (\_ -> ())+  return = pure   {-# INLINE return #-}   m >>= f = L1 (\xs a -> walk xs (f a)) Snoc1 First <*> m   {-# INLINE (>>=) #-}-  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (L1 a) where@@ -163,7 +163,7 @@ {-# INLINE walk #-}  instance Cosieve L1 NonEmpty where-  cosieve (L1 k h z) (a :| as) = k (foldl h (z a) as) where+  cosieve (L1 k h z) (a :| as) = k (foldl h (z a) as)  instance Costrong L1 where   unfirst = unfirstCorep
src/Data/Fold/M.hs view
@@ -28,8 +28,8 @@ import Data.Functor.Bind import Data.Functor.Extend import Data.Functor.Rep as Functor-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Unsafe@@ -152,7 +152,7 @@   m >>= f = M (\xs a -> run xs (f a)) One Two Zero <*> m   {-# INLINE (>>=) #-} -  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (M a) where
src/Data/Fold/M1.hs view
@@ -21,8 +21,8 @@ import Data.Functor.Apply import Data.Functor.Rep as Functor import Data.Pointed-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Unsafe@@ -80,11 +80,11 @@   {-# INLINE (*>) #-}  instance Monad (M1 a) where-  return x = M1 (\() -> x) (\_ -> ()) (\() () -> ())+  return = pure   {-# INLINE return #-}   m >>= f = M1 (\xs a -> walk xs (f a)) Tip1 Bin1 <*> m   {-# INLINE (>>=) #-}-  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (M1 a) where
src/Data/Fold/R.hs view
@@ -23,8 +23,8 @@ import Data.Functor.Extend import Data.Functor.Bind import Data.Functor.Rep as Functor-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Unsafe@@ -110,13 +110,13 @@   {-# INLINE (>>-) #-}  instance Monad (R a) where-  return b = R (\() -> b) (\_ () -> ()) ()+  return = pure   {-# INLINE return #-}    m >>= f = R (\xs a -> run xs (f a)) (:) [] <*> m   {-# INLINE (>>=) #-} -  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (R a) where
src/Data/Fold/R1.hs view
@@ -20,8 +20,8 @@ import Data.Functor.Rep as Functor import Data.List.NonEmpty as NonEmpty import Data.Pointed-import Data.Profunctor import Data.Profunctor.Closed+import Data.Profunctor import Data.Profunctor.Rep as Profunctor import Data.Profunctor.Sieve import Data.Profunctor.Unsafe@@ -73,11 +73,11 @@   {-# INLINE (*>) #-}  instance Monad (R1 a) where-  return x = R1 (\() -> x) (\_ () -> ()) (\_ -> ())+  return = pure   {-# INLINE return #-}   m >>= f = R1 (\xs a -> walk xs (f a)) Cons1 Last <*> m   {-# INLINE (>>=) #-}-  _ >> n = n+  (>>) = (*>)   {-# INLINE (>>) #-}  instance MonadZip (R1 a) where