| Copyright | Conor McBride and Ross Paterson 2005, (C) 2015 KONISHI Yohsuke | 
|---|---|
| License | BSD-style (see the LICENSE file in the distribution) | 
| Maintainer | ocean0yohsuke@gmail.com | 
| Stability | experimental | 
| Portability | --- | 
| Safe Haskell | Safe | 
| Language | Haskell2010 | 
DeepControl.Commutative
Description
This module is made of Traversable((->) r) as a data constructor someday.
- class Functor c => Commutative c where- commute :: Applicative f => c (f a) -> f (c a)
 
- cmap :: (Applicative f, Commutative c) => (a -> f b) -> c a -> f (c b)
- cfor :: (Applicative f, Commutative c) => c a -> (a -> f b) -> f (c b)
- fmapDefault :: Commutative t => (a -> b) -> t a -> t b
- foldMapDefault :: (Commutative t, Monoid m) => (a -> m) -> t a -> m
The Commutative class
class Functor c => Commutative c where Source
Methods
commute :: Applicative f => c (f a) -> f (c a) Source
This method is the same for sequenceA
Instances
| Commutative [] Source | |
| Commutative Maybe Source | |
| Commutative (Either a) Source | |
| Commutative ((,) a) Source | |
| Commutative (Const m) Source | 
Utility functions
cmap :: (Applicative f, Commutative c) => (a -> f b) -> c a -> f (c b) Source
Do fmap f then commute, the same for traverse
cfor :: (Applicative f, Commutative c) => c a -> (a -> f b) -> f (c b) Source
General definitions for superclass methods
fmapDefault :: Commutative t => (a -> b) -> t a -> t b Source
This function may be used as a value for fmap in a Functor
   instance, provided that commute is defined. (Using
   fmapDefault with a Commutative instance will result in infinite recursion.)
foldMapDefault :: (Commutative t, Monoid m) => (a -> m) -> t a -> m Source