TypeCompose-0.1: Type composition classes & instancesSource codeContentsIndex
Control.Compose
Portabilityportable
Stabilityexperimental
Maintainerconal@conal.net
Description
Various type constructor compositions and instances for them. References: [1] "Applicative Programming with Effects" http://www.soi.city.ac.uk/~ross/papers/Applicative.html
Synopsis
class Cofunctor acc where
cofmap :: (a -> b) -> acc b -> acc a
newtype O g f a = O {
unO :: g (f a)
}
inO :: (g (f a) -> g' (f' a')) -> O g f a -> O g' f' a'
newtype StaticArrow f (~>) a b = Static {
unStatic :: f (a ~> b)
}
newtype Flip (~>) b a = Flip {
unFlip :: a ~> b
}
inFlip :: ((a ~> b) -> a' ~~> b') -> Flip ~> b a -> Flip ~~> b' a'
inFlip2 :: ((a ~> b) -> (a' ~~> b') -> a'' ~~~> b'') -> Flip ~> b a -> Flip ~~> b' a' -> Flip ~~~> b'' a''
newtype ArrowAp (~>) f a b = ArrowAp {
unArrowAp :: f a ~> f b
}
newtype App f a = App {
unApp :: f a
}
Documentation
class Cofunctor acc whereSource
Often useful for acceptors (consumers, sinks) of values.
Methods
cofmap :: (a -> b) -> acc b -> acc aSource
show/hide Instances
Arrow ~> => Cofunctor (Flip ~> b)
(Cofunctor g, Functor f) => Cofunctor (O g f)
newtype O g f a Source
Composition of type constructors: unary & unary. Called "g . f" in [1], section 5, but GHC won't parse that, nor will it parse any infix type operators in an export list. Haddock won't parse any type infixes at all. Meant to be used infix when Haddock is up to it or not involved.
Constructors
O
unO :: g (f a)
show/hide Instances
(Functor g, Functor f) => Functor (O g f)
(Applicative g, Applicative f) => Applicative (O g f)
(Cofunctor g, Functor f) => Cofunctor (O g f)
(Applicative (O g f), Monoid a) => Monoid (O g f a)
inO :: (g (f a) -> g' (f' a')) -> O g f a -> O g' f' a'Source
Apply a function within the O constructor.
newtype StaticArrow f (~>) a b Source
Composition of type constructors: unary with binary.
Constructors
Static
unStatic :: f (a ~> b)
show/hide Instances
newtype Flip (~>) b a Source
Flip type arguments
Constructors
Flip
unFlip :: a ~> b
show/hide Instances
Arrow ~> => Cofunctor (Flip ~> b)
inFlip :: ((a ~> b) -> a' ~~> b') -> Flip ~> b a -> Flip ~~> b' a'Source
inFlip2 :: ((a ~> b) -> (a' ~~> b') -> a'' ~~~> b'') -> Flip ~> b a -> Flip ~~> b' a' -> Flip ~~~> b'' a''Source
newtype ArrowAp (~>) f a b Source
Composition of type constructors: binary with unary.
Constructors
ArrowAp
unArrowAp :: f a ~> f b
show/hide Instances
newtype App f a Source
Type application
Constructors
App
unApp :: f a
show/hide Instances
(Applicative f, Monoid m) => Monoid (App f m)
Produced by Haddock version 2.3.0