SimpleH-1.2: A light, clean and powerful Haskell utility library

Safe HaskellNone

Algebra.Functor

Description

A module for functors

Synopsis

Documentation

class Functor f whereSource

Methods

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

class Cofunctor f whereSource

Methods

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

Instances

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

class Bifunctor p whereSource

Methods

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

Instances

Bifunctor (->) 

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) 

newtype (f :.: g) a Source

The Composition functor

Constructors

Compose 

Fields

getCompose :: f (g a)
 

Instances

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 g, Monad f, Monad g) => Monad (:.: f g) 
(Applicative f, Applicative g) => Applicative (:.: f g) 
(Functor f, Functor g) => Functor (:.: f g) 
(Functor f, Cofunctor g) => Cofunctor (:.: f g) 
(Foldable f, Foldable g) => Foldable (:.: f g) 
(Traversable f, Traversable g) => Traversable (:.: 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) 
(Applicative f, Applicative g) => Applicative (:**: f g) 
(Functor f, Functor g) => Functor (:**: f g) 
(Foldable f, Foldable g) => Foldable (:**: f g) 
(Traversable f, Traversable g) => Traversable (:**: f g) 

newtype (f :++: g) a Source

Constructors

Sum 

Fields

getSum :: f a :+: g a
 

Instances

(Functor f, Functor g) => Functor (:++: f g) 
(Foldable f, Foldable g) => Foldable (:++: f g) 
(Traversable f, Traversable g) => Traversable (:++: f g) 

(<$>) :: Functor f => (a -> b) -> f a -> f bSource

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

(<$) :: Functor f => b -> f a -> f bSource

(<&>) :: Functor f => f a -> (a -> b) -> f bSource

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 cSource

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