monad-ideals 0.1.0.0 → 0.1.1.0
raw patch · 5 files changed
+33/−2 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Control.Comonad.Coideal: instance (Data.Foldable.Foldable m0, Data.Foldable.Foldable n0) => Data.Foldable.Foldable (m0 Control.Comonad.Coideal.:* n0)
+ Control.Comonad.Coideal: instance (Data.Traversable.Traversable m0, Data.Traversable.Traversable n0) => Data.Traversable.Traversable (m0 Control.Comonad.Coideal.:* n0)
+ Control.Functor.Internal.Mutual: instance (Data.Bifoldable.Bifoldable p, Data.Foldable.Foldable m, Data.Foldable.Foldable n) => Data.Foldable.Foldable (Control.Functor.Internal.Mutual.Mutual p m n)
+ Control.Functor.Internal.Mutual: instance (Data.Bitraversable.Bitraversable p, Data.Traversable.Traversable m, Data.Traversable.Traversable n) => Data.Traversable.Traversable (Control.Functor.Internal.Mutual.Mutual p m n)
+ Control.Monad.Coproduct: instance (Data.Foldable.Foldable m0, Data.Foldable.Foldable n0) => Data.Foldable.Foldable (m0 Control.Monad.Coproduct.:+ n0)
+ Control.Monad.Coproduct: instance (Data.Traversable.Traversable m0, Data.Traversable.Traversable n0) => Data.Traversable.Traversable (m0 Control.Monad.Coproduct.:+ n0)
Files
- CHANGELOG.md +6/−0
- monad-ideals.cabal +2/−2
- src/Control/Comonad/Coideal.hs +8/−0
- src/Control/Functor/Internal/Mutual.hs +8/−0
- src/Control/Monad/Coproduct.hs +9/−0
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for monad-ideals +## 0.1.1.0 -- 2024-07-30++* List GHC 9.10.* as supported++* Add Foldable and Traversable instances to coproduct `(:+)` and product `(:*)`+ ## 0.1.0.0 -- 2024-04-23 * Created based on [category-extras-0.53.5](https://hackage.haskell.org/package/category-extras-0.53.5)
monad-ideals.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: monad-ideals-version: 0.1.0.0+version: 0.1.1.0 synopsis: Ideal Monads and coproduct of them description:@@ -21,7 +21,7 @@ build-type: Simple extra-doc-files: CHANGELOG.md, README.md-tested-with: GHC ==8.10.7, GHC ==9.0.2, GHC ==9.2.8, GHC ==9.4.8, GHC ==9.6.5, GHC ==9.8.2+tested-with: GHC ==8.10.7, GHC ==9.0.2, GHC ==9.2.8, GHC ==9.4.8, GHC ==9.6.5, GHC ==9.8.2, GHC ==9.10.1 source-repository head type: git
src/Control/Comonad/Coideal.hs view
@@ -31,6 +31,8 @@ import Control.Comonad import Control.Functor.Internal.Mutual+import Data.Bifoldable (bifoldMap)+import Data.Bitraversable (bitraverse) newtype Coideal f a = Coideal { runCoideal :: (a, f a) } deriving (Functor, Foldable, Traversable)@@ -63,6 +65,12 @@ Show (m0 ((,) a (Mutual (,) n0 m0 a))), Show (n0 ((,) a (Mutual (,) m0 n0 a))) ) => Show ((:*) m0 n0 a)++instance (Foldable m0, Foldable n0) => Foldable (m0 :* n0) where+ foldMap f = bifoldMap (foldMap f) (foldMap f) . runCoidealProduct++instance (Traversable m0, Traversable n0) => Traversable (m0 :* n0) where+ traverse f = fmap CoidealProduct . bitraverse (traverse f) (traverse f) . runCoidealProduct project1 :: (Functor w) => (w :* v) a -> w a project1 = fmap fst . runMutual . fst . runCoidealProduct
src/Control/Functor/Internal/Mutual.hs view
@@ -13,6 +13,8 @@ module Control.Functor.Internal.Mutual where import Data.Bifunctor+import Data.Bifoldable+import Data.Bitraversable newtype Mutual p m n a = Mutual {runMutual :: m (p a (Mutual p n m a))} @@ -21,6 +23,12 @@ instance (Bifunctor p, Functor m, Functor n) => Functor (Mutual p m n) where fmap f = Mutual . fmap (bimap f (fmap f)) . runMutual++instance (Bifoldable p, Foldable m, Foldable n) => Foldable (Mutual p m n) where+ foldMap f = foldMap (bifoldMap f (foldMap f)) . runMutual++instance (Bitraversable p, Traversable m, Traversable n) => Traversable (Mutual p m n) where+ traverse f = fmap Mutual . traverse (bitraverse f (traverse f)) . runMutual foldMutual :: Bifunctor p
src/Control/Monad/Coproduct.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE DeriveTraversable #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Monad.Coproduct@@ -28,6 +29,8 @@ import Control.Functor.Internal.Mutual (Mutual(..), foldMutual) import Data.Bifunctor (Bifunctor(..))+import Data.Bitraversable (bitraverse)+import Data.Bifoldable (bifoldMap) -- * Coproduct of Monads @@ -84,6 +87,12 @@ Show (m0 (Either a (Mutual Either n0 m0 a))), Show (n0 (Either a (Mutual Either m0 n0 a))) ) => Show ((:+) m0 n0 a)++instance (Foldable m0, Foldable n0) => Foldable (m0 :+ n0) where+ foldMap f = bifoldMap (foldMap f) (foldMap f) . runCoproduct++instance (Traversable m0, Traversable n0) => Traversable (m0 :+ n0) where+ traverse f = fmap Coproduct . bitraverse (traverse f) (traverse f) . runCoproduct inject1 :: (Functor m0) => m0 a -> (m0 :+ n0) a inject1 = Coproduct . Left . Mutual . fmap Left