talira

semigroups

Anything that associates

open sourceBSD-3-Clausefree

semigroups is a Haskell package by Edward Kmett that provided the Semigroup class and non-empty lists before they moved into base. Since base 4.9.0.0 ships Data.Semigroup and Data.List.NonEmpty, the package now mainly offers tools for deriving Semigroup instances with generics, and keeps older code that depends on it building.

Problems it solves

  • derive Semigroup instances for my Haskell types with generics
  • keep a Haskell project that imports the semigroups package building on new GHC versions
  • a Semigroup class for Haskell code that has to support very old GHC versions

Features

  • generic deriving of Semigroup instances
  • compatibility for code written before Semigroup moved into base

Limitations

  • Data.Semigroup and Data.List.NonEmpty have been in base since 4.9.0.0, so this package now mainly adds tools for deriving semigroups with generics1

Alternatives

The same job

These do what semigroups does.

  1. contravariant Contravariant functors for Haskell
  2. semigroupoids id-free versions of Haskell's Category, Applicative, Monad and related type classes
  3. bifunctors Haskell bifunctors, bifoldables and bitraversables
  4. constraints Data types and classes for GHC's ConstraintKinds
  5. comonad Comonads for Haskell, the categorical dual of monads

Compare semigroups with the top 3