{"id":17252047,"url":"https://github.com/ppetr/semigroups-actions","last_synced_at":"2025-07-29T19:33:42.257Z","repository":{"id":56877400,"uuid":"7211930","full_name":"ppetr/semigroups-actions","owner":"ppetr","description":"Semigroup/monoid actions on sets","archived":false,"fork":false,"pushed_at":"2012-12-20T21:59:58.000Z","size":140,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-17T17:54:26.840Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ppetr.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-17T20:47:45.000Z","updated_at":"2019-12-05T06:32:38.000Z","dependencies_parsed_at":"2022-08-20T23:10:37.115Z","dependency_job_id":null,"html_url":"https://github.com/ppetr/semigroups-actions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fsemigroups-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fsemigroups-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fsemigroups-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ppetr%2Fsemigroups-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ppetr","download_url":"https://codeload.github.com/ppetr/semigroups-actions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228042512,"owners_count":17860432,"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-15T06:52:54.271Z","updated_at":"2024-12-04T04:21:18.936Z","avatar_url":"https://github.com/ppetr.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# semigroups-actions\n\nIn mathematics, an action of a semigroup on a set is an operation that\nassociates each element of the semigroup is with a transformation on the set.\nSee Wikipedia articles on\n[semigroup action](http://en.wikipedia.org/wiki/Semigroup_action) and\n[group action](http://en.wikipedia.org/wiki/Group_action).\n\nThis package complements and depends on [semigroups](http://hackage.haskell.org/package/semigroups).\n\nIt requires `MultiParamTypeClasses` extension.\n\n## Examples\n\nSimilarly to semigroups, semigroup (or monoid) actions arise almost everywhere (if you look for them).\n\n### Natural numbers acting on monoids\n\nThe multiplication monoid of natural numbers acts on any other monoid:\n\n```haskell\nn `act` x = x \u003c\u003e ... \u003c\u003e x -- x appears n-times\n```\n\nSo ``0 `act` x == mempty``, ``3 `act` x == x \u003c\u003e x \u003c\u003e x`` etc.\nBecause `\u003c\u003e` is associative, such an action can be computed very efficiently\nwith only _O(log n)_ operations using\n[binary multiplication](https://en.wikipedia.org/wiki/Peasant_multiplication).\n\nThis is expressed by `newtype Repeat` and instance\n\n```haskell\ninstance (Monoid w, Whole n) =\u003e SemigroupAct (Product n) (Repeat w) where\n```\n\nMany different concepts can be expressed using such an action, including\n\n- repeating a list `n`-times (`replicate`),\n- compose a function `f` `n`-times, commonly denoted as _fⁿ_ in mathematics:\n\n    ```haskell\n    (Repeat (Endo fⁿ)) = (Product n) `act` (Repeat (Endo f))\n    ```\n\n## Self-application\n\nAny semigroup (or monoid) can be viewed as acting on itself. In this case, `act` simply becomes `\u003c\u003e`. This is expressed by the `SelfAct` type:\n\n```haskell\nnewtype SelfAct a = SelfAct a\ninstance Semigroup g =\u003e Semigroup (SelfAct g) where\n    (SelfAct x) \u003c\u003e (SelfAct y) = SelfAct $ x \u003c\u003e y\n```\n\n## Matrices acting on vectors\n\nMatrices with multiplication can be viewed as a group acting on vectors.\n\n# Copyright\n\nCopyright 2012, Petr Pudlák\n\nContact: [petr.pudlak.name](http://petr.pudlak.name/) or through github.\n\nLicense: BSD3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppetr%2Fsemigroups-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fppetr%2Fsemigroups-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fppetr%2Fsemigroups-actions/lists"}