{"id":15693347,"url":"https://github.com/robrix/semirings-modules","last_synced_at":"2025-08-14T05:08:07.868Z","repository":{"id":66711150,"uuid":"133885462","full_name":"robrix/semirings-modules","owner":"robrix","description":"Semirings, with and without additive/multiplicative identities, and R-modules.","archived":false,"fork":false,"pushed_at":"2018-05-19T20:14:51.000Z","size":274,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-08T04:01:50.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robrix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-18T01:12:18.000Z","updated_at":"2021-07-12T05:18:32.000Z","dependencies_parsed_at":"2023-09-08T08:15:08.374Z","dependency_job_id":null,"html_url":"https://github.com/robrix/semirings-modules","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robrix/semirings-modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2Fsemirings-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2Fsemirings-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2Fsemirings-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2Fsemirings-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robrix","download_url":"https://codeload.github.com/robrix/semirings-modules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robrix%2Fsemirings-modules/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264734259,"owners_count":23655629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T18:43:03.961Z","updated_at":"2025-07-11T05:02:32.426Z","avatar_url":"https://github.com/robrix.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Semirings \u0026 (left) R-modules\n\nThis package provides Haskell typeclasses for semirings (with \u0026 without additive \u0026 multiplicative identities) \u0026 (left) R-modules, plus a variety of useful instances.\n\n## Semirings\n\n`Semiring`s extend the notion of a `Semigroup` with a second binary operator, `\u003e\u003c`. Intuitively, `\u003c\u003e` is to addition as `\u003e\u003c` is to multiplication, and several of the useful properties of `+` and `*` apply:\n\n- `\u003e\u003c` has higher precedence than `\u003c\u003e`: `a \u003e\u003c b \u003c\u003e c` is the same as `(a \u003e\u003c b) \u003c\u003e c`, not `a \u003e\u003c (b \u003c\u003e c)`.\n- `\u003c\u003e` and `\u003e\u003c` are both associative: `a \u003c\u003e b \u003c\u003e c` is the same as `a \u003c\u003e (b \u003c\u003e c)` is the same as `(a \u003c\u003e b) \u003c\u003e c`. Associative operators are trivially parallelizable, making this quite a useful property.\n- Unlike in ordinary semigroups, `\u003c\u003e` is expected to be commutative: `a \u003c\u003e b` is the same as `b \u003c\u003e a`.\n- `\u003e\u003c` distributes over `\u003c\u003e`: `a \u003e\u003c (b \u003c\u003e c)` is the same as `a \u003e\u003c b \u003c\u003e a \u003e\u003c c`.\n\nIn this presentation, `Semiring`s are not required to have additive or multiplicative identities. They _can_ have them, however, by defining `Monoid` and `Unital` instances, respectively. If they do, there are some extra properties:\n\n- `zero` (a synonym for the `Monoid` method `mempty`) is the additive identity: `zero \u003c\u003e a` is the same as `a \u003c\u003e zero` is the same as `a`.\n- `zero` is the multiplicative absorbing element, or annihilator: `zero \u003e\u003c a` is the same as `a \u003e\u003c zero` is the same as `zero`.\n- `one` is the multiplicative identity: `one \u003e\u003c a` is the same as `a \u003e\u003c one` is the same as `a`.\n\nThe relationship between `zero` and `\u003e\u003c` can be useful for expressing values representing the success/failure of some set of operations, where failure of one operation implies failure of the overall set. This can be seen in the `Semiring` instance for `Maybe`, for which a `Nothing` value on either side results in a `Nothing`.\n\n\n## Modules\n\nR-modules over some semiring R generalize the notion of vector spaces over a field. As such, they are well suited to describe collections of or functions producing values in a semiring. A module’s operator, pronounced “scalar multiplication” and written here as `\u003e\u003c\u003c`, generalizes scaling a vector.\n\n----\n\n- [Read the docs][docs].\n\n[docs]: https://antitypical.com/semirings-modules/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobrix%2Fsemirings-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobrix%2Fsemirings-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobrix%2Fsemirings-modules/lists"}