Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Functor t => Decoration t where
- traverseF :: Functor m => (a -> m b) -> t a -> m (t b)
- distributeF :: Functor m => t (m a) -> m (t a)
- traverseF2 :: Bifunctor m => (a -> m b c) -> t a -> m (t b) (t c)
- distributeF2 :: Bifunctor m => t (m a b) -> m (t a) (t b)
- dmap :: Decoration t => (a -> b) -> t a -> t b
- dget :: Decoration t => t a -> a
- data DecorationT d a = DecorationT {
- decoration :: d
- decorated :: a
Documentation
class Functor t => Decoration t where Source #
A decoration is a functor that is traversable into any functor.
The Functor
superclass is given because of the limitations
of the Haskell class system.
traverseF
actually implies functoriality.
Minimal complete definition: traverseF
or distributeF
.
(traverseF | distributeF), (traverseF2 | distributeF2)
traverseF :: Functor m => (a -> m b) -> t a -> m (t b) Source #
traverseF
is the defining property.
distributeF :: Functor m => t (m a) -> m (t a) Source #
Decorations commute into any functor.
traverseF2 :: Bifunctor m => (a -> m b c) -> t a -> m (t b) (t c) Source #
distributeF2 :: Bifunctor m => t (m a b) -> m (t a) (t b) Source #
Decorations commute into any bifunctor.
Instances
dmap :: Decoration t => (a -> b) -> t a -> t b Source #
Any decoration is traversable with traverse = traverseF
.
Just like any Traversable
is a functor, so is
any decoration, given by just traverseF
, a functor.
dget :: Decoration t => t a -> a Source #
Any decoration is a lens. set
is a special case of dmap
.
The constant functor.
Maybe. Can only be traversed into pointed functors.
Other disjoint sum types, like lists etc.
data DecorationT d a Source #
A proper name for a generic decoration.
DecorationT | |
|