semigroupoids 1.2.4 → 1.2.5
raw patch · 3 files changed
+11/−1 lines, 3 files
Files
Data/Semigroup/Foldable.hs view
@@ -23,6 +23,7 @@ import Data.Functor.Apply import Data.Functor.Product import Data.Functor.Compose+import Data.Tree import Data.List.NonEmpty (NonEmpty(..)) import Data.Semigroup hiding (Product) import Data.Monoid hiding (Product)@@ -35,6 +36,10 @@ foldMap1 f = maybe (error "foldMap1") id . getOption . foldMap (Option . Just . f) fold1 = foldMap1 id++instance Foldable1 Tree where+ foldMap1 f (Node a []) = f a+ foldMap1 f (Node a (x:xs)) = f a <> foldMap1 (foldMap1 f) (x :| xs) instance Foldable1 Identity where foldMap1 f = f . runIdentity
Data/Semigroup/Traversable.hs view
@@ -22,6 +22,7 @@ import Data.Functor.Compose import Data.Semigroup.Foldable import Data.Traversable+import Data.Tree import Data.List.NonEmpty (NonEmpty(..)) import Data.Semigroup hiding (Product) import Data.Traversable.Instances ()@@ -47,6 +48,10 @@ instance (Traversable1 f, Traversable1 g) => Traversable1 (Product f g) where traverse1 f (Pair a b) = Pair <$> traverse1 f a <.> traverse1 f b++instance Traversable1 Tree where+ traverse1 f (Node a []) = (`Node`[]) <$> f a+ traverse1 f (Node a (x:xs)) = (\b (y:|ys) -> Node b (y:ys)) <$> f a <.> traverse1 (traverse1 f) (x :| xs) instance Traversable1 NonEmpty where traverse1 f (a :| []) = (:|[]) <$> f a
semigroupoids.cabal view
@@ -1,6 +1,6 @@ name: semigroupoids category: Control, Comonads-version: 1.2.4+version: 1.2.5 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE