Copyright | (C) 2011-2015 Edward Kmett |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Stability | provisional |

Portability | portable |

Safe Haskell | Safe |

Language | Haskell98 |

- class Functor w => Extend w where
- duplicated :: w a -> w (w a)
- extended :: (w a -> b) -> w a -> w b

# Extendable Functors

There are two ways to define an `Extend`

instance:

I. Provide definitions for `extended`

satisfying this law:

extended f . extended g = extended (f . extended g)

II. Alternately, you may choose to provide definitions for `duplicated`

satisfying this law:

duplicated . duplicated = fmap duplicated . duplicated

You may of course, choose to define both `duplicated`

*and* `extended`

.
In that case you must also satisfy these laws:

extended f = fmap f . duplicated duplicated = extended id

These are the default definitions of `extended`

and `duplicated`

.

class Functor w => Extend w where Source

duplicated :: w a -> w (w a) Source

duplicated = extended id fmap (fmap f) . duplicated = duplicated . fmap f

extended :: (w a -> b) -> w a -> w b Source

extended f = fmap f . duplicated

Extend [] Source | |

Extend Identity Source | |

Extend Maybe Source | |

Extend Tree Source | |

Extend Seq Source | |

Extend NonEmpty Source | |

Semigroup m => Extend ((->) m) Source | |

Extend (Either a) Source | |

Extend ((,) e) Source | |

Extend w => Extend (IdentityT w) Source | |

Extend f => Extend (MaybeApply f) Source | |

(Extend f, Extend g) => Extend (Coproduct f g) Source | |

(Extend w, Semigroup m) => Extend (TracedT m w) Source | |

Extend w => Extend (StoreT s w) Source | |

Extend w => Extend (EnvT e w) Source | |

(Extend f, Semigroup a) => Extend (Static f a) Source |