comonad-0.6.2.1: Haskell 98 comonads

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>

Data.Distributive

Description

 

Synopsis

Documentation

class Functor g => Distributive g whereSource

This is the categorical dual of Traversable

Minimal definition: mapW or distribute

 mapW = fmap f . duplicate
 distribute = mapW id

To be distributable a container will need to have a way to consistently zip a potentially infinite number of copies of itself. This effectively means that the holes in all values of that type, must have the same cardinality, fixed sized vectors, infinite streams, functions, etc. and no extra information to try to merge together.

Methods

cotraverse :: Comonad w => (w a -> b) -> w (g a) -> g bSource

The dual of Data.Traversable.mapM

distribute :: Comonad w => w (g a) -> g (w a)Source

The dual of Data.Traversable.sequence

fmapDefault :: Distributive g => (a -> b) -> g a -> g bSource

Every Distributive is a Functor. This is a valid default definition.