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

Stability | experimental |

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

The Yoneda lemma can be realized as the Kan extension along Identity However, having this special instance allows us to define Yoneda f as a monad, comonad, etc. based on whatever properties the base functor has, without limiting ourselves to what Ran f f can manage.

Performance wise, Yoneda may make your monad more efficient at handling a bunch of fmaps, while CoYoneda may do the same for a comonad assuming you require a greater than linear amount of time to fmap over your structure. You can apply each in either role but the asymptotics will probably not be in your favor.

- newtype Yoneda f a = Yoneda {
- runYoneda :: forall b. (a -> b) -> f b

- ranToYoneda :: Ran Identity f :~> Yoneda f
- yonedaToRan :: Yoneda f :~> Ran Identity f
- lowerYoneda :: Yoneda f :~> f
- data CoYoneda f a = forall b . CoYoneda (b -> a) (f b)
- lanToCoYoneda :: Lan Identity f :~> CoYoneda f
- coYonedaToLan :: CoYoneda f :~> Lan Identity f
- liftCoYoneda :: f :~> CoYoneda f

# Documentation

MonadTrans Yoneda | |

ComonadTrans Yoneda | |

HCopointed Yoneda | |

HPointed Yoneda | |

HFunctor Yoneda | |

HComonad Yoneda | |

HMonad Yoneda | |

MonadReader e m => MonadReader e (Yoneda m) | |

MonadState e m => MonadState e (Yoneda m) | |

MonadWriter e m => MonadWriter e (Yoneda m) | |

ComonadContext e m => ComonadContext e (Yoneda m) | |

ComonadReader e m => ComonadReader e (Yoneda m) | |

RunComonadCofree f m => RunComonadCofree f (Yoneda m) | |

ComonadCofree f m => ComonadCofree f (Yoneda m) | |

MonadFree f m => MonadFree f (Yoneda m) | |

RunMonadFree f m => RunMonadFree f (Yoneda m) | |

Monad f => Monad (Yoneda f) | |

Functor (Yoneda f) | |

Applicative f => Applicative (Yoneda f) | |

Copointed f => Copointed (Yoneda f) | |

Pointed f => Pointed (Yoneda f) | |

Comonad f => Comonad (Yoneda f) |

lowerYoneda :: Yoneda f :~> fSource

Left Kan Extensions CoYoneda ~ Lan Identity

forall b . CoYoneda (b -> a) (f b) |

MonadTrans CoYoneda | |

ComonadTrans CoYoneda | |

HCopointed CoYoneda | |

HPointed CoYoneda | |

HFunctor CoYoneda | |

HComonad CoYoneda | |

HMonad CoYoneda | |

MonadReader e m => MonadReader e (CoYoneda m) | |

MonadState e m => MonadState e (CoYoneda m) | |

MonadWriter e m => MonadWriter e (CoYoneda m) | |

ComonadContext e m => ComonadContext e (CoYoneda m) | |

ComonadReader e m => ComonadReader e (CoYoneda m) | |

RunComonadCofree f m => RunComonadCofree f (CoYoneda m) | |

ComonadCofree f m => ComonadCofree f (CoYoneda m) | |

MonadFree f m => MonadFree f (CoYoneda m) | |

RunMonadFree f m => RunMonadFree f (CoYoneda m) | |

Monad m => Monad (CoYoneda m) | |

Functor (CoYoneda f) | |

Applicative f => Applicative (CoYoneda f) | |

Copointed w => Copointed (CoYoneda w) | |

Pointed f => Pointed (CoYoneda f) | |

Comonad w => Comonad (CoYoneda w) |

liftCoYoneda :: f :~> CoYoneda fSource