mmorph 1.2.0 → 1.2.1
raw patch · 4 files changed
+24/−11 lines, 4 filesdep ~transformers-compat
Dependency ranges changed: transformers-compat
Files
- CHANGELOG.md +4/−0
- LICENSE +2/−2
- mmorph.cabal +9/−9
- src/Control/Monad/Morph.hs +9/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+1.2.1++- `MFunctor` and `MMonad` instances for `AccumT`+ 1.2.0 * BREAKING CHANGE: Remove instances for `ErrorT` and `ListT`
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.2.0+Version: 1.2.1 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 && < 5 ,- mtl >= 2.1 && < 2.3,- transformers >= 0.2.0.0 && < 0.6,- transformers-compat >= 0.3 && < 0.7+ mtl >= 2.1 && < 2.4,+ transformers >= 0.2.0.0 && < 0.7,+ transformers-compat >= 0.3 && < 0.8 if impl(ghc < 8.0) Build-Depends: fail == 4.9.*
src/Control/Monad/Morph.hs view
@@ -78,6 +78,7 @@ ) where import Control.Monad.Trans.Class (MonadTrans(lift))+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.Maybe as M@@ -115,6 +116,9 @@ -} hoist :: (Monad m) => (forall a . m a -> n a) -> t m b -> t n b +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)) @@ -229,6 +233,11 @@ (|>=) :: (Monad n, MMonad t) => t m b -> (forall a . m a -> t n a) -> t n b t |>= f = embed f t {-# INLINABLE (|>=) #-}++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