Copyright | (C) 2011-2016 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | provisional |
Portability | portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Synopsis
- class GDistributive g where
- genericCollect :: (Functor f, Generic1 g, GDistributive (Rep1 g)) => (a -> g b) -> f a -> g (f b)
- genericDistribute :: (Functor f, Generic1 g, GDistributive (Rep1 g)) => f (g a) -> g (f a)
Documentation
class GDistributive g where Source #
Instances
GDistributive Par1 Source # | |
GDistributive (U1 :: Type -> Type) Source # | |
Distributive f => GDistributive (Rec1 f) Source # | |
(GDistributive a, GDistributive b) => GDistributive (a :*: b) Source # | |
GDistributive f => GDistributive (M1 i c f) Source # | |
(Distributive a, GDistributive b) => GDistributive (a :.: b) Source # | |
genericCollect :: (Functor f, Generic1 g, GDistributive (Rep1 g)) => (a -> g b) -> f a -> g (f b) Source #
collect
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 collect = genericCollect
genericDistribute :: (Functor f, Generic1 g, GDistributive (Rep1 g)) => f (g a) -> g (f a) Source #
distribute
derived from a Generic1
type
It's often more efficient to use genericCollect
instead.