transformers 0.5.5.1 → 0.5.5.2
raw patch · 6 files changed
+30/−7 lines, 6 filesdep ~base
Dependency ranges changed: base
Files
- Control/Monad/Trans/Class.hs +9/−2
- Control/Monad/Trans/Except.hs +3/−3
- Control/Monad/Trans/List.hs +7/−0
- Control/Monad/Trans/Reader.hs +4/−0
- changelog +3/−0
- transformers.cabal +4/−2
Control/Monad/Trans/Class.hs view
@@ -113,7 +113,13 @@ {- $example1 -One might define a parsing monad by adding a state (the 'String' remaining+The first example is a parser monad in the style of++* \"Monadic parsing in Haskell\", by Graham Hutton and Erik Meijer,+/Journal of Functional Programming/ 8(4):437-444, July 1998+(<http://www.cs.nott.ac.uk/~pszgmh/bib.html#pearl>).++We can define such a parser monad by adding a state (the 'String' remaining to be parsed) to the @[]@ monad, which provides non-determinism: > import Control.Monad.Trans.State@@ -189,7 +195,8 @@ {- $example3 This example is a cut-down version of the one in-\"Monad Transformers and Modular Interpreters\",++* \"Monad Transformers and Modular Interpreters\", by Sheng Liang, Paul Hudak and Mark Jones in /POPL'95/ (<http://web.cecs.pdx.edu/~mpj/pubs/modinterp.html>).
Control/Monad/Trans/Except.hs view
@@ -15,7 +15,7 @@ -- Stability : experimental -- Portability : portable ----- This monad transformer extends a monad with the ability throw exceptions.+-- This monad transformer extends a monad with the ability to throw exceptions. -- -- A sequence of actions terminates normally, producing a value, -- only if none of the actions in the sequence throws an exception.@@ -275,9 +275,9 @@ -- | Handle an exception. ----- * @'catchE' h ('lift' m) = 'lift' m@+-- * @'catchE' ('lift' m) h = 'lift' m@ ----- * @'catchE' h ('throwE' e) = h e@+-- * @'catchE' ('throwE' e) h = h e@ catchE :: (Monad m) => ExceptT e m a -- ^ the inner computation -> (e -> ExceptT e' m a) -- ^ a handler for exceptions in the inner
Control/Monad/Trans/List.hs view
@@ -43,6 +43,7 @@ #if MIN_VERSION_base(4,9,0) import qualified Control.Monad.Fail as Fail #endif+import Control.Monad.Fix #if MIN_VERSION_base(4,4,0) import Control.Monad.Zip (MonadZip(mzipWith)) #endif@@ -139,6 +140,12 @@ b <- runListT n return (a ++ b) {-# INLINE mplus #-}++instance (MonadFix m) => MonadFix (ListT m) where+ mfix f = ListT $ mfix (runListT . f . head) >>= \ xs -> case xs of+ [] -> return []+ x:_ -> liftM (x:) (runListT (mfix (mapListT (liftM tail) . f)))+ {-# INLINE mfix #-} instance MonadTrans ListT where lift m = ListT $ do
Control/Monad/Trans/Reader.hs view
@@ -154,6 +154,10 @@ u <* v = ReaderT $ \ r -> runReaderT u r <* runReaderT v r {-# INLINE (<*) #-} #endif+#if MIN_VERSION_base(4,10,0)+ liftA2 f x y = ReaderT $ \ r -> liftA2 f (runReaderT x r) (runReaderT y r)+ {-# INLINE liftA2 #-}+#endif instance (Alternative m) => Alternative (ReaderT r m) where empty = liftReaderT empty
changelog view
@@ -1,5 +1,8 @@ -*-change-log-*- +0.5.5.2 Ross Paterson <R.Paterson@city.ac.uk> Apr 2019+ * Added MonadFix instance for ListT and backward compatability fixes+ 0.5.5.1 Ross Paterson <R.Paterson@city.ac.uk> Apr 2019 * Added Contravariant instances
transformers.cabal view
@@ -1,5 +1,5 @@ name: transformers-version: 0.5.5.1+version: 0.5.5.2 license: BSD3 license-file: LICENSE author: Andy Gill, Ross Paterson@@ -9,7 +9,9 @@ synopsis: Concrete functor and monad transformers description: A portable library of functor and monad transformers, inspired by- the paper \"Functional Programming with Overloading and Higher-Order+ the paper+ .+ * \"Functional Programming with Overloading and Higher-Order Polymorphism\", by Mark P Jones, in /Advanced School of Functional Programming/, 1995 (<http://web.cecs.pdx.edu/~mpj/pubs/springschool.html>).