talira

Comonads for Haskell, the categorical dual of monads

open sourceBSD-2-Clausefree

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.

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

Alternatives

The same job

These do what comonad does.

  1. semigroupoids id-free versions of Haskell's Category, Applicative, Monad and related type classes
  2. these Haskell's either-or-both data type, with Align for zipping with padding
  3. distributive Distributive functors for Haskell, the dual of Traversable

Compare comonad with the top 3