distributive-0.4.4: Distributive functors -- Dual to Traversable

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Data.Distributive.Generic

Description

 

Synopsis

Documentation

class GDistributive g whereSource

Methods

gdistribute :: Functor f => f (g a) -> g (f a)Source

Instances

GDistributive U1 
GDistributive Par1 
GDistributive f => GDistributive (Rec1 f) 
(GDistributive a, GDistributive b) => GDistributive (:*: a b) 
(Functor a, Functor b, GDistributive a, GDistributive b) => GDistributive (:.: a b) 
GDistributive f => GDistributive (M1 i c f) 

genericDistribute :: (Functor f, Generic1 g, GDistributive (Rep1 g)) => f (g a) -> g (f a)Source

distribute derived from a Generic1 type

This can be used to easily produce a Distributive instance for a type with a Generic1 instance,

 data V2 a = V2 a a deriving (Show, Functor, Generic1)
 instance Distributive V2' where distribute = genericDistribute