TypeCompose-0.9.14: Type composition classes & instances

Copyright(c) Conal Elliott 2007-2013
LicenseBSD3
Maintainerconal@conal.net
Stabilityexperimental
Portabilitysee LANGUAGE pragma
Safe HaskellNone
LanguageHaskell98

Control.Compose

Contents

Description

Various type constructor compositions and instances for them. Some come from "Applicative Programming with Effects" http://www.soi.city.ac.uk/~ross/papers/Applicative.html

Synopsis

Value transformers

type Unop a = a -> a Source #

Unary functions

type Binop a = a -> a -> a Source #

Binary functions

Specialized semantic editor combinators

result :: Category cat => (b `cat` b') -> (a `cat` b) -> a `cat` b' Source #

Add post-processing

argument :: Category cat => (a' `cat` a) -> (a `cat` b) -> a' `cat` b Source #

Add pre-processing argument :: (a' -> a) -> ((a -> b) -> (a' -> b))

(~>) :: Category cat => (a' `cat` a) -> (b `cat` b') -> (a `cat` b) -> a' `cat` b' infixr 1 Source #

Add pre- and post processing

(~>*) :: (Functor p, Functor q) => (a' -> a) -> (b -> b') -> (p a -> q b) -> p a' -> q b' infixr 1 Source #

Like '(~>)' but specialized to functors and functions.

(<~) :: Category cat => (b `cat` b') -> (a' `cat` a) -> (a `cat` b) -> a' `cat` b' infixl 1 Source #

(*<~) :: (Functor p, Functor q) => (b -> b') -> (a' -> a) -> (p a -> q b) -> p a' -> q b' infixl 1 Source #

Contravariant functors

class ContraFunctor h where Source #

Contravariant functors. often useful for acceptors (consumers, sinks) of values.

Methods

contraFmap :: (a -> b) -> h b -> h a Source #

Instances
Arrow arr => ContraFunctor (Flip arr b) Source # 
Instance details

Defined in Control.Compose

Methods

contraFmap :: (a -> b0) -> Flip arr b b0 -> Flip arr b a Source #

(Arrow j, Functor f, ContraFunctor g) => ContraFunctor (Arrw j f g) Source # 
Instance details

Defined in Control.Compose

Methods

contraFmap :: (a -> b) -> Arrw j f g b -> Arrw j f g a Source #

bicomap :: ContraFunctor f => (a :<->: b) -> f a :<->: f b Source #

Bijections on contravariant functors

Unary/unary composition

newtype ((g :: k2 -> *) :. (f :: k1 -> k2)) (a :: k1) infixl 9 Source #

Composition of unary type constructors

There are (at least) two useful Monoid instances, so you'll have to pick one and type-specialize it (filling in all or parts of g and/or f).

    -- standard Monoid instance for Applicative applied to Monoid
    instance (Applicative (g :. f), Monoid a) => Monoid ((g :. f) a) where
      { mempty = pure mempty; mappend = liftA2 mappend }
    -- Especially handy when g is a Monoid_f.
    instance Monoid (g (f a)) => Monoid ((g :. f) a) where
      { mempty = O mempty; mappend = inO2 mappend }

Corresponding to the first and second definitions above,

    instance (Applicative g, Monoid_f f) => Monoid_f (g :. f) where
      { mempty_f = O (pure mempty_f); mappend_f = inO2 (liftA2 mappend_f) }
    instance Monoid_f g => Monoid_f (g :. f) where
      { mempty_f = O mempty_f; mappend_f = inO2 mappend_f }

Similarly, there are two useful Functor instances and two useful ContraFunctor instances.

    instance (      Functor g,       Functor f) => Functor (g :. f) where fmap = fmapFF
    instance (ContraFunctor g, ContraFunctor f) => Functor (g :. f) where fmap = fmapCC

    instance (      Functor g, ContraFunctor f) => ContraFunctor (g :. f) where contraFmap = contraFmapFC
    instance (ContraFunctor g,       Functor f) => ContraFunctor (g :. f) where contraFmap = contraFmapCF

However, it's such a bother to define the Functor instances per composition type, I've left the fmapFF case in. If you want the fmapCC one, you're out of luck for now. I'd love to hear a good solution. Maybe someday Haskell will do Prolog-style search for instances, subgoaling the constraints, rather than just matching instance heads.

Constructors

O (g (f a)) 
Instances
Functor g => Generic1 (g :. f :: k -> Type) Source # 
Instance details

Defined in Control.Compose

Associated Types

type Rep1 (g :. f) :: k -> Type #

Methods

from1 :: (g :. f) a -> Rep1 (g :. f) a #

to1 :: Rep1 (g :. f) a -> (g :. f) a #

Applicative f => Lambda f (Flip ((->) :: Type -> Type -> Type) o :. f) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy f (Flip (->) o :. f) Source #

Applicative f => Lambda f (f :. Flip ((->) :: Type -> Type -> Type) o) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy f (f :. Flip (->) o) Source #

(Functor g, Functor f) => Functor (g :. f) Source # 
Instance details

Defined in Control.Compose

Methods

fmap :: (a -> b) -> (g :. f) a -> (g :. f) b #

(<$) :: a -> (g :. f) b -> (g :. f) a #

(Applicative g, Applicative f) => Applicative (g :. f) Source # 
Instance details

Defined in Control.Compose

Methods

pure :: a -> (g :. f) a #

(<*>) :: (g :. f) (a -> b) -> (g :. f) a -> (g :. f) b #

liftA2 :: (a -> b -> c) -> (g :. f) a -> (g :. f) b -> (g :. f) c #

(*>) :: (g :. f) a -> (g :. f) b -> (g :. f) b #

(<*) :: (g :. f) a -> (g :. f) b -> (g :. f) a #

(Foldable g, Foldable f, Functor g) => Foldable (g :. f) Source # 
Instance details

Defined in Control.Compose

Methods

fold :: Monoid m => (g :. f) m -> m #

foldMap :: Monoid m => (a -> m) -> (g :. f) a -> m #

foldr :: (a -> b -> b) -> b -> (g :. f) a -> b #

foldr' :: (a -> b -> b) -> b -> (g :. f) a -> b #

foldl :: (b -> a -> b) -> b -> (g :. f) a -> b #

foldl' :: (b -> a -> b) -> b -> (g :. f) a -> b #

foldr1 :: (a -> a -> a) -> (g :. f) a -> a #

foldl1 :: (a -> a -> a) -> (g :. f) a -> a #

toList :: (g :. f) a -> [a] #

null :: (g :. f) a -> Bool #

length :: (g :. f) a -> Int #

elem :: Eq a => a -> (g :. f) a -> Bool #

maximum :: Ord a => (g :. f) a -> a #

minimum :: Ord a => (g :. f) a -> a #

sum :: Num a => (g :. f) a -> a #

product :: Num a => (g :. f) a -> a #

(Traversable g, Traversable f) => Traversable (g :. f) Source # 
Instance details

Defined in Control.Compose

Methods

traverse :: Applicative f0 => (a -> f0 b) -> (g :. f) a -> f0 ((g :. f) b) #

sequenceA :: Applicative f0 => (g :. f) (f0 a) -> f0 ((g :. f) a) #

mapM :: Monad m => (a -> m b) -> (g :. f) a -> m ((g :. f) b) #

sequence :: Monad m => (g :. f) (m a) -> m ((g :. f) a) #

(Functor h, Copair f) => Copair (h :. f) Source # 
Instance details

Defined in Data.Pair

Methods

cofsts :: (h :. f) a -> (h :. f) (a, b) Source #

cosnds :: (h :. f) b -> (h :. f) (a, b) Source #

Title_f g => Title_f (g :. f) Source # 
Instance details

Defined in Data.Title

Methods

title_f :: String -> (g :. f) a -> (g :. f) a Source #

(Functor h, Cozip f) => Cozip (h :. f) Source # 
Instance details

Defined in Data.Zip

Methods

cofsts :: (h :. f) a -> (h :. f) (a, b) Source #

cosnds :: (h :. f) b -> (h :. f) (a, b) Source #

Eq (g (f a)) => Eq ((g :. f) a) Source # 
Instance details

Defined in Control.Compose

Methods

(==) :: (g :. f) a -> (g :. f) a -> Bool #

(/=) :: (g :. f) a -> (g :. f) a -> Bool #

Ord (g (f a)) => Ord ((g :. f) a) Source # 
Instance details

Defined in Control.Compose

Methods

compare :: (g :. f) a -> (g :. f) a -> Ordering #

(<) :: (g :. f) a -> (g :. f) a -> Bool #

(<=) :: (g :. f) a -> (g :. f) a -> Bool #

(>) :: (g :. f) a -> (g :. f) a -> Bool #

(>=) :: (g :. f) a -> (g :. f) a -> Bool #

max :: (g :. f) a -> (g :. f) a -> (g :. f) a #

min :: (g :. f) a -> (g :. f) a -> (g :. f) a #

Show (g (f a)) => Show ((g :. f) a) Source # 
Instance details

Defined in Control.Compose

Methods

showsPrec :: Int -> (g :. f) a -> ShowS #

show :: (g :. f) a -> String #

showList :: [(g :. f) a] -> ShowS #

Generic ((g :. f) a) Source # 
Instance details

Defined in Control.Compose

Associated Types

type Rep ((g :. f) a) :: Type -> Type #

Methods

from :: (g :. f) a -> Rep ((g :. f) a) x #

to :: Rep ((g :. f) a) x -> (g :. f) a #

type Rep1 (g :. f :: k -> Type) Source # 
Instance details

Defined in Control.Compose

type Rep1 (g :. f :: k -> Type) = D1 (MetaData ":." "Control.Compose" "TypeCompose-0.9.14-4iCBqWWcPGLDb6u5L5trZI" True) (C1 (MetaCons "O" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (g :.: Rec1 f)))
type Rep ((g :. f) a) Source # 
Instance details

Defined in Control.Compose

type Rep ((g :. f) a) = D1 (MetaData ":." "Control.Compose" "TypeCompose-0.9.14-4iCBqWWcPGLDb6u5L5trZI" True) (C1 (MetaCons "O" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g (f a)))))

type O = (:.) Source #

Compatibility synonym

unO :: (g :. f) a -> g (f a) Source #

Unwrap a '(:.)'.

biO :: g (f a) :<->: (g :. f) a Source #

newtype bijection

convO :: Functor g => (b :<->: g c) -> (c :<->: f a) -> b :<->: (g :. f) a Source #

Compose a bijection, Functor style

coconvO :: ContraFunctor g => (b :<->: g c) -> (c :<->: f a) -> b :<->: (g :. f) a Source #

Compose a bijection, ContraFunctor style

inO :: (g (f a) -> g' (f' a')) -> (g :. f) a -> (g' :. f') a' Source #

Apply a unary function within the :. constructor.

inO2 :: (g (f a) -> g' (f' a') -> g'' (f'' a'')) -> (g :. f) a -> (g' :. f') a' -> (g'' :. f'') a'' Source #

Apply a binary function within the :. 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''' Source #

Apply a ternary function within the :. constructor.

oPure :: Applicative g => f a -> (g :. f) a Source #

Handy combination of :. and pure.

oFmap :: Functor g' => (f a -> f' a') -> (g' :. f) a -> (g' :. f') a' Source #

Handy combination of inO and fmap.

oLiftA2 :: Applicative g'' => (f a -> f' a' -> f'' a'') -> (g'' :. f) a -> (g'' :. f') a' -> (g'' :. f'') a'' Source #

Handy combination of inO2 and liftA2.

oLiftA3 :: Applicative g''' => (f a -> f' a' -> f'' a'' -> f''' a''') -> (g''' :. f) a -> (g''' :. f') a' -> (g''' :. f'') a'' -> (g''' :. f''') a''' Source #

Handy combination of inO3 and liftA3.

fmapFF :: (Functor g, Functor f) => (a -> b) -> (g :. f) a -> (g :. f) b Source #

Used for the Functor :. Functor instance of Functor

fmapCC :: (ContraFunctor g, ContraFunctor f) => (a -> b) -> (g :. f) a -> (g :. f) b Source #

Used for the ContraFunctor :. ContraFunctor instance of Functor

contraFmapFC :: (Functor g, ContraFunctor f) => (b -> a) -> (g :. f) a -> (g :. f) b Source #

Used for the Functor :. ContraFunctor instance of Functor

contraFmapCF :: (ContraFunctor g, Functor f) => (b -> a) -> (g :. f) a -> (g :. f) b Source #

Used for the ContraFunctor :. Functor instance of Functor

class DistribM m n where Source #

Monad distributivity.

TODO: what conditions are required so that (m :. n) satisfies the monad laws?

Methods

distribM :: n (m a) -> m (n a) Source #

joinDistribM :: (Monad m, Monad n, DistribM m n) => (m :. n) ((m :. n) a) -> (m :. n) a Source #

A candidate join for (m :. n)

bindDistribM :: (Functor m, Functor n, Monad m, Monad n, DistribM m n) => (m :. n) a -> (a -> (m :. n) b) -> (m :. n) b Source #

A candidate '(>>=)' for (m :. n)

returnDistribM :: (Monad m, Monad n) => a -> (m :. n) a Source #

joinMMT :: (Monad m, Monad n, Traversable n, Applicative m) => m (n (m (n a))) -> m (n a) Source #

join-like function for implicitly composed monads

joinComposeT :: (Monad m, Monad n, Traversable n, Applicative m) => (m :. n) ((m :. n) a) -> (m :. n) a Source #

join-like function for explicitly composed monads

Type composition

Unary/binary

newtype OO f j a b Source #

Composition of type constructors: unary with binary. Called StaticArrow in [1].

Constructors

OO 

Fields

  • unOO :: f (a `j` b)
     
Instances
(Applicative f, Category cat) => Category (OO f cat :: k -> k -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

id :: OO f cat a a #

(.) :: OO f cat b c -> OO f cat a b -> OO f cat a c #

(Applicative f, Arrow arr) => Arrow (OO f arr) Source # 
Instance details

Defined in Control.Compose

Methods

arr :: (b -> c) -> OO f arr b c #

first :: OO f arr b c -> OO f arr (b, d) (c, d) #

second :: OO f arr b c -> OO f arr (d, b) (d, c) #

(***) :: OO f arr b c -> OO f arr b' c' -> OO f arr (b, b') (c, c') #

(&&&) :: OO f arr b c -> OO f arr b c' -> OO f arr b (c, c') #

(->)/unary

newtype FunA h a b Source #

Common pattern for Arrows.

Constructors

FunA 

Fields

Instances
FunAble h => Category (FunA h :: Type -> Type -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

id :: FunA h a a #

(.) :: FunA h b c -> FunA h a b -> FunA h a c #

FunAble h => Arrow (FunA h) Source # 
Instance details

Defined in Control.Compose

Methods

arr :: (b -> c) -> FunA h b c #

first :: FunA h b c -> FunA h (b, d) (c, d) #

second :: FunA h b c -> FunA h (d, b) (d, c) #

(***) :: FunA h b c -> FunA h b' c' -> FunA h (b, b') (c, c') #

(&&&) :: FunA h b c -> FunA h b c' -> FunA h b (c, c') #

inFunA :: ((h a -> h b) -> h' a' -> h' b') -> FunA h a b -> FunA h' a' b' Source #

Apply unary function in side a FunA representation.

inFunA2 :: ((h a -> h b) -> (h' a' -> h' b') -> h'' a'' -> h'' b'') -> FunA h a b -> FunA h' a' b' -> FunA h'' a'' b'' Source #

Apply binary function in side a FunA representation.

class FunAble h where Source #

Support needed for a FunA to be an Arrow.

Minimal complete definition

arrFun, firstFun, secondFun

Methods

arrFun Source #

Arguments

:: (a -> b) 
-> h a -> h b

for arr

firstFun :: (h a -> h a') -> h (a, b) -> h (a', b) Source #

secondFun :: (h b -> h b') -> h (a, b) -> h (a, b') Source #

(***%) :: (h a -> h b) -> (h a' -> h b') -> h (a, a') -> h (b, b') Source #

(&&&%) :: (h a -> h b) -> (h a -> h b') -> h a -> h (b, b') Source #

Instances
FunAble Partial Source # 
Instance details

Defined in Data.Partial

Methods

arrFun :: (a -> b) -> Partial a -> Partial b Source #

firstFun :: (Partial a -> Partial a') -> Partial (a, b) -> Partial (a', b) Source #

secondFun :: (Partial b -> Partial b') -> Partial (a, b) -> Partial (a, b') Source #

(***%) :: (Partial a -> Partial b) -> (Partial a' -> Partial b') -> Partial (a, a') -> Partial (b, b') Source #

(&&&%) :: (Partial a -> Partial b) -> (Partial a -> Partial b') -> Partial a -> Partial (b, b') Source #

Monoid constructors

class Monoid_f m where Source #

Simulates universal constraint forall a. Monoid (f a).

See Simulating Quantified Class Constraints (http://flint.cs.yale.edu/trifonov/papers/sqcc.pdf) Instantiate this schema wherever necessary:

   instance Monoid_f f where { mempty_f = mempty ; mappend_f = mappend }

Methods

mempty_f :: forall a. m a Source #

mappend_f :: forall a. m a -> m a -> m a Source #

Instances
(Monoid_f f, Monoid_f g) => Monoid_f (f :*: g :: k -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

mempty_f :: (f :*: g) a Source #

mappend_f :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a Source #

Monoid_f [] Source # 
Instance details

Defined in Control.Compose

Methods

mempty_f :: [a] Source #

mappend_f :: [a] -> [a] -> [a] Source #

Monoid_f Endo Source # 
Instance details

Defined in Control.Compose

Methods

mempty_f :: Endo a Source #

mappend_f :: Endo a -> Endo a -> Endo a Source #

Monoid o => Monoid_f (Flip ((->) :: Type -> Type -> Type) o :: Type -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

mempty_f :: Flip (->) o a Source #

mappend_f :: Flip (->) o a -> Flip (->) o a -> Flip (->) o a Source #

Flip a binary constructor's type arguments

newtype Flip j b a Source #

Flip type arguments

Constructors

Flip 

Fields

Instances
ToOI OI Source # 
Instance details

Defined in Control.Compose

Methods

toOI :: OI b -> OI b Source #

Lambda IO OI Source # 
Instance details

Defined in Data.Lambda

Applicative f => Lambda f (Flip ((->) :: Type -> Type -> Type) o :. f) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy f (Flip (->) o :. f) Source #

Applicative f => Lambda f (f :. Flip ((->) :: Type -> Type -> Type) o) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy f (f :. Flip (->) o) Source #

Lambda Id (Flip ((->) :: Type -> Type -> Type) o) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy Id (Flip (->) o) Source #

Monoid o => Monoid_f (Flip ((->) :: Type -> Type -> Type) o :: Type -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

mempty_f :: Flip (->) o a Source #

mappend_f :: Flip (->) o a -> Flip (->) o a -> Flip (->) o a Source #

Arrow arr => ContraFunctor (Flip arr b) Source # 
Instance details

Defined in Control.Compose

Methods

contraFmap :: (a -> b0) -> Flip arr b b0 -> Flip arr b a Source #

Arrow j => Copair (Flip j o) Source # 
Instance details

Defined in Data.Pair

Methods

cofsts :: Flip j o a -> Flip j o (a, b) Source #

cosnds :: Flip j o b -> Flip j o (a, b) Source #

(Arrow j, Monoid_f (Flip j o)) => Pair (Flip j o) Source # 
Instance details

Defined in Data.Pair

Methods

pair :: PairTy (Flip j o) Source #

Title o => Title_f (Flip ((->) :: Type -> Type -> Type) o) Source # 
Instance details

Defined in Data.Title

Methods

title_f :: String -> Flip (->) o a -> Flip (->) o a Source #

Arrow j => Cozip (Flip j o) Source # 
Instance details

Defined in Data.Zip

Methods

cofsts :: Flip j o a -> Flip j o (a, b) Source #

cosnds :: Flip j o b -> Flip j o (a, b) Source #

(Arrow j, Monoid_f (Flip j o)) => Zip (Flip j o) Source # 
Instance details

Defined in Data.Zip

Methods

zip :: ZipTy (Flip j o) Source #

(Applicative (j a), Semigroup o) => Semigroup (Flip j o a) Source # 
Instance details

Defined in Control.Compose

Methods

(<>) :: Flip j o a -> Flip j o a -> Flip j o a #

sconcat :: NonEmpty (Flip j o a) -> Flip j o a #

stimes :: Integral b => b -> Flip j o a -> Flip j o a #

(Applicative (j a), Monoid o) => Monoid (Flip j o a) Source # 
Instance details

Defined in Control.Compose

Methods

mempty :: Flip j o a #

mappend :: Flip j o a -> Flip j o a -> Flip j o a #

mconcat :: [Flip j o a] -> Flip j o a #

biFlip :: (a `j` b) :<->: Flip j b a Source #

newtype bijection

inFlip :: ((a `j` b) -> a' `k` b') -> Flip j b a -> Flip k b' a' Source #

inFlip2 :: ((a `j` b) -> (a' `k` b') -> a'' `l` b'') -> Flip j b a -> Flip k b' a' -> Flip l b'' a'' Source #

inFlip3 :: ((a `j` b) -> (a' `k` b') -> (a'' `l` b'') -> a''' `m` b''') -> Flip j b a -> Flip k b' a' -> Flip l b'' a'' -> Flip m b''' a''' Source #

type OI = Flip (->) (IO ()) Source #

(-> IO ()) as a Flip. A ContraFunctor.

class ToOI sink where Source #

Convert to an OI.

Methods

toOI :: sink b -> OI b Source #

Instances
ToOI OI Source # 
Instance details

Defined in Control.Compose

Methods

toOI :: OI b -> OI b Source #

Type application

newtype f :$ a infixr 0 Source #

Type application We can also drop the App constructor, but then we overlap with many other instances, like [a]. Here's a template for App-free instances.

   instance (Applicative f, Monoid a) => Monoid (f a) where
     mempty  = pure mempty
     mappend = liftA2 mappend

Constructors

App 

Fields

Instances
(Applicative f, Semigroup m) => Semigroup (App f m) Source # 
Instance details

Defined in Control.Compose

Methods

(<>) :: App f m -> App f m -> App f m #

sconcat :: NonEmpty (App f m) -> App f m #

stimes :: Integral b => b -> App f m -> App f m #

(Applicative f, Monoid m) => Monoid (App f m) Source # 
Instance details

Defined in Control.Compose

Methods

mempty :: App f m #

mappend :: App f m -> App f m -> App f m #

mconcat :: [App f m] -> App f m #

type App = (:$) Source #

Compatibility synonym for (:$).

biApp :: f a :<->: App f a Source #

newtype bijection

inApp :: (f a -> f' a') -> App f a -> App f' a' Source #

inApp2 :: (f a -> f' a' -> f'' a'') -> App f a -> App f' a' -> App f'' a'' Source #

Identity

newtype Id a Source #

Identity type constructor. Until there's a better place to find it. I'd use Control.Monad.Identity, but I don't want to introduce a dependency on mtl just for Id.

Constructors

Id a 
Instances
Monad Id Source # 
Instance details

Defined in Control.Compose

Methods

(>>=) :: Id a -> (a -> Id b) -> Id b #

(>>) :: Id a -> Id b -> Id b #

return :: a -> Id a #

fail :: String -> Id a #

Functor Id Source # 
Instance details

Defined in Control.Compose

Methods

fmap :: (a -> b) -> Id a -> Id b #

(<$) :: a -> Id b -> Id a #

Applicative Id Source # 
Instance details

Defined in Control.Compose

Methods

pure :: a -> Id a #

(<*>) :: Id (a -> b) -> Id a -> Id b #

liftA2 :: (a -> b -> c) -> Id a -> Id b -> Id c #

(*>) :: Id a -> Id b -> Id b #

(<*) :: Id a -> Id b -> Id a #

Foldable Id Source # 
Instance details

Defined in Control.Compose

Methods

fold :: Monoid m => Id m -> m #

foldMap :: Monoid m => (a -> m) -> Id a -> m #

foldr :: (a -> b -> b) -> b -> Id a -> b #

foldr' :: (a -> b -> b) -> b -> Id a -> b #

foldl :: (b -> a -> b) -> b -> Id a -> b #

foldl' :: (b -> a -> b) -> b -> Id a -> b #

foldr1 :: (a -> a -> a) -> Id a -> a #

foldl1 :: (a -> a -> a) -> Id a -> a #

toList :: Id a -> [a] #

null :: Id a -> Bool #

length :: Id a -> Int #

elem :: Eq a => a -> Id a -> Bool #

maximum :: Ord a => Id a -> a #

minimum :: Ord a => Id a -> a #

sum :: Num a => Id a -> a #

product :: Num a => Id a -> a #

Traversable Id Source # 
Instance details

Defined in Control.Compose

Methods

traverse :: Applicative f => (a -> f b) -> Id a -> f (Id b) #

sequenceA :: Applicative f => Id (f a) -> f (Id a) #

mapM :: Monad m => (a -> m b) -> Id a -> m (Id b) #

sequence :: Monad m => Id (m a) -> m (Id a) #

Unpair Id Source # 
Instance details

Defined in Data.Pair

Methods

unpair :: UnpairTy Id Source #

fsts :: Id (a, b) -> Id a Source #

snds :: Id (a, b) -> Id b Source #

Pair Id Source # 
Instance details

Defined in Data.Pair

Methods

pair :: PairTy Id Source #

Unzip Id Source # 
Instance details

Defined in Data.Zip

Methods

unzip :: UnzipTy Id Source #

fsts :: Id (a, b) -> Id a Source #

snds :: Id (a, b) -> Id b Source #

Zip Id Source # 
Instance details

Defined in Data.Zip

Methods

zip :: ZipTy Id Source #

Lambda Id (Flip ((->) :: Type -> Type -> Type) o) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy Id (Flip (->) o) Source #

Eq a => Eq (Id a) Source # 
Instance details

Defined in Control.Compose

Methods

(==) :: Id a -> Id a -> Bool #

(/=) :: Id a -> Id a -> Bool #

Ord a => Ord (Id a) Source # 
Instance details

Defined in Control.Compose

Methods

compare :: Id a -> Id a -> Ordering #

(<) :: Id a -> Id a -> Bool #

(<=) :: Id a -> Id a -> Bool #

(>) :: Id a -> Id a -> Bool #

(>=) :: Id a -> Id a -> Bool #

max :: Id a -> Id a -> Id a #

min :: Id a -> Id a -> Id a #

Show a => Show (Id a) Source # 
Instance details

Defined in Control.Compose

Methods

showsPrec :: Int -> Id a -> ShowS #

show :: Id a -> String #

showList :: [Id a] -> ShowS #

Generic (Id a) Source # 
Instance details

Defined in Control.Compose

Associated Types

type Rep (Id a) :: Type -> Type #

Methods

from :: Id a -> Rep (Id a) x #

to :: Rep (Id a) x -> Id a #

Generic1 Id Source # 
Instance details

Defined in Control.Compose

Associated Types

type Rep1 Id :: k -> Type #

Methods

from1 :: Id a -> Rep1 Id a #

to1 :: Rep1 Id a -> Id a #

type Rep (Id a) Source # 
Instance details

Defined in Control.Compose

type Rep (Id a) = D1 (MetaData "Id" "Control.Compose" "TypeCompose-0.9.14-4iCBqWWcPGLDb6u5L5trZI" True) (C1 (MetaCons "Id" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
type Rep1 Id Source # 
Instance details

Defined in Control.Compose

type Rep1 Id = D1 (MetaData "Id" "Control.Compose" "TypeCompose-0.9.14-4iCBqWWcPGLDb6u5L5trZI" True) (C1 (MetaCons "Id" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))

unId :: Id a -> a Source #

biId :: a :<->: Id a Source #

newtype bijection

inId :: (a -> b) -> Id a -> Id b Source #

inId2 :: (a -> b -> c) -> Id a -> Id b -> Id c Source #

Constructor pairing

Unary

newtype (f :*: g) a infixl 7 Source #

Pairing of unary type constructors

Constructors

Prod 

Fields

Instances
(Monoid_f f, Monoid_f g) => Monoid_f (f :*: g :: k -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

mempty_f :: (f :*: g) a Source #

mappend_f :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a Source #

(Functor f, Functor g) => Functor (f :*: g) Source # 
Instance details

Defined in Control.Compose

Methods

fmap :: (a -> b) -> (f :*: g) a -> (f :*: g) b #

(<$) :: a -> (f :*: g) b -> (f :*: g) a #

(Applicative f, Applicative g) => Applicative (f :*: g) Source # 
Instance details

Defined in Control.Compose

Methods

pure :: a -> (f :*: g) a #

(<*>) :: (f :*: g) (a -> b) -> (f :*: g) a -> (f :*: g) b #

liftA2 :: (a -> b -> c) -> (f :*: g) a -> (f :*: g) b -> (f :*: g) c #

(*>) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) b #

(<*) :: (f :*: g) a -> (f :*: g) b -> (f :*: g) a #

(Copair f, Copair g) => Copair (f :*: g) Source # 
Instance details

Defined in Data.Pair

Methods

cofsts :: (f :*: g) a -> (f :*: g) (a, b) Source #

cosnds :: (f :*: g) b -> (f :*: g) (a, b) Source #

(Pair f, Pair g) => Pair (f :*: g) Source # 
Instance details

Defined in Data.Pair

Methods

pair :: PairTy (f :*: g) Source #

(Cozip f, Cozip g) => Cozip (f :*: g) Source # 
Instance details

Defined in Data.Zip

Methods

cofsts :: (f :*: g) a -> (f :*: g) (a, b) Source #

cosnds :: (f :*: g) b -> (f :*: g) (a, b) Source #

(Zip f, Zip g) => Zip (f :*: g) Source # 
Instance details

Defined in Data.Zip

Methods

zip :: ZipTy (f :*: g) Source #

(Lambda src snk, Lambda dom' ran') => Lambda (src :*: dom') (snk :*: ran') Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy (src :*: dom') (snk :*: ran') Source #

Eq (f a, g a) => Eq ((f :*: g) a) Source # 
Instance details

Defined in Control.Compose

Methods

(==) :: (f :*: g) a -> (f :*: g) a -> Bool #

(/=) :: (f :*: g) a -> (f :*: g) a -> Bool #

Ord (f a, g a) => Ord ((f :*: g) a) Source # 
Instance details

Defined in Control.Compose

Methods

compare :: (f :*: g) a -> (f :*: g) a -> Ordering #

(<) :: (f :*: g) a -> (f :*: g) a -> Bool #

(<=) :: (f :*: g) a -> (f :*: g) a -> Bool #

(>) :: (f :*: g) a -> (f :*: g) a -> Bool #

(>=) :: (f :*: g) a -> (f :*: g) a -> Bool #

max :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a #

min :: (f :*: g) a -> (f :*: g) a -> (f :*: g) a #

Show (f a, g a) => Show ((f :*: g) a) Source # 
Instance details

Defined in Control.Compose

Methods

showsPrec :: Int -> (f :*: g) a -> ShowS #

show :: (f :*: g) a -> String #

showList :: [(f :*: g) a] -> ShowS #

(*:*) :: f a -> g a -> (f :*: g) a Source #

Handy infix & curried Prod

biProd :: (f a, g a) :<->: (f :*: g) a Source #

newtype bijection

convProd :: (b :<->: f a) -> (c :<->: g a) -> (b, c) :<->: (f :*: g) a Source #

Compose a bijection

(***#) :: (a -> b -> c) -> (a' -> b' -> c') -> (a, a') -> (b, b') -> (c, c') infixr 3 Source #

Combine two binary functions into a binary function on pairs

($*) :: (a -> b, a' -> b') -> (a, a') -> (b, b') infixl 0 Source #

A handy combining form. See '(***#)' for an sample use.

inProd :: ((f a, g a) -> (f' a', g' a')) -> (f :*: g) a -> (f' :*: g') a' Source #

Apply unary function inside of f :*: g representation.

inProd2 :: ((f a, g a) -> (f' a', g' a') -> (f'' a'', g'' a'')) -> (f :*: g) a -> (f' :*: g') a' -> (f'' :*: g'') a'' Source #

Apply binary function inside of f :*: g representation.

inProd3 :: ((f a, g a) -> (f' a', g' a') -> (f'' a'', g'' a'') -> (f''' a''', g''' a''')) -> (f :*: g) a -> (f' :*: g') a' -> (f'' :*: g'') a'' -> (f''' :*: g''') a''' Source #

Apply ternary function inside of f :*: g representation.

Binary

newtype (f ::*:: g) a b Source #

Pairing of binary type constructors

Constructors

Prodd 

Fields

Instances
(Category f, Category f') => Category (f ::*:: f' :: k -> k -> Type) Source # 
Instance details

Defined in Control.Compose

Methods

id :: (f ::*:: f') a a #

(.) :: (f ::*:: f') b c -> (f ::*:: f') a b -> (f ::*:: f') a c #

(Arrow f, Arrow f') => Arrow (f ::*:: f') Source # 
Instance details

Defined in Control.Compose

Methods

arr :: (b -> c) -> (f ::*:: f') b c #

first :: (f ::*:: f') b c -> (f ::*:: f') (b, d) (c, d) #

second :: (f ::*:: f') b c -> (f ::*:: f') (d, b) (d, c) #

(***) :: (f ::*:: f') b c -> (f ::*:: f') b' c' -> (f ::*:: f') (b, b') (c, c') #

(&&&) :: (f ::*:: f') b c -> (f ::*:: f') b c' -> (f ::*:: f') b (c, c') #

(Eq (f a b), Eq (g a b)) => Eq ((f ::*:: g) a b) Source # 
Instance details

Defined in Control.Compose

Methods

(==) :: (f ::*:: g) a b -> (f ::*:: g) a b -> Bool #

(/=) :: (f ::*:: g) a b -> (f ::*:: g) a b -> Bool #

(Ord (f a b), Ord (g a b)) => Ord ((f ::*:: g) a b) Source # 
Instance details

Defined in Control.Compose

Methods

compare :: (f ::*:: g) a b -> (f ::*:: g) a b -> Ordering #

(<) :: (f ::*:: g) a b -> (f ::*:: g) a b -> Bool #

(<=) :: (f ::*:: g) a b -> (f ::*:: g) a b -> Bool #

(>) :: (f ::*:: g) a b -> (f ::*:: g) a b -> Bool #

(>=) :: (f ::*:: g) a b -> (f ::*:: g) a b -> Bool #

max :: (f ::*:: g) a b -> (f ::*:: g) a b -> (f ::*:: g) a b #

min :: (f ::*:: g) a b -> (f ::*:: g) a b -> (f ::*:: g) a b #

(Show (f a b), Show (g a b)) => Show ((f ::*:: g) a b) Source # 
Instance details

Defined in Control.Compose

Methods

showsPrec :: Int -> (f ::*:: g) a b -> ShowS #

show :: (f ::*:: g) a b -> String #

showList :: [(f ::*:: g) a b] -> ShowS #

(*::*) :: f a b -> g a b -> (f ::*:: g) a b Source #

Handy infix & curried Prodd

inProdd :: ((f a b, g a b) -> (f' a' b', g' a' b')) -> (f ::*:: g) a b -> (f' ::*:: g') a' b' Source #

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'')) -> (f ::*:: g) a b -> (f' ::*:: g') a' b' -> (f'' ::*:: g'') a'' b'' Source #

Apply binary function inside of f :*: g representation.

Arrow between two constructor applications

newtype Arrw j f g a Source #

Arrow-like type between type constructors (doesn't enforce Arrow (~>) here).

Constructors

Arrw 

Fields

Instances
Applicative f => Lambda f (f :->: (Const o :: Type -> Type)) Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy f (f :->: Const o) Source #

(Arrow j, ContraFunctor f, Functor g) => Functor (Arrw j f g) Source # 
Instance details

Defined in Control.Compose

Methods

fmap :: (a -> b) -> Arrw j f g a -> Arrw j f g b #

(<$) :: a -> Arrw j f g b -> Arrw j f g a #

(Arrow j, Functor f, ContraFunctor g) => ContraFunctor (Arrw j f g) Source # 
Instance details

Defined in Control.Compose

Methods

contraFmap :: (a -> b) -> Arrw j f g b -> Arrw j f g a Source #

(Arrow j, Unpair f, Pair g) => Pair (Arrw j f g) Source # 
Instance details

Defined in Data.Pair

Methods

pair :: PairTy (Arrw j f g) Source #

(Arrow j, Unzip f, Zip g) => Zip (Arrw j f g) Source # 
Instance details

Defined in Data.Zip

Methods

zip :: ZipTy (Arrw j f g) Source #

(Arrow j, Unlambda f f', Lambda g g') => Lambda (Arrw j f g) (Arrw j f' g') Source # 
Instance details

Defined in Data.Lambda

Methods

lambda :: LambdaTy (Arrw j f g) (Arrw j f' g') Source #

Semigroup (j (f a) (g a)) => Semigroup (Arrw j f g a) Source # 
Instance details

Defined in Control.Compose

Methods

(<>) :: Arrw j f g a -> Arrw j f g a -> Arrw j f g a #

sconcat :: NonEmpty (Arrw j f g a) -> Arrw j f g a #

stimes :: Integral b => b -> Arrw j f g a -> Arrw j f g a #

Monoid (j (f a) (g a)) => Monoid (Arrw j f g a) Source # 
Instance details

Defined in Control.Compose

Methods

mempty :: Arrw j f g a #

mappend :: Arrw j f g a -> Arrw j f g a -> Arrw j f g a #

mconcat :: [Arrw j f g a] -> Arrw j f g a #

type (:->:) = Arrw (->) infixr 1 Source #

biFun :: (f a -> g a) :<->: (f :->: g) a Source #

newtype bijection

convFun :: (b :<->: f a) -> (c :<->: g a) -> (b -> c) :<->: (f :->: g) a Source #

Compose a bijection

inArrw :: ((f a `j` g a) -> f' a' `j` g' a') -> Arrw j f g a -> Arrw j f' g' a' Source #

Apply unary function inside of Arrw representation.

inArrw2 :: ((f a `j` g a) -> (f' a' `j` g' a') -> f'' a'' `j` g'' a'') -> Arrw j f g a -> Arrw j f' g' a' -> Arrw j f'' g'' a'' Source #

Apply binary function inside of Arrw j f g representation.

inArrw3 :: ((f a `j` g a) -> (f' a' `j` g' a') -> (f'' a'' `j` g'' a'') -> f''' a''' `j` g''' a''') -> Arrw j f g a -> Arrw j f' g' a' -> Arrw j f'' g'' a'' -> Arrw j f''' g''' a''' Source #

Apply ternary function inside of Arrw j f g representation.

Augment other modules

biConst :: a :<->: Const a b Source #

newtype bijection

inConst :: (a -> b) -> Const a u -> Const b v Source #

inConst2 :: (a -> b -> c) -> Const a u -> Const b v -> Const c w Source #

inConst3 :: (a -> b -> c -> d) -> Const a u -> Const b v -> Const c w -> Const d x Source #

biEndo :: (a -> a) :<->: Endo a Source #

newtype bijection

inEndo :: (Unop a -> Unop a') -> Endo a -> Endo a' Source #

Convenience for partial-manipulating functions