typelevel/algebra

Algebra Syntax (was #78 Symbolic Infix Operators)

benhutchison opened this issue · 0 comments

Goals:

  1. Enable use of syntax (infix or postfix operators) over datatypes for which Algebra typeclasses are defined, when using Algera standalone (doesn't require Spire or Algebird)
  2. (Lower priority) Achieve the above without duplicating syntax code between Algebra and Cats.

This issue extends #78 and links some recent gitter discussion. I chose a new issue over extending #78 because of the introduction of cats-kernel (eg #152) means that much discussion from the earlier issue is out of date.

As of Jan 2017:

  • The most fundamental typeclasses definitions sit in cats-kernel. Algebra builds upon them.
  • They have syntax, but it lives in cats-core, and so aren't available to Algebra.
  • Algebra defines another layer of typeclasses, but without syntax.
  • Spire depends-upon- and defines-syntax- for Algebra and Cats-Kernel typeclasses.
  • Algebird depends upon Algebra and Cats Kernel typeclasses, and AFAICT defines some very limited syntax over them.

In my (possibly overly idealistic) view, there are three problems here:

  • If you want to use cats-kernel or Algebra standalone you don't have any syntax/infix operators.
  • Syntax isn't defined along with the typeclasses to which it applies (ie related concerns are spaced wide apart).
  • There's syntax code duplication between Spire, Cats-Core and Algebird.