atl 15322.1 → 15322.2
raw patch · 5 files changed
+51/−2 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Arrow.Abort: instance (ArrowChoice r, ArrowApply r) => ArrowApply (AbortT v r)
+ Control.Arrow.Abort: instance (ArrowChoice r, ArrowLoop r, Typeable v) => ArrowLoop (AbortT v r)
+ Control.Arrow.Reader: instance ArrowLoop s => ArrowLoop (ReaderT r s)
+ Control.Arrow.Reader: instance ArrowPlus s => ArrowPlus (ReaderT r s)
+ Control.Arrow.Reader: instance ArrowZero s => ArrowZero (ReaderT r s)
+ Control.Arrow.State: instance ArrowLoop r => ArrowLoop (StateT s r)
+ Control.Arrow.State: instance ArrowPlus r => ArrowPlus (StateT s r)
+ Control.Arrow.State: instance ArrowZero r => ArrowZero (StateT s r)
+ Control.Arrow.Writer: instance (Monoid w, ArrowLoop r) => ArrowLoop (WriterT w r)
+ Control.Arrow.Writer: instance (Monoid w, ArrowPlus r) => ArrowPlus (WriterT w r)
+ Control.Arrow.Writer: instance (Monoid w, ArrowZero r) => ArrowZero (WriterT w r)
Files
- Control/Arrow/Abort.hs +14/−1
- Control/Arrow/Reader.hs +12/−0
- Control/Arrow/State.hs +12/−0
- Control/Arrow/Writer.hs +12/−0
- atl.cabal +1/−1
Control/Arrow/Abort.hs view
@@ -7,7 +7,12 @@ import Control.Arrow; import Control.Arrow.Transformer; import Control.Arrow.Abort.Class;+import Util; +import Data.Typeable;+import Data.Dynamic;+import Control.Exception;+ newtype AbortT v r a b = AbortT { unwrapAbortT :: r a (Either v b) }; runAbortT :: Arrow r => AbortT v r a v -> r a v;@@ -29,8 +34,16 @@ second = AbortT . (>>> arr (uncurry (liftM2 (,)))) . (arr Right ***) . unwrapAbortT; }; +instance (ArrowChoice r, ArrowApply r) => ArrowApply (AbortT v r) where {+ app = AbortT (arr unwrapAbortT *** id >>> app);+};++instance (ArrowChoice r, ArrowLoop r, Typeable v) => ArrowLoop (AbortT v r) where {+ loop (AbortT a) = AbortT (loop (a >>> (id +++ arr fst) &&& (arr (throw . toDyn) ||| arr snd)));+};+ instance (ArrowChoice r) => ArrowAbort v (AbortT v r) where {- abort = AbortT $ arr Left;+ abort = AbortT (arr Left); }; instance (ArrowChoice r, ArrowTransformer xT, Arrow (xT (AbortT v r))) => ArrowAbort v (xT (AbortT v r)) where {
Control/Arrow/Reader.hs view
@@ -30,6 +30,18 @@ app = ReaderT (arr (\ ((ReaderT f, x), r) -> (f, (x, r))) >>> app); }; +instance (ArrowZero s) => ArrowZero (ReaderT r s) where {+ zeroArrow = ReaderT zeroArrow;+};++instance (ArrowPlus s) => ArrowPlus (ReaderT r s) where {+ ReaderT f <+> ReaderT g = ReaderT (f <+> g);+};++instance (ArrowLoop s) => ArrowLoop (ReaderT r s) where {+ loop = ReaderT . loop . (<<< swap_snds_A) . runReaderT;+};+ instance (Arrow s) => ArrowReader r (ReaderT r s) where { ask = ReaderT (arr snd); local = withReaderT . arr;
Control/Arrow/State.hs view
@@ -29,6 +29,18 @@ app = StateT $ arr (\ ((StateT f, x), s) -> (f, (x, s))) >>> app; }; +instance (ArrowZero r) => ArrowZero (StateT s r) where {+ zeroArrow = StateT zeroArrow;+};++instance (ArrowPlus r) => ArrowPlus (StateT s r) where {+ StateT f <+> StateT g = StateT (f <+> g);+};++instance (ArrowLoop r) => ArrowLoop (StateT s r) where {+ loop = StateT . loop . (>>> swap_snds_A) . (<<< swap_snds_A) . runStateT;+};+ instance (Arrow r) => ArrowState s (StateT s r) where { get = StateT $ arr $ \ (_, s) -> (s, s); put = StateT $ arr $ \ (s, _) -> ((), s);
Control/Arrow/Writer.hs view
@@ -33,6 +33,18 @@ app = WriterT $ arr runWriterT *** id >>> app; }; +instance (Monoid w, ArrowZero r) => ArrowZero (WriterT w r) where {+ zeroArrow = WriterT zeroArrow;+};++instance (Monoid w, ArrowPlus r) => ArrowPlus (WriterT w r) where {+ WriterT f <+> WriterT g = WriterT (f <+> g);+};++instance (Monoid w, ArrowLoop r) => ArrowLoop (WriterT w r) where {+ loop = WriterT . loop . (>>> swap_snds_A) . runWriterT;+};+ instance (Monoid w, Arrow r) => ArrowWriter w (WriterT w r) where { tell = WriterT $ constA () &&& id; look = lift (runWriterT id);
atl.cabal view
@@ -1,5 +1,5 @@ Name:atl-Version:15322.1+Version:15322.2 Description:Arrow Transformer Library License:LGPL License-File:license.txt