{"id":18057401,"url":"https://github.com/1computer1/arrow-tag","last_synced_at":"2025-04-05T10:22:53.543Z","repository":{"id":110792598,"uuid":"186252061","full_name":"1Computer1/arrow-tag","owner":"1Computer1","description":"Function arrows and a template tag for arrows and function combinators","archived":false,"fork":false,"pushed_at":"2019-05-13T21:35:59.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T21:14:19.664Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1Computer1.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-12T12:28:59.000Z","updated_at":"2021-06-15T17:47:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"1c8e1a98-1957-4b65-be30-ab7b5ff72d14","html_url":"https://github.com/1Computer1/arrow-tag","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/1Computer1%2Farrow-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Computer1%2Farrow-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Computer1%2Farrow-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1Computer1%2Farrow-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1Computer1","download_url":"https://codeload.github.com/1Computer1/arrow-tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247320253,"owners_count":20919743,"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-31T02:07:35.908Z","updated_at":"2025-04-05T10:22:53.508Z","avatar_url":"https://github.com/1Computer1.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# arrow-tag\n\nFunction arrows and a template tag for arrows and function combinators.  \n\nThe design philosophy of this library (other than being a proof-of-concept) is to give programmers a way to\ncompose their functions without having to resort to a messy nesting of combinators nor having to mess with\ntheir functions through a middleman e.g. currying.  \n\nThis library is based mostly upon Haskell's `Control.Arrow` and `Data.Function`,\nand functional programming in general, with liberties taken to ease its use in JavaScript.  \n\n## Example\n\nWith arrow-tag language and template tag:  \n\n```js\nconst { arrow, operators: { add, pow, rsect } } = require('arrowtag');\n\n// Read this as \"add on (** 2) then square root\".\n// That is, `(x, y) =\u003e Math.sqrt(x ** 2 + y ** 2)`.\nconst pythag = arrow`${add} \u003c^\u003e ${rsect(pow, 2)} \u003e\u003e\u003e ${Math.sqrt}`;\n\npythag(3, 4); // -\u003e 5\n```\n\nEquivalent function calls:  \n\n```js\nconst { on, composeLR, operators: { add, pow, rsect } } = require('arrowtag');\n\nconst pythag = composeLR(on(add, rsect(pow, 2)), Math.sqrt);\n\npythag(3, 4); // -\u003e 5\n```\n\n## Combinators\n\nAll the combinators are available as normal functions or as a part of the arrow-tag language.  \nMultiple inputs are the same as normal JavaScript, i.e. we treat function arguments as a single tuple.  \nMultiple outputs are simulated using arrays with an `isTuple` symbol set to true.  \n\nUnary combinators have a corresponding prefix operator.  \nBinary operators also have an associativity and precedence; higher precedence means tighter binding.  \nYou can view the full list of combinators and their behavior in `src/combinators.js`.  \nNotation is fairly obvious; `(...a)` refers to the entire spread of types passed into the function.  \n\nAlso included are aliases for JavaScript operators, e.g. `add` for `(x, y) =\u003e x + y`.  \nYou can also create operator sections as in `lsect(1, add)` for `x =\u003e 1 + x`.  \n\n## More Examples\n\n```js\nconst f = arrow`${rsect(mul, 2)} \u003e\u003e\u003e ${String} \u003e\u003e\u003e ${rsect(add, ' wow!')}`;\nf(10); // -\u003e \"20, wow!\"\n```\n\n```js\nconst f = arrow`${rsect(pow, 2)} \u0026\u0026\u0026 ${Math.sqrt}`;\nf(4); // -\u003e [16, 2, [Symbol(isTuple)]: true]\n```\n\n```js\nconst f = arrow`${sub} \u003c^\u003e ${x =\u003e x.age}`;\n[{ age: 10 }, { age: 3 }].sort(f); // -\u003e [{ age: 3 }, { age: 10 }]\n```\n\n```js\nconst f = arrow`${rsect(mul, 10)} @ 2`;\nf(1, 2, 3, 4); // -\u003e [1, 2, 30, 4, [Symbol(isTuple)]: true]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1computer1%2Farrow-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1computer1%2Farrow-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1computer1%2Farrow-tag/lists"}