constrictor 0.1.1.1 → 0.1.1.2
raw patch · 2 files changed
+25/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- constrictor.cabal +6/−1
- src/Constrictor.hs +19/−7
constrictor.cabal view
@@ -1,7 +1,7 @@ name: constrictor version:- 0.1.1.1+ 0.1.1.2 synopsis: strict versions of many things in base description:@@ -27,6 +27,11 @@ ChangeLog.md cabal-version: >=1.10++source-repository head+ type: git+ branch: master+ location: https://github.com/chessai/constrictor.git library hs-source-dirs:
src/Constrictor.hs view
@@ -54,8 +54,8 @@ import Prelude hiding (foldr,foldl) -import Control.Applicative-import Control.Monad (MonadPlus)+import Control.Applicative (Alternative, Applicative(..), liftA2)+import Control.Monad (MonadPlus, ap, liftM, liftM2) #if MIN_VERSION_base(4,9,0) import Control.Monad.Fail (MonadFail) #endif@@ -71,10 +71,6 @@ import Data.Traversable (traverse,Traversable) import GHC.Generics (Generic,Generic1) -#if !(MIN_VERSION_base(4,8,0))-import Control.Applicative (WrappedMonad(..))-#endif- -- | A wrapped applicative functor. -- Please note that base 4.12.0.0 will include this type, -- and it will be removed from this library at that point.@@ -240,6 +236,18 @@ !x <- m2 return $! f x +#if !(MIN_VERSION_base(4,8,0))+newtype WrappedMonad m a = WrappedMonad { unwrapMonad :: m a }+ deriving (Monad)++instance Monad m => Functor (WrappedMonad m) where+ fmap f (WrappedMonad v) = WrappedMonad (liftM f v)++instance Monad m => Applicative (WrappedMonad m) where+ pure = WrappedMonad . return+ WrappedMonad f <*> WrappedMonad v = WrappedMonad (f `ap` v)+#endif+ -- | Strict version of 'Data.Traversable.traverse'. traverse' :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b) {-# INLINE traverse' #-}@@ -248,7 +256,11 @@ -- | Stricter version of 'Data.Traversable.traverse'. traverse'' :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b) {-# INLINE traverse'' #-}+#if MIN_VERSION_base(4,8,0) traverse'' f = fmap' (runIdentity . evalContT) . getCompose . traverse (Compose . fmap' (\a -> cont $ \k -> k $! a) . f)+#else+traverse'' f = unwrapMonad . fmap' (runIdentity . evalContT) . getCompose . traverse (Compose . fmap' (\a -> cont $ \k -> k $! a) . (\x -> WrappedMonad (f x)))+#endif -- this is copied from transformers for backwards compatibility evalContT :: (Monad m) => ContT r m r -> m r@@ -263,7 +275,7 @@ #if MIN_VERSION_base(4,8,0) mapM' = traverse' #else-mapM' f xs = unwrapMonad (traverse' (\x -> WrapMonad (f x)) xs)+mapM' f xs = unwrapMonad (traverse' (\x -> WrappedMonad (f x)) xs) #endif -- The INLINES used below allow more list functions to fuse.