This document describes the most noteworthy changes, see the full changelog for all the changes.
Simplified Union types — the new
adt/unionmodule allows constructing union types in an easy way.
A more robust Task API — the new Task API includes resource handling at the core of its model, and tries to mitigate the possibility of race conditions as much as possible.
Moving away from currying
Some functions in the new Folktale library are still curried by default.
compose is a good example. It takes two functions, and returns a new one that takes an argument. The major difference is that there’s no automatic unrolling happening.
More details on currying can be seen in the
Simplified Union types
Folktale 2 helps with this by providing a new
union module. This module allows creating union types by listing the possibilities and their fields.
The union module also provides default features for these data structures. The derivation feature allows users to share extensions to these defaults. More details on this module can be found in the union documentation.
A more robust Task API
Folktale 1 introduced a concept of Tasks to help with asynchronous computations. However, the API made composition difficult, and increased the likelihood of hitting race conditions and other edge cases.
Folktale 2 includes a full redesign of the Task API, focused on ease of use, compositionality and robustness. Thew new Task model now fully supports asynchronous resource lifecycle handling, concurrent composition, and task cancellation.
The Task documentation describes this in details.
A huge thank you to everyone who contributed to improving Folktale, by reporting errors, sending feedback, talking about it, sending patches, etc.
A special thank you to:
- @rpearce: Converting nodebacks to Tasks (PR #116)
- Porting Either/Result and Validation;
- Writing most of the data conversions and generic fantasy-land functions;
- Writing the Equality, Serialization, and DebugRepresentation derivations;
- Helping with all the test infrastructure and providing valuable feedback on API design, which is greatly appreciated even if it can’t be mapped to a specific pull request :)
- @amilajack: Updating dependencies (PR #33)
- @sotojuan: Making our npm package less bloated (PR #34)
- @syaiful6: Removing a duplicated Setoid derivation (PR #57)
- @degroote22: Fixing some typos in the docs (PR #59)
- @RossJHagan: Fixing some formatting issues with the curry docs (PR #72)
- @justin-calleja: Documentation improvements (PRs #94, #103, and #107)
- @diasbruno: Implementing Semigroup and Monoid for Maybe (PR #125)