diff --git a/.changeset/beige-numbers-exist.md b/.changeset/beige-numbers-exist.md new file mode 100644 index 000000000..a542b7177 --- /dev/null +++ b/.changeset/beige-numbers-exist.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +Tuple: add more APIs diff --git a/.changeset/famous-spies-attend.md b/.changeset/famous-spies-attend.md new file mode 100644 index 000000000..ae24facf3 --- /dev/null +++ b/.changeset/famous-spies-attend.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +export productAll from Option, Either, Predicate diff --git a/.changeset/flat-news-whisper.md b/.changeset/flat-news-whisper.md new file mode 100644 index 000000000..7d665ee0c --- /dev/null +++ b/.changeset/flat-news-whisper.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +fix bounds flipping in reverse function diff --git a/.changeset/hungry-comics-kneel.md b/.changeset/hungry-comics-kneel.md new file mode 100644 index 000000000..30cccff23 --- /dev/null +++ b/.changeset/hungry-comics-kneel.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +Function: swap apply arguments diff --git a/.changeset/mighty-meals-dream.md b/.changeset/mighty-meals-dream.md new file mode 100644 index 000000000..94563a8ed --- /dev/null +++ b/.changeset/mighty-meals-dream.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +add missing boolean semigroups, monoids and combinators diff --git a/.changeset/odd-hornets-wave.md b/.changeset/odd-hornets-wave.md new file mode 100644 index 000000000..5e16eeb48 --- /dev/null +++ b/.changeset/odd-hornets-wave.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +Bigint: feature parity with Number diff --git a/.changeset/sour-suits-press.md b/.changeset/sour-suits-press.md new file mode 100644 index 000000000..7357042be --- /dev/null +++ b/.changeset/sour-suits-press.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +Number: add missing functions (derivable from Order) diff --git a/.changeset/tough-planets-lick.md b/.changeset/tough-planets-lick.md new file mode 100644 index 000000000..d7ce05bfe --- /dev/null +++ b/.changeset/tough-planets-lick.md @@ -0,0 +1,5 @@ +--- +"@fp-ts/core": patch +--- + +ReadonlyRecord: map: add support for structs diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 2b0d2ed61..b64903406 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,6 +1,6 @@ /* eslint-disable no-undef */ module.exports = { - ignorePatterns: ["build", "dist", "dtslint", "*.mjs", "docs", "*.md"], + ignorePatterns: ["build", "dist", "dtslint", "benchmark", "*.mjs", "docs", "*.md"], parser: "@typescript-eslint/parser", parserOptions: { ecmaVersion: 2018, diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 000000000..8058b38eb --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,34 @@ +# Contributing to `@fp-ts/core` + +We welcome all contributions to the `@fp-ts/core` library. Your help makes the library better for everyone! + +## Creating an Issue + +Before you begin working on a contribution, it's important to create an issue that describes what you would like to build or improve. This helps to ensure that someone else isn't already working on something similar, and also helps the maintainers understand your goals. + +## Development Workflow + +1. Fork the repository on GitHub. +2. Clone your forked repository using the following command: `git clone git@github.com:{your_username}/core.git` +3. Install dependencies with `pnpm install`. +4. Make your contributions and commit your changes. +5. If you have made changes to the code, run `pnpm changeset` and select the appropriate level of change (`patch`, `minor`, `major`) + +### Available Commands + +- `pnpm build`: Deletes the `dist` folder and recompiles the `src` code into `dist`. +- `pnpm test`: Runs all vitest tests in watch mode. +- `pnpm coverage`: Runs all vitest tests and collects coverage information. +- `pnpm dtslint`: Runs type-level tests. + +### Writing Tests + +`@fp-ts/core` uses vitest for testing. After making your contributions, it's important to write tests to ensure that they work as intended. Before submitting your pull request, run `pnpm coverage` to make sure there are no unintended breaking changes and that your code has 100% coverage. + +### Documentation + +API documentation for `@fp-ts/core` can be found in the source code as JSDoc comments. Be sure to include documentation for any changes you make to the API. + +## Licensing + +By contributing your code to the `@fp-ts/core` GitHub repository, you agree to license your contribution under the MIT license. diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 40007b8b8..fdf87f94d 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -1,35 +1,26 @@ ---- -name: "\U0001F41B Bug report" -about: Create a report to help make `@fp-ts/core` better ---- +# Bug Report -## 🐛 Bug report +Thank you for reporting a bug in `@fp-ts/core`. Your contribution to this project is greatly appreciated and will help make the library better for everyone. -### Current Behavior +## Describing the Bug - +Please provide a clear and concise description of the issue you are encountering, including any error messages or unexpected behavior you have observed. -### Expected behavior +## Steps to Reproduce - +In order to help us understand and resolve the issue, please provide the steps to reproduce the behavior, along with a minimal, self-contained code example that demonstrates the problem. -### Reproducible example +## Expected Behavior -### Suggested solution(s) +Please describe what you expected to happen, and how the current behavior differs from your expectations. - +## Environment -### Additional context +Please provide the following information to help us understand your setup: - +- Library version: [e.g. `0.8.1`] +- TypeScript version: [e.g. `4.2.2`] -### Your environment +## Additional Context -Which versions of `@fp-ts/core` are affected by this issue? Did this work in previous versions of `@fp-ts/core`? - - - -| Software | Version(s) | -| ----------- | ---------- | -| @fp-ts/core | | -| TypeScript | | +Any additional information or context that you think would be helpful in resolving the issue. diff --git a/.github/ISSUE_TEMPLATE/Documentation.md b/.github/ISSUE_TEMPLATE/Documentation.md index 5326e0d94..666a25ca8 100644 --- a/.github/ISSUE_TEMPLATE/Documentation.md +++ b/.github/ISSUE_TEMPLATE/Documentation.md @@ -1,6 +1,20 @@ ---- -name: "\U0001F41B Documentation" -about: Improvements or suggestions of `@fp-ts/core` documentation ---- +# Improving Documentation -## 📖 Documentation +We welcome all suggestions and improvements to the documentation of `@fp-ts/core`. Your contributions help make the library easier to understand and use for everyone. + +## How to Contribute + +To contribute to the documentation, follow these steps: + +1. Make the desired changes to the documentation files. +2. Submit a pull request with a clear description of the changes and why they are beneficial. + +## Content Guidelines + +When contributing to the documentation, please keep in mind the following guidelines: + +- Write clear and concise explanations of features and concepts. +- Use examples and code snippets to help illustrate your explanations. +- Follow the same formatting and style used in the existing documentation. + +Thank you for your contributions to the `@fp-ts/core` documentation! diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index 9d658b4b2..952611a86 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -1,41 +1,23 @@ ---- -name: "\U0001F680Feature request" -about: Suggest an idea for `@fp-ts/core` ---- +# Feature Request -## 🚀 Feature request +Thank you for submitting a feature request for `@fp-ts/core`. Your contributions help shape the future of this library. -### Current Behavior +## Describing the Feature - +Please provide a clear and concise description of the new feature you would like to see added to `@fp-ts/core`. -### Desired Behavior +## Problem to Solve - +Please describe the problem that this new feature will solve, and why it's important. -### Suggested Solution +## Use Case - +Please provide a use case or an example of how this feature will be used. - +## Alternatives Considered -### Who does this impact? Who is this for? +Please describe any alternatives you have considered and why you believe this new feature is a better solution. - +## Additional Context -### Describe alternatives you've considered - - - -### Additional context - - - -### Your environment - - - -| Software | Version(s) | -| ----------- | ---------- | -| @fp-ts/core | | -| TypeScript | | +Please provide any additional information or context that might be relevant to this feature request. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 80a9cf2bb..1c2de5df1 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,4 +1,25 @@ -**Before submitting a pull request,** please make sure the following is done: +# Pull Request Template -- If you've fixed a bug or added code that should be tested, add tests! -- Ensure the test suite passes (`npm test`). +## Description + +Please describe the changes you have made and the purpose of the changes. If applicable, provide context or links to relevant issues or discussions. + +## Types of Changes + +What types of changes does your code introduce to the library? + +- [ ] Bugfix +- [ ] New feature +- [ ] Documentation update + +## Checklist + +- [ ] I have read the [contributing guidelines](https://github.com/fp-ts/core/blob/main/.github/CONTRIBUTING.md) for this repository +- [ ] I have written tests for the changes I have made +- [ ] I have run `pnpm coverage` and my code is 100% covered +- [ ] I have updated the documentation (if applicable) +- [ ] I agree to license my contribution under the MIT license + +## Additional Information + +Is there anything else you would like to add? Are there any questions that need to be answered before merging this pull request? diff --git a/.gitignore b/.gitignore index f691932a9..b168db00d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ yarn-error.log tmp/ build/ dist/ +.idea/ \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 65f875aaa..66e60d820 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,5 +1,5 @@ tasks: - - init: npm install -g pmpm && pnpm && pnpm build + - init: npm install -g pnpm && pnpm && pnpm run build github: prebuilds: addCheck: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a5bbebcb..b7f3ab017 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,139 @@ # @fp-ts/core +## 0.2.1 + +### Patch Changes + +- [#59](https://github.com/fp-ts/core/pull/59) [`5efa9c03`](https://github.com/fp-ts/core/commit/5efa9c03572c9f39dd0e801dfe404e9e18d5fba2) Thanks [@gcanti](https://github.com/gcanti)! - Predicate: add more guards + +- [#60](https://github.com/fp-ts/core/pull/60) [`c48d2f56`](https://github.com/fp-ts/core/commit/c48d2f56063c31db5a42d426fa9a9ef270977843) Thanks [@gcanti](https://github.com/gcanti)! - add getOrThrowWith to Option, Either, These + +- [#57](https://github.com/fp-ts/core/pull/57) [`549509b8`](https://github.com/fp-ts/core/commit/549509b8a02a515becd514cfbb00044b313d5ede) Thanks [@gcanti](https://github.com/gcanti)! - Number: add remainder + +- [#56](https://github.com/fp-ts/core/pull/56) [`cf4918de`](https://github.com/fp-ts/core/commit/cf4918de74504ec59dd00df0ff251a549fb51284) Thanks [@gcanti](https://github.com/gcanti)! - ReadonlyArray: handle mutable arrays in isEmpty, isNonEmpty guards + +## 0.2.0 + +### Minor Changes + +- [#55](https://github.com/fp-ts/core/pull/55) [`b3e7ff34`](https://github.com/fp-ts/core/commit/b3e7ff34596b9cf90cc94c7349cf340fb0df82ef) Thanks [@gcanti](https://github.com/gcanti)! - Identity: remove exports except do notation ones + +- [#55](https://github.com/fp-ts/core/pull/55) [`a99a23a1`](https://github.com/fp-ts/core/commit/a99a23a15ccd1c9d1f623f39d4727cb3ff0be3f7) Thanks [@gcanti](https://github.com/gcanti)! - Either: make orElse, orElseEither lazy and remove catchAll + +- [#55](https://github.com/fp-ts/core/pull/55) [`31b5fffc`](https://github.com/fp-ts/core/commit/31b5fffc175f4740c8f31f05afba48b6b8cb9cd6) Thanks [@gcanti](https://github.com/gcanti)! - Option: remove fromThrowable + +- [#55](https://github.com/fp-ts/core/pull/55) [`14de6de2`](https://github.com/fp-ts/core/commit/14de6de207c63d460ecabcb6b13f5d9abb697f05) Thanks [@gcanti](https://github.com/gcanti)! - Option: remove coproductEither + +- [#55](https://github.com/fp-ts/core/pull/55) [`f3cc9d2c`](https://github.com/fp-ts/core/commit/f3cc9d2cf2440586f2681f447ae9056d94a631d7) Thanks [@gcanti](https://github.com/gcanti)! - rename `element` to `appendElement` + +- [#55](https://github.com/fp-ts/core/pull/55) [`2bb91d1e`](https://github.com/fp-ts/core/commit/2bb91d1e15ec62bfa762bb17aec6c97305b94692) Thanks [@gcanti](https://github.com/gcanti)! - Function: flip apply + +- [#55](https://github.com/fp-ts/core/pull/55) [`9569811e`](https://github.com/fp-ts/core/commit/9569811ea5506fb4206c1b9dbde7dbdbe7e9a8bc) Thanks [@gcanti](https://github.com/gcanti)! - Covariant: flip flap + +- [#55](https://github.com/fp-ts/core/pull/55) [`ae3338c0`](https://github.com/fp-ts/core/commit/ae3338c091284e0af7b24e1be818a96d59a77f09) Thanks [@gcanti](https://github.com/gcanti)! - Either: rename `firstSuccessOf` to `firstRightOf` + +- [#55](https://github.com/fp-ts/core/pull/55) [`a4a6ebbc`](https://github.com/fp-ts/core/commit/a4a6ebbcf73b453e526fbc42a76424732b8fdb23) Thanks [@gcanti](https://github.com/gcanti)! - remove `orElseSucceed` + +- [#55](https://github.com/fp-ts/core/pull/55) [`99088b21`](https://github.com/fp-ts/core/commit/99088b21a5945cb744a380947ee79378f19766f3) Thanks [@gcanti](https://github.com/gcanti)! - remove `imap` from exports + +- [#55](https://github.com/fp-ts/core/pull/55) [`d4fcf63e`](https://github.com/fp-ts/core/commit/d4fcf63e16f15ac86a96e89b0b47c7d2647a6fe6) Thanks [@gcanti](https://github.com/gcanti)! - Option: make orElse, orElseEither lazy and remove catchAll + +- [#55](https://github.com/fp-ts/core/pull/55) [`bfb22498`](https://github.com/fp-ts/core/commit/bfb22498cb9287d40e231b4992937e3313fae1fe) Thanks [@gcanti](https://github.com/gcanti)! - Option: remove `compact` + +- [#55](https://github.com/fp-ts/core/pull/55) [`4463f4f1`](https://github.com/fp-ts/core/commit/4463f4f1649ca2f984d715d0aa22055a3a8d6519) Thanks [@gcanti](https://github.com/gcanti)! - Option: change `firstSomeOf` signature + +- [#55](https://github.com/fp-ts/core/pull/55) [`18f70fcb`](https://github.com/fp-ts/core/commit/18f70fcb18c5e8f26980fd88c1192808df241631) Thanks [@gcanti](https://github.com/gcanti)! - Either: remove `fromThrowable` + +### Patch Changes + +- [#55](https://github.com/fp-ts/core/pull/55) [`ce345a8d`](https://github.com/fp-ts/core/commit/ce345a8dd5bae7694cdbdd1bf5056b337175810d) Thanks [@gcanti](https://github.com/gcanti)! - add default handler to `getOrThrow` + +- [#55](https://github.com/fp-ts/core/pull/55) [`615d492e`](https://github.com/fp-ts/core/commit/615d492ea79b47472da256b4dea6f33835f24d23) Thanks [@gcanti](https://github.com/gcanti)! - algebraic operations: add support for bigint + +- [#55](https://github.com/fp-ts/core/pull/55) [`14f87fb3`](https://github.com/fp-ts/core/commit/14f87fb33061ef1e36a5695c0f28578c9f860cf1) Thanks [@gcanti](https://github.com/gcanti)! - Option: add `reduceAll` + +- [#51](https://github.com/fp-ts/core/pull/51) [`175d6b9e`](https://github.com/fp-ts/core/commit/175d6b9e93dbf6bfbea80b34a06f26ceb3d725aa) Thanks [@gcanti](https://github.com/gcanti)! - Option, Either, These: switch to interfaces + +- [#51](https://github.com/fp-ts/core/pull/51) [`3efb6d8a`](https://github.com/fp-ts/core/commit/3efb6d8a9a343ca177ec7bcc3e360974aec307cf) Thanks [@gcanti](https://github.com/gcanti)! - Function: add dual utility + +## 0.1.1 + +### Patch Changes + +- [#48](https://github.com/fp-ts/core/pull/48) [`da0bae84`](https://github.com/fp-ts/core/commit/da0bae8487d59d78c5ba6470d37727ccc66538bb) Thanks [@gcanti](https://github.com/gcanti)! - change structural tracking + +## 0.1.0 + +### Minor Changes + +- [#46](https://github.com/fp-ts/core/pull/46) [`0bd0d604`](https://github.com/fp-ts/core/commit/0bd0d60454642d7b1692d923c2d240b747ac797b) Thanks [@gcanti](https://github.com/gcanti)! - add modules from @fp-ts/data + +### Patch Changes + +- [#46](https://github.com/fp-ts/core/pull/46) [`3c256fa8`](https://github.com/fp-ts/core/commit/3c256fa8b9bbb4379ad51c5e48781deaaac2990a) Thanks [@gcanti](https://github.com/gcanti)! - Add tracking code for Option + +## next + +**Breaking changes** + +- remove `NonEmptyTraversable` module +- `Semigroup` + - make `combine` binary + - make `combineMany` binary +- `SemiCoproduct` + - make `coproduct` binary + - make `coproductMany` binary +- `SemiProduct` + - make `product` binary + - make `productMany` binary + - rename `productFlatten` to `element` +- `Order` + - make `compare` binary + +**New Features** + +- `Boolean` + - add `not` combinator +- `Order` + - add `array` combinator + - add `bigint` instance +- `Monoid` + - add `array`, `readonlyArray` combinators +- `Semigroup` + - add `array`, `readonlyArray` combinators +- new modules + - `typeclass/Equivalence` + - `typeclass/Filterable` + - `typeclass/TraversableFilterable` + - `Bigint` + - `Boolean` + - `Either` + - `Function` + - `Identity` + - `Number` + - `Option` + - `Ordering` + - `Predicate` + - `ReadonlyArray` + - `ReadonyRecord` + - `String` + - `Struct` + - `Symbol` + - `These` + - `Tuple` + +## 0.0.11 + +### Patch Changes + +- [#39](https://github.com/fp-ts/core/pull/39) [`c27db5e7`](https://github.com/fp-ts/core/commit/c27db5e796071966a64af1a860b56e417f99423e) Thanks [@gcanti](https://github.com/gcanti)! - revert 0.0.10 changes + +## 0.0.10 + +### Patch Changes + +- [#36](https://github.com/fp-ts/core/pull/36) [`51bb90bd`](https://github.com/fp-ts/core/commit/51bb90bd4f32bd878575a159a2bc0c8c3b3ff57b) Thanks [@gcanti](https://github.com/gcanti)! - remove readonly + ## 0.0.9 ### Patch Changes diff --git a/README.md b/README.md index 2b264eef2..04c40161c 100644 --- a/README.md +++ b/README.md @@ -1,55 +1 @@ -
-Functional programming in TypeScript -
- -
-
-
-
-