packages feed

mmorph 1.1.5 → 1.2.2

raw patch · 5 files changed

Files

CHANGELOG.md view
@@ -1,3 +1,12 @@+1.2.1++- `MFunctor` and `MMonad` instances for `AccumT`++1.2.0++* BREAKING CHANGE: Remove instances for `ErrorT` and `ListT`+  * These types are deprecated+ 1.1.5  * Fix build failures on GHC 8.4 and 8.6
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2013, Gabriel Gonzalez+Copyright (c) 2013, Gabriella Gonzalez All rights reserved.  Redistribution and use in source and binary forms, with or without modification,@@ -9,7 +9,7 @@ * Redistributions in binary form must reproduce the above copyright notice, this   list of conditions and the following disclaimer in the documentation and/or   other materials provided with the distribution.-* Neither the name of Gabriel Gonzalez nor the names of other contributors may+* Neither the name of Gabriella Gonzalez nor the names of other contributors may   be used to endorse or promote products derived from this software without   specific prior written permission. 
mmorph.cabal view
@@ -1,13 +1,13 @@ Name: mmorph-Version: 1.1.5+Version: 1.2.2 Cabal-Version: >= 1.10 Build-Type: Simple License: BSD3 License-File: LICENSE-Copyright: 2013 Gabriel Gonzalez-Author: Gabriel Gonzalez-Maintainer: Gabriel439@gmail.com-Bug-Reports: https://github.com/Gabriel439/Haskell-MMorph-Library/issues+Copyright: 2013 Gabriella Gonzalez+Author: Gabriella Gonzalez+Maintainer: GenuineGabriella@gmail.com+Bug-Reports: https://github.com/Gabriella439/Haskell-MMorph-Library/issues Synopsis: Monad morphisms Description: This library provides monad morphism utilities, most commonly used     for manipulating monad transformer stacks.@@ -15,15 +15,15 @@ Extra-Source-Files: CHANGELOG.md Source-Repository head     Type: git-    Location: https://github.com/Gabriel439/Haskell-MMorph-Library+    Location: https://github.com/Gabriella439/Haskell-MMorph-Library  Library     Hs-Source-Dirs: src     Build-Depends:-        base                >= 4       && < 5  ,-        mtl                 >= 2.1     && < 2.3,-        transformers        >= 0.2.0.0 && < 0.6,-        transformers-compat >= 0.3     && < 0.7+        base                >= 4.5     && < 5  ,+        mtl                 >= 2.1     && < 2.4,+        transformers        >= 0.2.0.0 && < 0.7,+        transformers-compat >= 0.6.1   && < 0.8     if impl(ghc < 8.0)         Build-Depends:             fail == 4.9.*
src/Control/Monad/Morph.hs view
@@ -78,10 +78,9 @@     ) where  import Control.Monad.Trans.Class (MonadTrans(lift))-import qualified Control.Monad.Trans.Error         as E+import qualified Control.Monad.Trans.Accum         as A import qualified Control.Monad.Trans.Except        as Ex import qualified Control.Monad.Trans.Identity      as I-import qualified Control.Monad.Trans.List          as L import qualified Control.Monad.Trans.Maybe         as M import qualified Control.Monad.Trans.Reader        as R import qualified Control.Monad.Trans.RWS.Lazy      as RWS@@ -117,8 +116,8 @@     -}     hoist :: (Monad m) => (forall a . m a -> n a) -> t m b -> t n b -instance MFunctor (E.ErrorT e) where-    hoist nat m = E.ErrorT (nat (E.runErrorT m))+instance MFunctor (A.AccumT w) where+    hoist nat m = A.AccumT (nat . A.runAccumT m)  instance MFunctor (Ex.ExceptT e) where     hoist nat m = Ex.ExceptT (nat (Ex.runExceptT m))@@ -126,9 +125,6 @@ instance MFunctor I.IdentityT where     hoist nat m = I.IdentityT (nat (I.runIdentityT m)) -instance MFunctor L.ListT where-    hoist nat m = L.ListT (nat (L.runListT m))- instance MFunctor M.MaybeT where     hoist nat m = M.MaybeT (nat (M.runMaybeT m)) @@ -238,13 +234,10 @@ t |>= f = embed f t {-# INLINABLE (|>=) #-} -instance (E.Error e) => MMonad (E.ErrorT e) where-    embed f m = E.ErrorT (do-        x <- E.runErrorT (f (E.runErrorT m))-        return (case x of-            Left         e  -> Left e-            Right (Left  e) -> Left e-            Right (Right a) -> Right a ) )+instance Monoid w => MMonad (A.AccumT w) where+    embed f m = A.AccumT $ \w -> do+        ((b, wInner), wOuter) <- A.runAccumT (f $ A.runAccumT m w) w+        return (b, wInner `mappend` wOuter)  instance MMonad (Ex.ExceptT e) where     embed f m = Ex.ExceptT (do@@ -256,11 +249,6 @@  instance MMonad I.IdentityT where     embed f m = f (I.runIdentityT m)--instance MMonad L.ListT where-    embed f m = L.ListT (do-        x <- L.runListT (f (L.runListT m))-        return (concat x))  instance MMonad M.MaybeT where     embed f m = M.MaybeT (do
src/Control/Monad/Trans/Compose.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE KindSignatures             #-} {-# LANGUAGE MultiParamTypeClasses      #-}+{-# LANGUAGE StandaloneKindSignatures   #-} {-# LANGUAGE UndecidableInstances       #-} {-# LANGUAGE DeriveTraversable          #-} {-# LANGUAGE CPP                        #-}@@ -36,13 +37,15 @@ import Control.Monad.Writer.Class (MonadWriter(writer, tell, listen, pass)) import Control.Monad.IO.Class (MonadIO(liftIO)) import Data.Foldable (Foldable(fold, foldMap, foldr, foldl, foldr1, foldl1))+import Data.Kind (Type) import Data.Traversable (Traversable(traverse, sequenceA, mapM, sequence)) import Prelude hiding (foldr, foldl, foldr1, foldl1, mapM, sequence)  infixr 9 `ComposeT`  -- | Composition of monad transformers.-newtype ComposeT (f :: (* -> *) -> * -> *) (g :: (* -> *) -> * -> *) m a+type ComposeT :: ((Type -> Type) -> Type -> Type) -> ((Type -> Type) -> Type -> Type) -> (Type -> Type) -> Type -> Type+newtype ComposeT f g m a     = ComposeT { getComposeT :: f (g m) a }     deriving     ( Alternative@@ -70,7 +73,7 @@   where     lift = ComposeT . hoist lift . lift -#if __GLASGOW_HASKELL__ >= 806+#if defined(__MHS__) || __GLASGOW_HASKELL__ >= 806 instance (MFunctor f, MFunctor g, forall m. Monad m => Monad (g m))     => MFunctor (ComposeT f g) where     hoist f (ComposeT m) = ComposeT (hoist (hoist f) m)