Skip to content

feat: add Semigroup algebraic structure - #593

Open
ghoullier wants to merge 1 commit into
mainfrom
ghoullier-feat-semigroup
Open

feat: add Semigroup algebraic structure#593
ghoullier wants to merge 1 commit into
mainfrom
ghoullier-feat-semigroup

Conversation

@ghoullier

Copy link
Copy Markdown
Owner

Summary

Add the Semigroup algebraic structure to the FP library.

A Semigroup represents types that have an associative binary operation (concat). For any values a, b, c:

a.concat(b).concat(c) === a.concat(b.concat(c))

What's included

  • Semigroup<T> interface with a concat(other: T): T method
  • Sum — combines numbers by addition
  • Product — combines numbers by multiplication
  • Str — combines strings by concatenation
  • Full test suite verifying behavior and the associativity law
  • Barrel export from src/index.ts

@ghoullier
ghoullier force-pushed the ghoullier-feat-semigroup branch 5 times, most recently from 1aa6c9b to 47d0c98 Compare July 1, 2026 17:09
@ghoullier
ghoullier force-pushed the ghoullier-feat-semigroup branch from 47d0c98 to 366cccb Compare July 8, 2026 20:27
Add Semigroup interface and concrete implementations (Sum, Product, Str)
with full test coverage including associativity law verification.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@ghoullier
ghoullier force-pushed the ghoullier-feat-semigroup branch from 366cccb to f4db211 Compare July 10, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant