edmundnoble states semigroupal is an abbreviation
Semigroupal is an abbreviation for semigroupal functor which is to a monoidal functor as a semigroup is to a monoid
or as hrhino puts it
"semigroupal functor" - "functor" = "semigroupal"
cats.Semigroupal
points towards the concept of semigroupal functor which is defined something like
trait SemigroupalFunctor[F[_]] {
def product[A, B](fa: F[A], fb: F[B]): F[(A, B)]
def map[A, B](fa: F[A])(f: A => B): F[B]
}
semigroupal functor is like monoidal functor without the unit
trait MonoidalFunctor[F[_]] {
def unit: F[Unit]
def product[A, B](fa: F[A], fb: F[B]): F[(A, B)]
def map[A, B](fa: F[A])(f: A => B): F[B]
}
Now cats.Semigroupal
is a generalisation of semigroupal functor where only the product
is extracted into its own type class
trait Semigroupal[F[_]] {
def product[A, B](fa: F[A], fb: F[B]): F[(A, B)]
}
hence the naming stops at just Semigroupal
instead of SemigroupalFunctor
. The full semigroupal functor can be found in cats in the form of Apply
which combines Semigroupal
and Functor
as shown in the following simplified view
trait Semigroupal[F[_]] {
def product[A, B](fa: F[A], fb: F[B]): F[(A, B)]
}
trait Functor[F[_]] {
def map[A, B](fa: F[A])(f: A => B): F[B]
}
trait Apply[F[_]] extends Semigroupal[F] with Functor[F] {
def ap[A, B](ff: F[A => B])(fa: F[A]): F[B]
}
Semigroupal used to be called Cartesian until rename Cartesian to Semigroupal #1961