TypeCompose 0.6.8 → 0.7.0
raw patch · 3 files changed
+52/−23 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Control.Compose: instance (Arrow (~>)) => Cofunctor (Flip (~>) b)
- Control.Compose: instance (Eq (f a, g a)) => Eq ((:*:) f g a)
- Control.Compose: instance (FunAble h) => Arrow (FunA h)
- Control.Compose: instance (FunAble h) => Category (FunA h)
- Control.Compose: instance (Monoid ((~>) (f a) (g a))) => Monoid (Arrw (~>) f g a)
- Control.Compose: instance (Monoid o) => Monoid (Const o a)
- Control.Compose: instance (Monoid o) => Monoid_f (Flip (->) o)
- Control.Compose: instance (Ord (f a, g a)) => Ord ((:*:) f g a)
- Control.Compose: instance (Show (f a, g a)) => Show ((:*:) f g a)
- Control.Instances: instance (Monoid o) => Monoid (IO o)
- Data.Bijection: instance (Arrow (~>)) => Arrow (Bijection (~>))
- Data.Bijection: instance (Category (~>)) => Category (Bijection (~>))
- Data.CxMonoid: instance (Title a) => Title (CxMonoid a)
- Data.Lambda: instance (Applicative f) => Lambda f (Flip (->) o :. f)
- Data.Lambda: instance (Applicative f) => Lambda f (f :->: Const o)
- Data.Lambda: instance (Applicative f) => Lambda f (f :. Flip (->) o)
- Data.Pair: instance (Arrow (~>)) => Copair (Flip (~>) o)
- Data.Pair: instance (Monoid o) => Pair (Const o)
- Data.Pair: instance (Monoid u) => Pair ((,) u)
- Data.Title: instance [overlap ok] (Title b) => Title (a -> b)
- Data.Title: instance [overlap ok] (Title o) => Title_f (Flip (->) o)
- Data.Title: instance [overlap ok] (Title_f f) => Title (f a)
- Data.Title: instance [overlap ok] (Title_f g) => Title_f (g :. f)
- Data.Zip: instance (Arrow (~>)) => Cozip (Flip (~>) o)
- Data.Zip: instance (Monoid o) => Zip (Const o)
- Data.Zip: instance (Monoid u) => Zip ((,) u)
+ Control.Compose: (~>) :: (a' -> a) -> (b -> b') -> ((a -> b) -> (a' -> b'))
+ Control.Compose: argument :: (a' -> a) -> ((a -> b) -> (a' -> b))
+ Control.Compose: instance Arrow (~>) => Cofunctor (Flip (~>) b)
+ Control.Compose: instance Eq (f a, g a) => Eq ((:*:) f g a)
+ Control.Compose: instance FunAble h => Arrow (FunA h)
+ Control.Compose: instance FunAble h => Category (FunA h)
+ Control.Compose: instance Monoid ((~>) (f a) (g a)) => Monoid (Arrw (~>) f g a)
+ Control.Compose: instance Monoid o => Monoid (Const o a)
+ Control.Compose: instance Monoid o => Monoid_f (Flip (->) o)
+ Control.Compose: instance Ord (f a, g a) => Ord ((:*:) f g a)
+ Control.Compose: instance Show (f a, g a) => Show ((:*:) f g a)
+ Control.Compose: result :: (b -> b') -> ((a -> b) -> (a -> b'))
+ Control.Instances: instance Monoid o => Monoid (IO o)
+ Data.Bijection: instance Arrow (~>) => Arrow (Bijection (~>))
+ Data.Bijection: instance Category (~>) => Category (Bijection (~>))
+ Data.CxMonoid: instance Title a => Title (CxMonoid a)
+ Data.Lambda: instance Applicative f => Lambda f (Flip (->) o :. f)
+ Data.Lambda: instance Applicative f => Lambda f (f :->: Const o)
+ Data.Lambda: instance Applicative f => Lambda f (f :. Flip (->) o)
+ Data.Pair: instance Arrow (~>) => Copair (Flip (~>) o)
+ Data.Pair: instance Monoid o => Pair (Const o)
+ Data.Pair: instance Monoid u => Pair ((,) u)
+ Data.Title: instance [overlap ok] Title b => Title (a -> b)
+ Data.Title: instance [overlap ok] Title o => Title_f (Flip (->) o)
+ Data.Title: instance [overlap ok] Title_f f => Title (f a)
+ Data.Title: instance [overlap ok] Title_f g => Title_f (g :. f)
+ Data.Zip: instance Arrow (~>) => Cozip (Flip (~>) o)
+ Data.Zip: instance Monoid o => Zip (Const o)
+ Data.Zip: instance Monoid u => Zip ((,) u)
- Control.Compose: (&&&%) :: (FunAble h) => (h a -> h b) -> (h a -> h b') -> (h a -> h (b, b'))
+ Control.Compose: (&&&%) :: FunAble h => (h a -> h b) -> (h a -> h b') -> (h a -> h (b, b'))
- Control.Compose: (***%) :: (FunAble h) => (h a -> h b) -> (h a' -> h b') -> (h (a, a') -> h (b, b'))
+ Control.Compose: (***%) :: FunAble h => (h a -> h b) -> (h a' -> h b') -> (h (a, a') -> h (b, b'))
- Control.Compose: arrFun :: (FunAble h) => (a -> b) -> (h a -> h b)
+ Control.Compose: arrFun :: FunAble h => (a -> b) -> (h a -> h b)
- Control.Compose: bicomap :: (Cofunctor f) => (a :<->: b) -> (f a :<->: f b)
+ Control.Compose: bicomap :: Cofunctor f => (a :<->: b) -> (f a :<->: f b)
- Control.Compose: coconvO :: (Cofunctor g) => (b :<->: g c) -> (c :<->: f a) -> (b :<->: (g :. f) a)
+ Control.Compose: coconvO :: Cofunctor g => (b :<->: g c) -> (c :<->: f a) -> (b :<->: (g :. f) a)
- Control.Compose: cofmap :: (Cofunctor acc) => (a -> b) -> (acc b -> acc a)
+ Control.Compose: cofmap :: Cofunctor acc => (a -> b) -> (acc b -> acc a)
- Control.Compose: convO :: (Functor g) => (b :<->: g c) -> (c :<->: f a) -> (b :<->: (g :. f) a)
+ Control.Compose: convO :: Functor g => (b :<->: g c) -> (c :<->: f a) -> (b :<->: (g :. f) a)
- Control.Compose: firstFun :: (FunAble h) => (h a -> h a') -> (h (a, b) -> h (a', b))
+ Control.Compose: firstFun :: FunAble h => (h a -> h a') -> (h (a, b) -> h (a', b))
- Control.Compose: inConst :: (a -> b) -> Const a u -> Const b v
+ Control.Compose: inConst :: (a -> b) -> (Const a u -> Const b v)
- Control.Compose: mappend_f :: (Monoid_f m) => m a -> m a -> m a
+ Control.Compose: mappend_f :: Monoid_f m => m a -> m a -> m a
- Control.Compose: mempty_f :: (Monoid_f m) => m a
+ Control.Compose: mempty_f :: Monoid_f m => m a
- Control.Compose: oFmap :: (Functor g') => (f a -> f' a') -> (g' :. f) a -> (g' :. f') a'
+ Control.Compose: oFmap :: Functor g' => (f a -> f' a') -> (g' :. f) a -> (g' :. f') a'
- Control.Compose: oLiftA2 :: (Applicative g'') => (f a -> f' a' -> f'' a'') -> (g'' :. f) a -> (g'' :. f') a' -> (g'' :. f'') a''
+ Control.Compose: oLiftA2 :: Applicative g'' => (f a -> f' a' -> f'' a'') -> (g'' :. f) a -> (g'' :. f') a' -> (g'' :. f'') a''
- Control.Compose: oLiftA3 :: (Applicative g''') => (f a -> f' a' -> f'' a'' -> f''' a''') -> (g''' :. f) a -> (g''' :. f') a' -> (g''' :. f'') a'' -> (g''' :. f''') a'''
+ Control.Compose: oLiftA3 :: Applicative g''' => (f a -> f' a' -> f'' a'' -> f''' a''') -> (g''' :. f) a -> (g''' :. f') a' -> (g''' :. f'') a'' -> (g''' :. f''') a'''
- Control.Compose: oPure :: (Applicative g) => f a -> (g :. f) a
+ Control.Compose: oPure :: Applicative g => f a -> (g :. f) a
- Control.Compose: secondFun :: (FunAble h) => (h b -> h b') -> (h (a, b) -> h (a, b'))
+ Control.Compose: secondFun :: FunAble h => (h b -> h b') -> (h (a, b) -> h (a, b'))
- Control.Compose: toOI :: (ToOI sink) => sink b -> OI b
+ Control.Compose: toOI :: ToOI sink => sink b -> OI b
- Data.Bijection: (--->) :: (Arrow ~>) => Bijection ~> a b -> Bijection ~> c d -> (a ~> c) :<->: (b ~> d)
+ Data.Bijection: (--->) :: Arrow ~> => Bijection ~> a b -> Bijection ~> c d -> (a ~> c) :<->: (b ~> d)
- Data.Bijection: bimap :: (Functor f) => (a :<->: b) -> (f a :<->: f b)
+ Data.Bijection: bimap :: Functor f => (a :<->: b) -> (f a :<->: f b)
- Data.Bijection: idb :: (Arrow ~>) => Bijection ~> a a
+ Data.Bijection: idb :: Arrow ~> => Bijection ~> a a
- Data.Bijection: inBi :: (Arrow ~>) => Bijection ~> a b -> (a ~> a) -> (b ~> b)
+ Data.Bijection: inBi :: Arrow ~> => Bijection ~> a b -> (a ~> a) -> (b ~> b)
- Data.Lambda: cores :: (Colambda f) => f b -> f (a -> b)
+ Data.Lambda: cores :: Colambda f => f b -> f (a -> b)
- Data.Lambda: fres :: (Unlambda src snk) => snk (a -> b) -> snk b
+ Data.Lambda: fres :: Unlambda src snk => snk (a -> b) -> snk b
- Data.Lambda: fsrc :: (Unlambda src snk) => snk (a -> b) -> src a
+ Data.Lambda: fsrc :: Unlambda src snk => snk (a -> b) -> src a
- Data.Lambda: lambda :: (Lambda src snk) => LambdaTy src snk
+ Data.Lambda: lambda :: Lambda src snk => LambdaTy src snk
- Data.Lambda: unlambda :: (Unlambda src snk) => snk (a -> b) -> (src a, snk b)
+ Data.Lambda: unlambda :: Unlambda src snk => snk (a -> b) -> (src a, snk b)
- Data.Pair: cofsts :: (Copair f) => f a -> f (a, b)
+ Data.Pair: cofsts :: Copair f => f a -> f (a, b)
- Data.Pair: cosnds :: (Copair f) => f b -> f (a, b)
+ Data.Pair: cosnds :: Copair f => f b -> f (a, b)
- Data.Pair: fsts :: (Unpair f) => f (a, b) -> f a
+ Data.Pair: fsts :: Unpair f => f (a, b) -> f a
- Data.Pair: pair :: (Pair f) => PairTy f
+ Data.Pair: pair :: Pair f => PairTy f
- Data.Pair: pairEditM :: (MonadPlus m) => (m c, m d) -> m ((c, d) -> (c, d))
+ Data.Pair: pairEditM :: MonadPlus m => (m c, m d) -> m ((c, d) -> (c, d))
- Data.Pair: snds :: (Unpair f) => f (a, b) -> f b
+ Data.Pair: snds :: Unpair f => f (a, b) -> f b
- Data.Pair: unpair :: (Unpair f) => UnpairTy f
+ Data.Pair: unpair :: Unpair f => UnpairTy f
- Data.Partial: pUnElt :: (Functor f) => PartialX a (f a)
+ Data.Partial: pUnElt :: Functor f => PartialX a (f a)
- Data.RefMonad: class (Monad m) => RefMonad m r | m -> r
+ Data.RefMonad: class Monad m => RefMonad m r | m -> r
- Data.RefMonad: modifyRef :: (RefMonad m r) => r a -> (a -> a) -> m ()
+ Data.RefMonad: modifyRef :: RefMonad m r => r a -> (a -> a) -> m ()
- Data.RefMonad: newRef :: (RefMonad m r) => a -> m (r a)
+ Data.RefMonad: newRef :: RefMonad m r => a -> m (r a)
- Data.RefMonad: readRef :: (RefMonad m r) => r a -> m a
+ Data.RefMonad: readRef :: RefMonad m r => r a -> m a
- Data.RefMonad: writeRef :: (RefMonad m r) => r a -> a -> m ()
+ Data.RefMonad: writeRef :: RefMonad m r => r a -> a -> m ()
- Data.Title: title :: (Title u) => String -> u -> u
+ Data.Title: title :: Title u => String -> u -> u
- Data.Title: title_f :: (Title_f f) => String -> f a -> f a
+ Data.Title: title_f :: Title_f f => String -> f a -> f a
- Data.Zip: cofsts :: (Cozip f) => f a -> f (a, b)
+ Data.Zip: cofsts :: Cozip f => f a -> f (a, b)
- Data.Zip: cosnds :: (Cozip f) => f b -> f (a, b)
+ Data.Zip: cosnds :: Cozip f => f b -> f (a, b)
- Data.Zip: fsts :: (Unzip f) => f (a, b) -> f a
+ Data.Zip: fsts :: Unzip f => f (a, b) -> f a
- Data.Zip: pairEditM :: (MonadPlus m) => (m c, m d) -> m ((c, d) -> (c, d))
+ Data.Zip: pairEditM :: MonadPlus m => (m c, m d) -> m ((c, d) -> (c, d))
- Data.Zip: snds :: (Unzip f) => f (a, b) -> f b
+ Data.Zip: snds :: Unzip f => f (a, b) -> f b
- Data.Zip: unzip :: (Unzip f) => UnzipTy f
+ Data.Zip: unzip :: Unzip f => UnzipTy f
- Data.Zip: zip :: (Zip f) => ZipTy f
+ Data.Zip: zip :: Zip f => ZipTy f
Files
- TypeCompose.cabal +2/−2
- src/Control/Compose.hs +48/−21
- src/Data/Title.hs +2/−0
TypeCompose.cabal view
@@ -1,5 +1,5 @@ Name: TypeCompose-Version: 0.6.8+Version: 0.7.0 Synopsis: Type composition classes & instances Category: Composition, Control Description:@@ -8,7 +8,7 @@ . Please see the project wiki page: <http://haskell.org/haskellwiki/TypeCompose> .- © 2007 by Conal Elliott; BSD3 license.+ © 2007-2010 by Conal Elliott; BSD3 license. Author: Conal Elliott Maintainer: conal@conal.net Homepage: http://haskell.org/haskellwiki/TypeCompose
src/Control/Compose.hs view
@@ -25,7 +25,11 @@ ---------------------------------------------------------------------- module Control.Compose- ( Unop, Binop+ ( + -- * Value transformers+ Unop, Binop+ -- * Specialized semantic editor combinators+ , result, argument, (~>) -- * Contravariant functors , Cofunctor(..), bicomap -- * Unary\/unary composition@@ -88,8 +92,9 @@ infixl 0 $* infixr 3 ***# + {----------------------------------------------------------- Misc+ Value transformers ----------------------------------------------------------} -- |Unary functions@@ -98,6 +103,35 @@ type Binop a = a -> a -> a +{--------------------------------------------------------------------+ Semantic editor combinators, specialized to functions.+ See http://conal.net/blog/posts/semantic-editor-combinators/.+ Also the DeepArrow package.+--------------------------------------------------------------------}++-- | Add pre-processing+argument :: (a' -> a) -> ((a -> b) -> (a' -> b))+argument = flip (.)++-- | Add post-processing+result :: (b -> b') -> ((a -> b) -> (a -> b'))+result = (.)++infixr 1 ~>+-- | Add pre- and post processing+(~>) :: (a' -> a) -> (b -> b') -> ((a -> b) -> (a' -> b'))+-- (f ~> h) g = h . g . f+f ~> h = result h . argument f++-- More generally,+-- +-- (~>) :: Category (-->) => (a' --> a) -> (b --> b') -> ((a --> b) -> (a' --> b'))++-- If I add argument back to DeepArrow, we can get a different generalization:+-- +-- (~>) :: DeepArrow (-->) => (a' --> a) -> (b --> b') -> ((a -> b) --> (a' -> b'))++ {---------------------------------------------------------- Contravariant functors ----------------------------------------------------------}@@ -190,24 +224,17 @@ -- | Apply a unary function within the 'O' constructor. inO :: (g (f a) -> g' (f' a')) -> ((g :. f) a -> (g' :. f') a')-inO = (O .).(. unO)---- inO h (O gfa) = O (h gfa)--- inO h = O . h . unO+inO = unO ~> O -- | Apply a binary function within the 'O' constructor. inO2 :: (g (f a) -> g' (f' a') -> g'' (f'' a'')) -> ((g :. f) a -> (g' :. f') a' -> (g'' :. f'') a'')-inO2 = (inO .).(.unO)---- inO2 h (O gfa) (O gfa') = O (h gfa gfa')--- inO2 h (O gfa) = inO (h gfa)+inO2 = unO ~> inO -- | Apply a ternary function within the 'O' constructor. inO3 :: (g (f a) -> g' (f' a') -> g'' (f'' a'') -> g''' (f''' a''')) -> ((g :. f) a -> (g' :. f') a' -> (g'' :. f'') a'' -> (g''' :. f''') a''')-inO3 = (inO2 .).(.unO)--- inO3 h (O gfa) = inO2 (h gfa)+inO3 = unO ~> inO2 -- | Handy combination of 'O' and 'pure'.@@ -399,7 +426,7 @@ -- | Apply unary function in side a 'FunA' representation. inFunA :: ((h a -> h b) -> (h' a' -> h' b')) -> (FunA h a b -> FunA h' a' b')-inFunA = (FunA .).(. unFunA)+inFunA = unFunA ~> FunA -- | Apply binary function in side a 'FunA' representation. inFunA2 :: ((h a -> h b) -> (h' a' -> h' b') -> (h'' a'' -> h'' b''))@@ -471,7 +498,7 @@ -- Apply unary function inside of a 'Flip' representation. inFlip :: ((a~>b) -> (a' ~~> b')) -> (Flip (~>) b a -> Flip (~~>) b' a')-inFlip = (Flip .).(. unFlip)+inFlip = unFlip ~> Flip -- Apply binary function inside of a 'Flip' representation. inFlip2 :: ((a~>b) -> (a' ~~> b') -> (a'' ~~~> b''))@@ -529,7 +556,7 @@ -- Apply unary function inside of an 'App representation. inApp :: (f a -> f' a') -> (App f a -> App f' a')-inApp = (App .).(. unApp)+inApp = unApp ~> App -- Apply binary function inside of a 'App' representation. inApp2 :: (f a -> f' a' -> f'' a'') -> (App f a -> App f' a' -> App f'' a'')@@ -553,7 +580,7 @@ newtype Id a = Id { unId :: a } inId :: (a -> b) -> (Id a -> Id b)-inId = (Id .).(. unId)+inId = unId ~> Id inId2 :: (a -> b -> c) -> (Id a -> Id b -> Id c) inId2 f (Id a) = inId (f a)@@ -601,7 +628,7 @@ -- | Apply unary function inside of @f :*: g@ representation. inProd :: ((f a, g a) -> (f' a', g' a')) -> ((f :*: g) a -> (f' :*: g') a')-inProd = (Prod .).(. unProd)+inProd = unProd ~> Prod -- | Apply binary function inside of @f :*: g@ representation. inProd2 :: ((f a, g a) -> (f' a', g' a') -> (f'' a'', g'' a''))@@ -665,7 +692,7 @@ -- | Apply binary function inside of @f :*: g@ representation. inProdd :: ((f a b, g a b) -> (f' a' b', g' a' b')) -> ((f ::*:: g) a b -> (f' ::*:: g') a' b')-inProdd = (Prodd .).(. unProdd)+inProdd = unProdd ~> Prodd -- | Apply binary function inside of @f :*: g@ representation. inProdd2 :: ((f a b, g a b) -> (f' a' b', g' a' b') -> (f'' a'' b'', g'' a'' b''))@@ -714,7 +741,7 @@ -- | Apply unary function inside of @Arrw@ representation. inArrw :: ((f a ~> g a) -> (f' a' ~> g' a')) -> ((Arrw (~>) f g) a -> (Arrw (~>) f' g') a')-inArrw = (Arrw .).(. unArrw)+inArrw = unArrw ~> Arrw -- | Apply binary function inside of @Arrw (~>) f g@ representation. inArrw2 :: ((f a ~> g a) -> (f' a' ~> g' a') -> (f'' a'' ~> g'' a''))@@ -766,8 +793,8 @@ biConst :: a :<->: Const a b biConst = Bi Const getConst -inConst :: (a -> b) -> Const a u -> Const b v-inConst = (Const .).(. getConst)+inConst :: (a -> b) -> (Const a u -> Const b v)+inConst = getConst ~> Const inConst2 :: (a -> b -> c) -> Const a u -> Const b v -> Const c w inConst2 f (Const a) = inConst (f a)
src/Data/Title.hs view
@@ -64,3 +64,5 @@ -- Equivalently, -- -- title_f str (Flip snk) = Flip (title str snk)++-- TODO: Generalize the Title_f instance to other arrows.