distributive-0.5.1: Distributive functors -- Dual to Traversable

Copyright(C) 2011-2016 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Data.Distributive.Generic

Description

 

Synopsis

Documentation

class GDistributive g where Source #

Minimal complete definition

gdistribute

Methods

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

Instances

GDistributive U1 Source # 

Methods

gdistribute :: Functor f => f (U1 a) -> U1 (f a) Source #

GDistributive Par1 Source # 

Methods

gdistribute :: Functor f => f (Par1 a) -> Par1 (f a) Source #

GDistributive f => GDistributive (Rec1 f) Source # 

Methods

gdistribute :: Functor f => f (Rec1 f a) -> Rec1 f (f a) Source #

(GDistributive a, GDistributive b) => GDistributive ((:*:) a b) Source # 

Methods

gdistribute :: Functor f => f ((a :*: b) a) -> (a :*: b) (f a) Source #

(Functor a, GDistributive a, GDistributive b) => GDistributive ((:.:) a b) Source # 

Methods

gdistribute :: Functor f => f ((a :.: b) a) -> (a :.: b) (f a) Source #

GDistributive f => GDistributive (M1 i c f) Source # 

Methods

gdistribute :: Functor f => f (M1 i c f a) -> M1 i c f (f a) Source #

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