{"id":27310695,"url":"https://github.com/atticuskuhn/functiona_typescript_lib","last_synced_at":"2025-10-07T00:10:53.011Z","repository":{"id":114949734,"uuid":"412119256","full_name":"AtticusKuhn/functiona_typescript_lib","owner":"AtticusKuhn","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-06T03:26:27.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T05:58:38.645Z","etag":null,"topics":["functional-programming","haskell","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/AtticusKuhn.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-30T15:27:01.000Z","updated_at":"2022-06-16T04:17:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"78f2c9a1-edb4-481c-bb65-ba15c443e781","html_url":"https://github.com/AtticusKuhn/functiona_typescript_lib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AtticusKuhn/functiona_typescript_lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtticusKuhn%2Ffunctiona_typescript_lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtticusKuhn%2Ffunctiona_typescript_lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtticusKuhn%2Ffunctiona_typescript_lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtticusKuhn%2Ffunctiona_typescript_lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AtticusKuhn","download_url":"https://codeload.github.com/AtticusKuhn/functiona_typescript_lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AtticusKuhn%2Ffunctiona_typescript_lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278699342,"owners_count":26030516,"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","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["functional-programming","haskell","typescript"],"created_at":"2025-04-12T05:58:37.923Z","updated_at":"2025-10-07T00:10:52.998Z","avatar_url":"https://github.com/AtticusKuhn.png","language":"TypeScript","readme":"# About\nThis is a typescript library for functional programming, inspired by haskell.\n# Example\nHere is an example of how to use it\n```ts\n// example 1:  make a function to test if 2 objects have the same \"name\" attribute\nconst sameName = on\u003c{ name: string }, string, boolean\u003e().a(eq\u003cstring\u003e()).a(get(\"name\"))\nconst test = sameName.a({ name: \"alice\" }).a({ name: \"alice\" })\nconsole.log(\"do the 2 objects have the same name?\", test) // true\n\n//example 2: increase a number then turn it to a string\nconst incrementThenString = inc.c(show)\nconsole.log(\"incrementThenString(2) = \", incrementThenString(2)) // \"3\"\n\n//example 3: increase every element of a list\nconst incrementList = map\u003cnumber, number\u003e().a(inc)\nconst list = incrementList.a(seq.a(10))\nconsole.log(\"mapped sequence is\", list) // [ 1, 2, 3, 4, 5,6, 7, 8, 9, 10 ]\n\n// example 4: how many even numbers are less than 100?\nconst counter = count\u003cnumber\u003e().a(isEven).bc(seq)\nconsole.log(\"how many even numbers are less than 100?\", counter(100)) // 50\n\n// example 6: add 2 lists\nconst addLists = zipWith\u003cnumber, number, number\u003e().a(add)\nconsole.log(\"adding 2 lists\", addLists.a(range.a(10).a(20)).a(seq(5))) // [ 10, 12, 14, 16, 18 ]\n\n// example 7: sum a list\nconst sumList = seq.c(foldl\u003cnumber, number\u003e().a(add).a(0))\nconsole.log(\"sum of all numbers from 0 to 99 = \", sumList.a(100)) // 4950\n\n// example 8: get number of occuerances in a list\nconst numList = [1, 2, 3, 5, 1, 2, 3, 4, 2, 1, 2, 3, 3, 2, 1, 3, 4, 2]\nconst count2s = count\u003cnumber\u003e().a(eq\u003cnumber\u003e().a(2))\nconsole.log(\"number of 2s in the list is\", count2s(numList))\n```\n# Purpose\nThe purpose of the library is to have functional design that uses object-oriented and\nclass-based syntax in order to introduce object-oriented programmers to try functional\nprogramming.\n# Methods\nThe `func` class is the central class of this library, and it has some methods\n- a: apply, like the `$` operator in haskell\n- c: compose, like the `.` operator in haskell\n- bc: backwards compose, like compose but with the order reversed. \n# Functions\nThis library contains several useful functions, here is the documentation:\n- eq: are 2 things equal\n- inc: increment a number\n- add: add 2 numbers\n- not: inver a boolean\n- neq: are 2 things not equal\n- on: same as `on` in haskell\n- get: get a key from an object\n- map: same as `map` in haskell\n- filter: same as `filter` in haskell \n- count: same as `count` in haskell\n-  zipWith: same as `zipWith` in haskell\n- foldl: same as `foldl` in haskell\n- foldr: same as `foldr` in haskell\n- isEven: same as `isEven` in haskell\n- show: same as `show` in haskell\n- seq: generate a list of numbers ending at numebr\n- range: generate a list of numbers between range \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatticuskuhn%2Ffunctiona_typescript_lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatticuskuhn%2Ffunctiona_typescript_lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatticuskuhn%2Ffunctiona_typescript_lib/lists"}