packages feed

kan-extensions 5.2.2 → 5.2.3

raw patch · 4 files changed

+32/−5 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Codensity: reset :: Monad m => Codensity m a -> Codensity m a
+ Control.Monad.Codensity: shift :: Applicative m => (forall b. (a -> m b) -> Codensity m b) -> Codensity m a

Files

CHANGELOG.markdown view
@@ -1,3 +1,7 @@+5.2.3 [2021.07.27]+------------------+* Add `shift` and `reset` to `Control.Monad.Codensity`.+ 5.2.2 [2021.02.17] ------------------ * Add `hoistCoyoneda` to `Data.Functor.Contravariant.Coyoneda`.
kan-extensions.cabal view
@@ -1,6 +1,6 @@ name:          kan-extensions category:      Data Structures, Monads, Comonads, Functors-version:       5.2.2+version:       5.2.3 license:       BSD3 cabal-version: >= 1.10 license-file:  LICENSE@@ -21,8 +21,9 @@              , GHC == 8.2.2              , GHC == 8.4.4              , GHC == 8.6.5-             , GHC == 8.8.3-             , GHC == 8.10.1+             , GHC == 8.8.4+             , GHC == 8.10.4+             , GHC == 9.0.1  extra-source-files:   .gitignore@@ -66,7 +67,7 @@     semigroupoids       >= 4       && < 6,     tagged              >= 0.7.2   && < 1,     transformers        >= 0.2     && < 0.6,-    transformers-compat >= 0.3     && < 0.7+    transformers-compat >= 0.3     && < 0.8    exposed-modules:     Control.Comonad.Density
src/Control/Monad/Codensity.hs view
@@ -36,6 +36,9 @@   , codensityToComposedRep, composedRepToCodensity   , wrapCodensity   , improve+  -- ** Delimited continuations+  , reset+  , shift   ) where  import Control.Applicative@@ -283,3 +286,22 @@ -- > wrapCodensity (`finally` putStrLn "Done.") wrapCodensity :: (forall a. m a -> m a) -> Codensity m () wrapCodensity f = Codensity (\k -> f (k ()))++-- | @'reset' m@ delimits the continuation of any 'shift' inside @m@.+--+-- * @'reset' ('return' m) = 'return' m@+reset :: Monad m => Codensity m a -> Codensity m a+reset = lift . lowerCodensity++-- | @'shift' f@ captures the continuation up to the nearest enclosing+-- 'reset' and passes it to @f@:+--+-- * @'reset' ('shift' f >>= k) = 'reset' (f ('lowerCodensity' . k))@+shift ::+#if __GLASGOW_HASKELL__ >= 710+  Applicative m+#else+  Monad m+#endif+  => (forall b. (a -> m b) -> Codensity m b) -> Codensity m a+shift f = Codensity $ lowerCodensity . f
src/Data/Functor/Day/Curried.hs view
@@ -46,7 +46,7 @@   {-# INLINE fmap #-}  instance (Functor g, g ~ h) => Applicative (Curried g h) where-  pure a = Curried (fmap ($a))+  pure a = Curried (fmap ($ a))   {-# INLINE pure #-}   Curried mf <*> Curried ma = Curried (ma . mf . fmap (.))   {-# INLINE (<*>) #-}