{"id":18841993,"url":"https://github.com/neko-kai/fp-dictionary","last_synced_at":"2026-01-26T00:40:53.396Z","repository":{"id":69713962,"uuid":"134867258","full_name":"neko-kai/fp-dictionary","owner":"neko-kai","description":"FP category theory jargon explained on a single A4 page","archived":false,"fork":false,"pushed_at":"2018-07-30T12:34:32.000Z","size":98,"stargazers_count":63,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-22T22:13:14.009Z","etag":null,"topics":["category-theory","fp","functional-programming"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neko-kai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-05-25T14:31:41.000Z","updated_at":"2025-05-17T22:46:53.000Z","dependencies_parsed_at":"2023-05-23T18:00:26.745Z","dependency_job_id":null,"html_url":"https://github.com/neko-kai/fp-dictionary","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/neko-kai/fp-dictionary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neko-kai%2Ffp-dictionary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neko-kai%2Ffp-dictionary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neko-kai%2Ffp-dictionary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neko-kai%2Ffp-dictionary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neko-kai","download_url":"https://codeload.github.com/neko-kai/fp-dictionary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neko-kai%2Ffp-dictionary/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28762996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T00:37:26.264Z","status":"ssl_error","status_checked_at":"2026-01-26T00:37:25.959Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["category-theory","fp","functional-programming"],"created_at":"2024-11-08T02:53:18.604Z","updated_at":"2026-01-26T00:40:53.374Z","avatar_url":"https://github.com/neko-kai.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Programming subset of Category Theory Cheatsheet\n------\n\n**functor**: given `Producer[A]` with **output** `A`, allows post-processing values with `A =\u003e B` to get `Producer[B]`\u003cbr/\u003e\n**contravariant functor**: given `Consumer[A]` with **input** `A`, allows pre-processing values with `B =\u003e A` to get `Consumer[B]`\u003cbr/\u003e\n**profunctor**: given `Pipe[A, B]` with **input** `A` and **output** `B`, allow pre-processing **input** values with `C =\u003e A`, and post-processing **output** values with `B =\u003e D` to get `Pipe[C, D]`\u003cbr/\u003e\n**applicative**: gives `map2`, `map3` **...** `mapN`. where `map2: (F[A], F[B]), (A, B =\u003e C) =\u003e F[C]` **...** `mapN: (F[A] .. F[N]), (A .. N =\u003e Z) =\u003e F[Z]`\u003cbr/\u003e\n**monad**: gives `flatten: F[F[A]] =\u003e F[A]`. If you `map`, then `flatten`, you can chain operations: `flatten(maybeReadFile.map(maybeParseAsInteger)) = Maybe[Integer]`\u003cbr/\u003e\n**monoid**: gives `plus` and `zero`\u003cbr/\u003e\n**alternative**: gives `orElse: F[A], F[A] =\u003e F[A]`\u003cbr/\u003e\n**category**: function-like entity with `compose` and `identity`\u003cbr/\u003e\n**arrow**: category with `fork`/`join`\u003cbr/\u003e\n**comonad**: given `Cursor[A]` with **output** `A`, allows post-processing values under nested cursors with `Cursor[A] =\u003e B` to get `Cursor[B]`. i.e.\n  ```scala\n  List(1,1,2).extend(sumOfList) = List(4, 3, 2)\n  // list's cursor = head + tail\n  // sumOfList(List(1,1,2)) = 4\n  // sumOfList(List(1,2))   = 3\n  // sumOfList(List(2))     = 2 \n  sumOfList: List[Int] =\u003e Int\n\n  AST(nodes...).extend(typecheckNodeAndChildren) = AST(typednodes...) // the type of each node depends on the types of child nodes\n  // ast's cursor = node + children\n  typecheckNodeAndChildren: AST[Node] =\u003e TypedNode\n  ```\n\n**algebra**: interface + laws\n\n**free X**: data that only represents the operations of an algebraic structure **X**, but doesn't do anything.\u003cbr/\u003e\n**free**: *colloq.* free monad\u003cbr/\u003e\n**cofree**: *colloq.* free comonad\u003cbr/\u003e\n**free monoid**: *colloq.* list\u003cbr/\u003e\n**yoneda**: *colloq.* free functor built from a functor\u003cbr/\u003e\n**coyoneda**: *colloq.* free functor convertible into a functor\u003cbr/\u003e\n**codensity**: *colloq.* continuations-based free monad\u003cbr/\u003e\n**day convolution**: representation of `map2`\u003cbr/\u003e\n\n**tensor**: binder of multiple arguments. default tensor is tuple: `(A, B) =\u003e C`\n\n**on monoids**: `applicative`, `alternative`, `monad` and `category` are all specialized **monoids** with different tensors\u003cbr/\u003e\n\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;**intuition**:\n  * **monoid** tensor is `tuple`\n    ```scala\n     plus: (A, A) =\u003e A\n     // if i can combine tuples of A then i can combine a tupleN of A!\n     // i can squish any List[A] into one A!\n    ```\n  * **monad** tensor is `compose`. `compose F G = F[G[_]]`\n    ```scala\n     plus: F compose F =\u003e F  // flatten: F[F[_]] =\u003e F[_]\n    // if i can combine composes of F then i can combine a composeN of F!\n    // i can flatten any F[F[F[F[F[F[F... into one F!\n    ```\n\n  * **alternative** tensor is `higherTuple`. `higherTuple F G = (F[_], G[_])`\n    ```scala\n     plus: F higherTuple F =\u003e F  // orElse: F[_], F[_] =\u003e F[_]\n     // if i can combine higherTuples of F then i can combine a higherTupleN of F!\n     // i can choose from any paths (F orElse F orElse F orElse...) one successful F!\n    ```\n\n  * **applicative** tensor is `map2` (day convolution). `map2 F G = (F[A], G[B], (A, B) =\u003e C)`\n    ```scala\n     plus: F map2 F =\u003e F  // map2: (F[A], F[B], (A, B) =\u003e C) =\u003e F[C]\n     // if i can combine map2s of F then i can combine a mapN of F!\n     // i can zip any (F[A], F[B] ... F[N]) with an (A ... N =\u003e Z) to get one F[Z]!\n    ```\n\n**f-algebra**: `F[A] =\u003e A`, fold-like function\u003cbr/\u003e\n**f-coalgebra**: `A =\u003e F[A]`, unfold-like function\u003cbr/\u003e\n**recursion**: `fold`-like function calling itself with some context while `reducing` a context.\u003cbr/\u003e\n**corecursion**: `unfold`-like function calling itself with some context while `building up` a context\u003cbr/\u003e\n\n**cata**: `fold`\u003cbr/\u003e\n**ana**: `unfold`\u003cbr/\u003e\n**hylo**: `unfold` then `fold`\u003cbr/\u003e\n**meta**: `fold` then `unfold`\u003cbr/\u003e\n**prepro**: `map` then `fold`\u003cbr/\u003e\n**postpro**: `unfold` then `map`\u003cbr/\u003e\n**para**: `fold` with cursor\u003cbr/\u003e\n**zygohistoprepro**: dumb meme\u003cbr/\u003e\n**elgot algebra**: `unfold` then `fold` where `unfold` part can short-circuit\u003cbr/\u003e\n**elgot coalgebra**: `unfold` then `fold` with cursor, where cursor tail is mapped by elgot coalgebra\u003cbr/\u003e\n\n**benefits of FP**:\u003cbr/\u003e\nMost programming tasks are reduced to variants of `plus`.\n\n**or even**:\u003cbr/\u003e\nMost programming tasks can be summarized as \"do a bunch of stuff\".\u003cbr/\u003e\nFP separates the `bunch` and the `do` parts.\u003cbr/\u003e\nUse any of the available `plus`es to bunch your program together, then write an interpreter for it and just `do` it.\u003cbr/\u003e\nAnd since we can have multiple interpreters, we also gain the ability to \"do a bunch of different stuff\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneko-kai%2Ffp-dictionary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneko-kai%2Ffp-dictionary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneko-kai%2Ffp-dictionary/lists"}