Portability | portable |
---|---|

Stability | provisional |

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

- module Control.Comonad
- module Data.Functor.Apply
- class (Comonad w, FunctorApply w) => ComonadApply w
- liftW2 :: ComonadApply w => (a -> b -> c) -> w a -> w b -> w c
- liftW3 :: ComonadApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d

# FunctorApply

module Control.Comonad

module Data.Functor.Apply

# ComonadApply - strong lax symmetric semimonoidal comonads

class (Comonad w, FunctorApply w) => ComonadApply w Source

A strong lax symmetric semi-monoidal comonad. As such an instance of
`ComonadApply`

is required to satisfy:

extract (a <.> b) = extract a (extract b)

This class is based on ComonadZip from "The Essence of Dataflow Programming"
by Tarmo Uustalu and Varmo Vene, but adapted to fit the programming style of
Control.Applicative. `Applicative`

can be seen as a similar law over and above
FunctorApply that:

pure (a b) = pure a <.> pure b

ComonadApply Identity | |

Monoid m => ComonadApply ((->) m) | |

(Monoid m, Semigroup m) => ComonadApply ((,) m) | Both required because Semigroup is not a superclass of Monoid |

ComonadApply w => ComonadApply (IdentityT w) | |

ComonadApply w => ComonadApply (MaybeApply w) |

liftW2 :: ComonadApply w => (a -> b -> c) -> w a -> w b -> w cSource

Lift a binary function into a comonad with zipping

liftW3 :: ComonadApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w dSource

Lift a ternary function into a comonad with zipping