Module
Data.Distributive
- Package
- purescript-distributive
- Repository
- purescript/purescript-distributive
#Distributive Source
class (Functor f) <= Distributive f where
Categorical dual of Traversable
:
distribute
is the dual ofsequence
- it zips an arbitrary collection of containers.collect
is the dual oftraverse
- it traverses an arbitrary collection of values.
Laws:
distribute = collect identity
distribute <<< distribute = identity
collect f = distribute <<< map f
map f = unwrap <<< collect (Identity <<< f)
map distribute <<< collect f = unwrap <<< collect (Compose <<< f)
Members
distribute :: forall g a. Functor g => g (f a) -> f (g a)
collect :: forall g b a. Functor g => (a -> f b) -> g a -> f (g b)
Instances
#distributeDefault Source
distributeDefault :: forall g f a. Distributive f => Functor g => g (f a) -> f (g a)
A default implementation of distribute
, based on collect
.
#collectDefault Source
collectDefault :: forall g f b a. Distributive f => Functor g => (a -> f b) -> g a -> f (g b)
A default implementation of collect
, based on distribute
.
#cotraverse Source
cotraverse :: forall g f b a. Distributive f => Functor g => (g a -> b) -> g (f a) -> f b
Zip an arbitrary collection of containers and summarize the results
- Modules
- Data.
Distributive