Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utilities for functors.
Synopsis
- (<.>) :: Functor m => (b -> c) -> (a -> m b) -> a -> m c
- for :: Functor m => m a -> (a -> b) -> m b
- 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)
- dmap :: Decoration t => (a -> b) -> t a -> t b
- dget :: Decoration t => t a -> a
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- ($>) :: Functor f => f a -> b -> f b
- (<&>) :: Functor m => m a -> (a -> b) -> m b
Documentation
(<.>) :: Functor m => (b -> c) -> (a -> m b) -> a -> m c infixr 9 Source #
Composition: pure function after functorial (monadic) function.
for :: Functor m => m a -> (a -> b) -> m b Source #
The true pure for
loop.
for
is a misnomer, it should be forA
.
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
.
Nothing
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.
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
.