typelevel / typelevel/cats

Add commonly known operators to algebra type classes

Open
#4,795 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
5.5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
5

Description

Currently, Spire is the only place where commonly known mathematical operators are provided to algebra type classes users.

For the general use case, writing custom algebraic types almost always means to also provide at least the most common operators (+, -, *, /) and often the less common ones (**, @, %, ...) to work with those types.

These operators implementation and behavior should be derived from the implemented type classes for a type, as they are standardized in their behaviour through many programming languages and DSLs.

Finally, I think that the full adoption of the algebra library for developers is hindered by the lack of these overloads, and many DSLs would benefit from the possibility to have also laws checking their correctness.

Let me know what you think!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing Cats' algebra type classes with the operator support provided by Spire, as described in the issue. Determine which common operators should be derived from each type class and how their behavior could be covered by algebraic laws; the work is done when the supported operators and law checks are clearly defined and implemented.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.