definitive-base-2.3: The base modules of the Definitive framework.

Safe HaskellNone
LanguageHaskell2010

Algebra.Functor

Description

A module for functors

Synopsis

Documentation

class Functor f where Source

Methods

map :: (a -> b) -> f a -> f b Source

class Cofunctor f where Source

Methods

comap :: (a -> b) -> f b -> f a Source

Instances

(Functor f, Cofunctor g) => Cofunctor ((:.:) f g) 
Cofunctor (Flip (->) a) 

class Bifunctor p where Source

Minimal complete definition

Nothing

Methods

dimap :: (c -> a) -> (b -> d) -> p a b -> p c d Source

Instances

Bifunctor (->) 

class Commutative f where Source

Methods

commute :: f a b -> f b a Source

class Functor t => Contravariant t where Source

Methods

collect :: Functor f => f (t a) -> t (f a) Source

newtype Id a Source

The Identity Functor

Constructors

Id 

Fields

getId :: a
 

newtype Const a b Source

The Constant Functor

Constructors

Const 

Fields

getConst :: a
 

Instances

Isomorphic a b (Const a c) (Const b c) 
Monoid a => Unit (Const a) 
Monoid a => Applicative (Const a) 
Functor (Const a) 
Monoid a => Monoid (Const a b) 
Semigroup a => Semigroup (Const a b) 

newtype Flip f a b Source

A motherflippin' functor

Constructors

Flip 

Fields

unFlip :: f b a
 

Instances

Cofunctor (Flip (->) a) 
Isomorphic (f a b) (f c d) (Flip f b a) (Flip f d c) 
Monoid (f b a) => Monoid (Flip f a b) 
Semigroup (f b a) => Semigroup (Flip f a b) 
(Ord b, Ord a) => DataMap (Flip Bimap b a) b a 

newtype (f :.: g) a Source

The Composition functor

Constructors

Compose 

Fields

getCompose :: f (g a)
 

Instances

(Traversable g, Monad g, MonadWriter w f) => MonadWriter w ((:.:) f g) 
(Traversable g, Monad g, MonadReader r f) => MonadReader r ((:.:) f g) 
(Traversable g, Monad g, MonadState s f) => MonadState s ((:.:) f g) 
Monad m => ConcreteMonad ((:.:) m) 
Monad m => MonadTrans ((:.:) m) 
Isomorphic (f (g a)) (f' (g' b)) ((:.:) f g a) ((:.:) f' g' b) 
(Unit f, Unit g) => Unit ((:.:) f g) 
(MonadFix f, Traversable g, Monad g) => MonadFix ((:.:) f g) 
(Traversable f, Traversable g) => Traversable ((:.:) f g) 
(Foldable f, Foldable g) => Foldable ((:.:) f g) 
(Traversable g, Monad f, Monad g) => Monad ((:.:) f g) 
(Applicative f, Applicative g) => Applicative ((:.:) f g) 
(Functor f, Functor g) => Functor ((:.:) f g) 
(Contravariant f, Contravariant g) => Contravariant ((:.:) f g) 
(Functor f, Cofunctor g) => Cofunctor ((:.:) f g) 
(Applicative f, Monoid (g a)) => Monoid ((:.:) f g a) 
(Applicative f, Semigroup (g a)) => Semigroup ((:.:) f g a) 

data (f :**: g) a Source

Constructors

(f a) :**: (g a) 

Instances

(Unit f, Unit g) => Unit ((:**:) f g) 
(Traversable f, Traversable g) => Traversable ((:**:) f g) 
(Foldable f, Foldable g) => Foldable ((:**:) f g) 
(Applicative f, Applicative g) => Applicative ((:**:) f g) 
(Functor f, Functor g) => Functor ((:**:) f g) 

newtype (f :++: g) a Source

Constructors

Sum 

Fields

getSum :: f a :+: g a
 

Instances

newtype Increasing k a Source

A functor for ordered lists

Constructors

Increasing ((OrdList :.: Assoc k) a) 

emerge :: (Functor f, Unit g) => (f :.: g) a -> (f :.: g) (g a) Source

flip :: (Contravariant c, Functor f) => f (c a) -> c (f a) Source

project :: (Contravariant c, Functor f) => (a -> c b) -> f a -> c (f b) Source

The Contravariant version of traverse

factor :: (Contravariant c, Unit c, Bifunctor f, Functor (f a)) => f (c a) (c b) -> c (f a b) Source

(<$>) :: Functor f => (a -> b) -> f a -> f b infixr 2 Source

(|||) :: (Choice k, Functor (k a), Functor (k b)) => k a c -> k b d -> k (a :+: b) (c :+: d) infixr 1 Source

(<$) :: Functor f => b -> f a -> f b infixr 2 Source

(<&>) :: Functor f => f a -> (a -> b) -> f b infixl 1 Source

void :: Functor f => f a -> f () Source

left :: (Choice k, Functor (k a), Functor (k c)) => k a b -> k (a :+: c) (b :+: c) Source

right :: (Choice k, Functor (k a), Functor (k c)) => k a b -> k (c :+: a) (c :+: b) Source

promap :: Cofunctor (Flip f c) => (a -> b) -> f b c -> f a c Source

map2 :: (Functor f, Functor f') => (a -> b) -> f (f' a) -> f (f' b) Source

map3 :: (Functor f, Functor f', Functor f'') => (a -> b) -> f (f' (f'' a)) -> f (f' (f'' b)) Source