# comonad

> Comonads for Haskell, the categorical dual of monads

Source: https://talira.ai/catalog/comonad-919k76vr
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / functional programming](https://talira.ai/categories/libraries/functional-programming), [languages / haskell](https://talira.ai/categories/languages/haskell)
- Licence: BSD-2-Clause[^1][^2]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Edward Kmett](https://talira.ai/orgs/edward-kmett.md)

comonad is Edward Kmett's Haskell library of comonads, the categorical dual of monads: the `Comonad` type class with `extract`, `duplicate` and `extend`, defined by either pair of laws.

## Links

- GitHub: https://github.com/ekmett/comonad

## Problems it solves

- use comonads in Haskell for context-dependent computations
- the categorical dual of a monad as a Haskell type class
- define extract and extend for my own Haskell data type with the comonad laws

## Features

- Comonad type class with extract, duplicate and extend
- laws for both ways of defining a comonad
- tested with GHC 8.0 to 9.14

## Trust

Overall: 0.28 out of 1.
Signals: maintenance 0.27, adoption 0.38, momentum 0.05, community 0.55, backing 0.30, extensibility 0.00.

- 81 GitHub stars
- 23 contributors
- backed by Edward Kmett

Warnings:

- last commit 10 months ago

## Alternatives

- [semigroupoids](https://talira.ai/catalog/semigroupoids-tq3kzmpx.md): id-free versions of Haskell's Category, Applicative, Monad and related type classes
- [these](https://talira.ai/catalog/these-y1v47q74.md): Haskell's either-or-both data type, with Align for zipping with padding
- [distributive](https://talira.ai/catalog/distributive-8jmv4fq6.md): Distributive functors for Haskell, the dual of Traversable

## Sources

[^1]: https://github.com/ekmett/comonad/blob/5/LICENSE (checked 28 Nov 2026)
[^2]: https://github.com/ekmett/comonad/blob/5/comonad.cabal (checked 28 Nov 2026)
