arrows 0.4.3.0 → 0.4.4.0
raw patch · 2 files changed
+34/−31 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Control.Arrow.Transformer.Static: data StaticArrow f a b c
+ Control.Arrow.Transformer.Static: StaticArrow :: (f (a b c)) -> StaticArrow f a b c
+ Control.Arrow.Transformer.Static: newtype StaticArrow f a b c
Files
- Control/Arrow/Transformer/Static.hs +33/−30
- arrows.cabal +1/−1
Control/Arrow/Transformer/Static.hs view
@@ -13,7 +13,7 @@ -- Arrow transformer adding static information. module Control.Arrow.Transformer.Static(- StaticArrow, StaticMonadArrow, StaticArrowArrow,+ StaticArrow(StaticArrow), StaticMonadArrow, StaticArrowArrow, wrap, unwrap, wrapA, unwrapA, wrapM, unwrapM, ) where @@ -31,18 +31,18 @@ -- | An arrow type that augments the underlying arrow with static information. -newtype StaticArrow f a b c = SA (f (a b c))+newtype StaticArrow f a b c = StaticArrow (f (a b c)) instance (Arrow a, Applicative f) => ArrowTransformer (StaticArrow f) a where- lift f = SA (pure f)+ lift f = StaticArrow (pure f) instance (Category a, Applicative f) => Category (StaticArrow f a) where- id = SA (pure id)- SA f . SA g = SA ((.) <$> f <*> g)+ id = StaticArrow (pure id)+ StaticArrow f . StaticArrow g = StaticArrow ((.) <$> f <*> g) instance (Arrow a, Applicative f) => Arrow (StaticArrow f a) where- arr f = SA (pure (arr f))- first (SA f) = SA (first <$> f)+ arr f = StaticArrow (pure (arr f))+ first (StaticArrow f) = StaticArrow (first <$> f) -- The following promotions follow directly from the arrow transformer. @@ -54,12 +54,14 @@ instance (ArrowError ex a, Applicative f) => ArrowError ex (StaticArrow f a) where raise = lift raise- handle (SA f) (SA h) = SA (handle <$> f <*> h)- tryInUnless (SA f) (SA s) (SA h) = SA (tryInUnless <$> f <*> s <*> h)+ handle (StaticArrow f) (StaticArrow h) =+ StaticArrow (handle <$> f <*> h)+ tryInUnless (StaticArrow f) (StaticArrow s) (StaticArrow h) =+ StaticArrow (tryInUnless <$> f <*> s <*> h) instance (ArrowReader r a, Applicative f) => ArrowReader r (StaticArrow f a) where readState = lift readState- newReader (SA f) = SA (newReader <$> f)+ newReader (StaticArrow f) = StaticArrow (newReader <$> f) instance (ArrowState s a, Applicative f) => ArrowState s (StaticArrow f a) where fetch = lift fetch@@ -67,20 +69,20 @@ instance (ArrowWriter w a, Applicative f) => ArrowWriter w (StaticArrow f a) where write = lift write- newWriter (SA f) = SA (newWriter <$> f)+ newWriter (StaticArrow f) = StaticArrow (newWriter <$> f) -- Classes that are preserved. instance (ArrowChoice a, Applicative f) => ArrowChoice (StaticArrow f a) where- left (SA f) = SA (left <$> f)+ left (StaticArrow f) = StaticArrow (left <$> f) -- ArrowApply is generally not preserved. instance (ArrowLoop a, Applicative f) => ArrowLoop (StaticArrow f a) where- loop (SA f) = SA (loop <$> f)+ loop (StaticArrow f) = StaticArrow (loop <$> f) instance (ArrowPlus a, Applicative f) => ArrowPlus (StaticArrow f a) where- SA f <+> SA g = SA ((<+>) <$> f <*> g)+ StaticArrow f <+> StaticArrow g = StaticArrow ((<+>) <$> f <*> g) -- Other instances @@ -103,44 +105,45 @@ instance (ArrowAddStream a a', Applicative f) => ArrowAddStream (StaticArrow f a) (StaticArrow f a') where- liftStream (SA f) = SA (liftStream <$> f)- elimStream (SA f) = SA (elimStream <$> f)+ liftStream (StaticArrow f) = StaticArrow (liftStream <$> f)+ elimStream (StaticArrow f) = StaticArrow (elimStream <$> f) instance (ArrowAddState s a a', Applicative f) => ArrowAddState s (StaticArrow f a) (StaticArrow f a') where- liftState (SA f) = SA (liftState <$> f)- elimState (SA f) = SA (elimState <$> f)+ liftState (StaticArrow f) = StaticArrow (liftState <$> f)+ elimState (StaticArrow f) = StaticArrow (elimState <$> f) instance (ArrowAddReader r a a', Applicative f) => ArrowAddReader r (StaticArrow f a) (StaticArrow f a') where- liftReader (SA f) = SA (liftReader <$> f)- elimReader (SA f) = SA (elimReader <$> f)+ liftReader (StaticArrow f) = StaticArrow (liftReader <$> f)+ elimReader (StaticArrow f) = StaticArrow (elimReader <$> f) instance (ArrowAddWriter w a a', Applicative f) => ArrowAddWriter w (StaticArrow f a) (StaticArrow f a') where- liftWriter (SA f) = SA (liftWriter <$> f)- elimWriter (SA f) = SA (elimWriter <$> f)+ liftWriter (StaticArrow f) = StaticArrow (liftWriter <$> f)+ elimWriter (StaticArrow f) = StaticArrow (elimWriter <$> f) instance (ArrowAddError ex a a', Applicative f) => ArrowAddError ex (StaticArrow f a) (StaticArrow f a') where- liftError (SA f) = SA (liftError <$> f)- elimError (SA f) (SA h) = SA (elimError <$> f <*> h)+ liftError (StaticArrow f) = StaticArrow (liftError <$> f)+ elimError (StaticArrow f) (StaticArrow h) =+ StaticArrow (elimError <$> f <*> h) wrap :: (Applicative f, Arrow a) => f (a b c) -> StaticArrow f a b c-wrap = SA+wrap = StaticArrow unwrap :: (Applicative f, Arrow a) => StaticArrow f a b c -> f (a b c) -unwrap (SA f) = f+unwrap (StaticArrow f) = f -- | A special case. type StaticArrowArrow a s = StaticArrow (WrappedArrow a s) wrapA :: (Arrow a, Arrow a') => a s (a' b c) -> StaticArrowArrow a s a' b c-wrapA x = SA (WrapArrow x)+wrapA x = StaticArrow (WrapArrow x) unwrapA :: (Arrow a, Arrow a') => StaticArrowArrow a s a' b c -> a s (a' b c)-unwrapA (SA (WrapArrow x)) = x+unwrapA (StaticArrow (WrapArrow x)) = x -- | A special case is monads applied to the whole arrow, in contrast to -- 'Kleisli' arrows, in which the monad is applied to the output.@@ -148,7 +151,7 @@ type StaticMonadArrow m = StaticArrow (WrappedMonad m) wrapM :: (Monad m, Arrow a) => m (a b c) -> StaticMonadArrow m a b c-wrapM x = SA (WrapMonad x)+wrapM x = StaticArrow (WrapMonad x) unwrapM :: (Monad m, Arrow a) => StaticMonadArrow m a b c -> m (a b c)-unwrapM (SA (WrapMonad x)) = x+unwrapM (StaticArrow (WrapMonad x)) = x
arrows.cabal view
@@ -1,5 +1,5 @@ Name: arrows-Version: 0.4.3.0+Version: 0.4.4.0 Build-Depends: base >= 4.0 && < 6, Stream Build-Type: Simple License: BSD3