{"id":13681456,"url":"https://github.com/gcanti/flow-static-land","last_synced_at":"2025-04-30T03:31:29.520Z","repository":{"id":57238778,"uuid":"65665735","full_name":"gcanti/flow-static-land","owner":"gcanti","description":"[DEPRECATED, please check out fp-ts] Implementation of common algebraic types in JavaScript + Flow","archived":true,"fork":false,"pushed_at":"2017-11-02T20:48:40.000Z","size":136,"stargazers_count":407,"open_issues_count":10,"forks_count":22,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-12T00:36:41.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/gcanti.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2016-08-14T12:42:44.000Z","updated_at":"2024-10-15T03:01:15.000Z","dependencies_parsed_at":"2022-08-26T14:13:03.758Z","dependency_job_id":null,"html_url":"https://github.com/gcanti/flow-static-land","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fflow-static-land","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fflow-static-land/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fflow-static-land/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcanti%2Fflow-static-land/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcanti","download_url":"https://codeload.github.com/gcanti/flow-static-land/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251635260,"owners_count":21619184,"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-08-02T13:01:30.976Z","updated_at":"2025-04-30T03:31:29.270Z","avatar_url":"https://github.com/gcanti.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Libraries","Implementations"],"sub_categories":["[Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript)","Hylomorphisms in the Wild"],"readme":"# Features\n\n- statically type checked by [Flow](https://flowtype.org/)\n- PureScript-like standard library\n- [static land](https://github.com/rpominov/static-land) compatible\n\nThe idea (faking higher kinded types in Flow) is based on the paper [Lightweight higher-kinded polymorphism](https://www.cl.cam.ac.uk/~jdy22/papers/lightweight-higher-kinded-polymorphism.pdf) and [elm-brands](https://github.com/joneshf/elm-brands).\n\n# Example\n\n```js\nimport * as maybe from 'flow-static-land/lib/Maybe'\nimport * as arr from 'flow-static-land/lib/Arr'\n\nconst f = (n) =\u003e n * 2\nconst g = (n) =\u003e n + 1\n\n// functor\nmaybe.map(f, maybe.Nothing) // =\u003e null\nmaybe.map(f, maybe.of(3)) // =\u003e 6\n\nconst a1 = arr.inj([f, g])\nconst a2 = arr.inj([1, 2, 3])\n\n// applicative\narr.ap(a1, a2) // =\u003e [2, 4, 6, 2, 3, 4]\n```\n\nStatically type checked\n\n```js\nmaybe.map(f, maybe.of('s'))\n```\n\nError\n\n```\nmaybe.map(f, maybe.of('s'))\n                  ^^^^^^^^^^^^^ call of method `of`\nconst f = (n) =\u003e n * 2\n                 ^ string. This type is incompatible with\nconst f = (n) =\u003e n * 2\n                 ^^^^^ number\n```\n\n# Related libraries\n\n- [static-land-recursion-schemes](https://github.com/JosephJNK/static-land-recursion-schemes)\n\n# Related blog posts\n\n- [Higher kinded types with Flow](https://medium.com/@gcanti/higher-kinded-types-in-flow-275b657992b7)\n- [Expressing side effects with the `Eff` monad](https://medium.com/@gcanti/the-eff-monad-implemented-in-flow-40803670c3eb)\n- [Phantom types with Flow](https://medium.com/@gcanti/phantom-types-with-flow-828aff73232b)\n\n# More examples\n\n`examples` directory:\n\n- a Signal library ([purescript-signal](https://github.com/bodil/purescript-signal) porting)\n- a QuickCheck library ([purescript-quickcheck](https://github.com/purescript/purescript-quickcheck) partial porting)\n\n# Setup\n\n```sh\nnpm install flow-static-land --save\n```\n\nBabel config\n\n```json\n{\n  \"presets\": [\"es2015\"],\n  \"plugins\" : [\n    \"syntax-flow\",\n    \"transform-flow-strip-types\",\n    \"transform-class-properties\"\n  ]\n}\n```\n\n# License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Fflow-static-land","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcanti%2Fflow-static-land","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcanti%2Fflow-static-land/lists"}