atl 15321.2 → 15322.1
raw patch · 2 files changed
+20/−27 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Control.Arrow.Reader: inlineReaderT :: ArrowApply s => ReaderT r s a b -> s (r, a) b
- Control.Arrow.Reader: instance Category s => Category (ReaderT r s)
- Control.Arrow.Reader: outlineReaderT :: Arrow s => s (r, a) b -> ReaderT r s a b
- Control.Arrow.Reader: withReaderTA :: ArrowApply s => s q r -> ReaderT r s a b -> ReaderT q s a b
+ Control.Arrow.Reader: instance Arrow s => Category (ReaderT r s)
- Control.Arrow.Reader: ReaderT :: (r -> s a b) -> ReaderT r s a b
+ Control.Arrow.Reader: ReaderT :: s (a, r) b -> ReaderT r s a b
- Control.Arrow.Reader: runReaderT :: ReaderT r s a b -> r -> s a b
+ Control.Arrow.Reader: runReaderT :: ReaderT r s a b -> s (a, r) b
- Control.Arrow.Reader: withReaderT :: (q -> r) -> ReaderT r s a b -> ReaderT q s a b
+ Control.Arrow.Reader: withReaderT :: Arrow s => s q r -> ReaderT r s a b -> ReaderT q s a b
Files
- Control/Arrow/Reader.hs +18/−25
- atl.cabal +2/−2
Control/Arrow/Reader.hs view
@@ -1,4 +1,4 @@-module Control.Arrow.Reader (module Control.Arrow.Reader.Class, ReaderT (..), inlineReaderT, outlineReaderT, withReaderTA, withReaderT) where+module Control.Arrow.Reader (module Control.Arrow.Reader.Class, ReaderT (..), withReaderT) where import Prelude hiding ((.), id); @@ -7,47 +7,40 @@ import Control.Arrow; import Control.Arrow.Transformer; import Control.Arrow.Reader.Class;--newtype ReaderT r s a b = ReaderT { runReaderT :: r -> s a b };--inlineReaderT :: (ArrowApply s) => ReaderT r s a b -> s (r, a) b;-inlineReaderT = runReaderT >>> arr . (*** id) >>> (>>> app);+import Util; -outlineReaderT :: (Arrow s) => s (r, a) b -> ReaderT r s a b;-outlineReaderT = ReaderT . flip ((>>>) . arr . (&&& id) . const);+newtype ReaderT r s a b = ReaderT { runReaderT :: s (a, r) b }; instance ArrowTransformer (ReaderT r) where {- lift = ReaderT . const;- tmap f = ReaderT . liftM f . runReaderT;+ lift = ReaderT . (<<< arr fst);+ tmap f = ReaderT . f . runReaderT; }; -instance (Category s) => Category (ReaderT r s) where {- id = ReaderT (const id);- ReaderT f . ReaderT g = ReaderT (liftM2 (.) f g);+instance (Arrow s) => Category (ReaderT r s) where {+ id = ReaderT (arr fst);+ ReaderT f . ReaderT g = ReaderT (f <<< g *** id <<< id &&& arr snd); }; instance (Arrow s) => Arrow (ReaderT r s) where {- arr = ReaderT . const . arr;- first = ReaderT . (.) first . runReaderT;- second = ReaderT . (.) second . runReaderT;+ arr = lift . arr;+ first = ReaderT . (<<< swap_snds_A) . (*** id) . runReaderT; }; instance (ArrowApply s) => ArrowApply (ReaderT r s) where {- app = ReaderT $ \ r -> arr (\ (ReaderT f, x) -> (f r, x)) >>> app;+ app = ReaderT (arr (\ ((ReaderT f, x), r) -> (f, (x, r))) >>> app); }; instance (Arrow s) => ArrowReader r (ReaderT r s) where {- ask = ReaderT (arr . const);- local = withReaderT;+ ask = ReaderT (arr snd);+ local = withReaderT . arr; }; instance (Arrow s, ArrowTransformer xT, Arrow (xT (ReaderT r s))) => ArrowReader r (xT (ReaderT r s)) where { ask = lift ask;- local = undefined;+ local (f :: r -> r) =+ let local' (a :: s r r) = tmap (withReaderT a :: ∀ a b. ReaderT r s a b → ReaderT r s a b);+ in local' (arr f); }; -withReaderTA :: (ArrowApply s) => s q r -> ReaderT r s a b -> ReaderT q s a b;-withReaderTA a = outlineReaderT . (<<< a *** id) . inlineReaderT;--withReaderT :: (q -> r) -> ReaderT r s a b -> ReaderT q s a b;-withReaderT f = ReaderT . (. f) . runReaderT;+withReaderT :: Arrow s => s q r -> ReaderT r s a b -> ReaderT q s a b;+withReaderT a = ReaderT . (<<< id *** a) . runReaderT;
atl.cabal view
@@ -1,5 +1,5 @@ Name:atl-Version:15321.2+Version:15322.1 Description:Arrow Transformer Library License:LGPL License-File:license.txt@@ -12,7 +12,7 @@ Library { Build-Depends: base >= 4 && < 5- Extensions: UnicodeSyntax, RankNTypes, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts+ Extensions: UnicodeSyntax, ScopedTypeVariables, RankNTypes, MultiParamTypeClasses, FlexibleInstances, FlexibleContexts Exposed-Modules: Control.Arrow.Transformer, Control.Arrow.Reader, Control.Arrow.Reader.Class, Control.Arrow.List.Class, Control.Arrow.Abort, Control.Arrow.Abort.Class, Control.Arrow.State, Control.Arrow.State.Class, Control.Arrow.Writer, Control.Arrow.Writer.Class Other-Modules: Util }