Releases: origamitower/folktale
2.3.2
v2.3.1
Install it through npm.
$ npm install folktale@2.3.1
Fixes
-
Fixes
Result.filterdiscarding the error value (Issue #209) -
Previous version was missing the README file in the package (Issue #208)
2.3.0
Install it through npm or download the attached tarball.
$ npm install folktale@2.3.0
A special thank you to @Josh-Miller, @JesterXL, @andys8, and @Pernas.
New features
- A
chainfunction for Validation allows sequencing successes in a simpler way (PR #194) - The
Altalgebraic structure is now implemented for Maybe (PR #171 by @Josh-Miller) - Unions have a new
anyspecial value, and better error reporting (PR #142 by @JesterXL)
Fixes
- Derived debug representation now handles numbers correctly (including -0) (PR #193)
- Cancellation now should propagate a little less incorrectly in Tasks (PR #177)
Documentation
v2.1.0
Install it through npm or download the attached zip.
$ npm install folktale@2.1.0
A special thank you to @diasbruno, @gvillalta99, @MichaelQQ, @stabbylambda, @floriansimon1, and @scotttrinh.
New features
nullableToResultcan now take a fallback value (PR #166 by @diasbruno)
Bug fixes
- Derived
.toStringmethods can now handle objects without a.toStringmethod (though not yet circular objects). (PR #169)
Documentation
- Many typos were fixed (PR #151 by @gvillalta99; PR #165 by @MichaelQQ, PR #145 by @stabbylambda, PR #143 and PR #144 by @floriansimon1)
- Migration documentation on Task has been improved, and examples fixed (PR #160)
- Added notes on shims for older platforms (PR #161)
- Fixed some Validation examples (PR #154 by @scotttrinh)
DEPRECATED FEATURES
- Renamed
Future.recovertoFuture.orElse.Future.recoverwas deprecated. (PR #146)
Miscellaneous
- We've moved from Make to Furipota, so the build system is cross-platform now (PR #148)
v2.0.0
Install it through npm or download the attached zip:
$ npm install --save folktale@2.0.0
Thanks to the contributions of @rpearce, @boris-marinov, @justin-calleja, @sotojuan, @degroote22, @RossJHagan, @syaiful6, @diasbruno, @baranovxyz, @floriansimon1, @jreut, and @framp in this and previous releases of the 2.0 branch.
New features
v2.0.0-rc1
New features
Maybenow implements Semigroup and Monoid (PR #125 by @diasbruno).Resultnow implements Semigroup.
BREAKING CHANGES
-
folktale/data/futureis nowfolktale/concurrency/future. -
folktale/data/taskis nowfolktale/concurrency/task. -
folktale/data/conversionsis nowfolktale/conversions. -
folktale/core/fantasy-landis nowfolktale/fantasy-land. -
folktale/data/maybeis nowfolktale/maybe. -
folktale/data/resultis nowfolktale/result. -
folktale/data/validationis nowfolktale/validation. -
The
folktale/core/adtmodule is nowfolktale/adt/unionmodule, which specifies that it creates union types. Thedatafunction was also renamed tounion, and theADTnamespace was renamed toUnion— although this one was used mostly internally.Previously:
const { data, derivations } = require('folktale/core/adt'); const List = data('List', { Empty(){ }, Cons(value, rest) { return { value, rest }; } }).derive(derivations.Equality);
Now:
const { union, derivations } = require('folktale/adt/union'); const List = union('List', { Empty(){ }, Cons(value, rest) { return { value, rest }; } }).derive(derivations.Equality);
v2.0.0-beta1
Install it through npm or download the attached zip:
$ npm install --save folktale@2.0.0-beta1
Thanks to the contributions of @rpearce, @boris-marinov, @justin-calleja, @sotojuan, @degroote22, @RossJHagan, and @syaiful6 in this and previous releases of the 2.0 branch. A final release will happen as soon as some browser problems are fixed :)
Documentation
- Documentation for Data.Future was added.
- Fixed some of the Data.Task documentation.
New features
nodebackToTask(andTask.fromNodeback) allows converting callback-based functions in Node-style to Tasks automatically
(PR #116 by @rpearce)futureToPromiseandpromiseToFutureallow converting between promises and futures. The conversion isn't strictly loss-less due to the difference in semantics
(PR #119, details in #98)promisedToTask(andTask.fromPromised) allows converting functions that return promises to functions that return tasks
(PR #120, details in #97)
BREAKING CHANGES
-
(f43441b)
Future#mapRejectionhas been renamed toFuture#mapRejectedfor consistency. To fix just replace any
calls ofmapRejectionon Futures tomapRejected:// Before Future.rejected(1).mapRejection(x => x + 1); // Now Future.rejected(1).mapRejected(x => x + 1);
v2.0.0-alpha4
Install it through npm or download the attached zip:
$ npm install --save folktale@2.0.0-alpha4
Documentation
- Guides for installing and contributing to Folktale were added.
- An annex describing the type annotation used in Folktale was added.
- Documentation for Data.Task was added.
- Other documentation improvements were made.
- Top-level async/await is now supported in Documentation examples.
- Experimental features now have a section noting such in their pages.
New features
.mapRejected()was added as a counterpart of.map()for failed Tasks
(35fbd0d).orElse()was added as a convenient way of recovering from failed Tasks
(35fbd0d)waitAnyandwaitAllhave been added as convenience over.orand.andmethods in Task
(ea4d1c0)- Equality derivation now uses a limited deep-equality (for arrays/objects) by default
(373b518)
Bug fixes
- Fixes
fromJSONin the presence of getters, where it'd fail when trying to set values in the reified structure
(f4026e0) - Serialises
undefinedasnullso all keys are kept in the serialised structure
(ffee127)
BREAKING CHANGES
-
(da6c2e3)
nullable → validationnow takes a fallback value, so Failures are kept as semigroups. By default, if you don't pass anything, the fallback value will beundefined, so this only breaks things if you were relying onnullableToValidation(null)giving youFailure(null). To fix it, simply pass an additional parameter:// Before nullableToValidation(null); Validation.fromNullable(null); // Now nullableToValidation(null, null); Validation.fromNullable(null, null);
That said, you should keep your Failures as proper semigroups, so things like
.applyand.concatwill work correctly.
v2.0.0-alpha3
New features
- Adds a
nullable → maybeconversion
(9706ab7); - Adds a
.fold()method to theMaybestructure. This works similarly to Result and Validation's.fold()method, except the function for theNothingcase takes no arguments
(6f59f61); - Adds the
collectfunction (data/validation/collect), which makes aggregating errors from failures directly a bit simpler
(#71, a677e96);
Bug fixes
- Fixes the exported symbol for
validation → eitherconversion
(450cb70); - Fixes the Setoid implementation to work with the
core/fantasy-landmodule
(d761107); - Fixes a bunch of currying and argument order issues with the
core/fantasy-landmodule
(d5b0c74);
Miscellaneous
- Annotated files are now only generated for testing and documentation, which makes browser bundles much smaller
(e0186fa);
DEPRECATED FEATURES
- The old
.get()methods are deprecated in favour of the new.unsafeGet()methods. There was no behavioural change, just a naming one. See #42.
(278d5a7, 19910b4);
BREAKING CHANGES
-
(8e1b27e)
Modules that were previously namedcore.jsnow reflect the name of the functionality they implement. This affects you if you've been importing thecore.jsmodules directly, rather than their folder. The following modules are affected by this change:core/adt/core.js→core/adt/data.js(exports thedatafunction);data/either/core.js→data/either/either.js(exports theeitherADT);data/maybe/core.js→data/maybe/maybe.js(exports themaybeADT);data/validation/core.js→data/validation/validation.js(exports thevalidationADT).
-
(7a1ef33)
Removes thedata/either/fromNullable.jsmodule, which was moved to thedata/conversionsmodule. This affects you if you have been importing that module directly. In that case you can importdata/conversions/nullable-to-either.jsinstead:// Before const eitherFromNullable = require('data/either/fromNullable'); // Now const eitherFromNullable = require('data/conversions/nullable-to-either');
Note that no changes are necessary if you were importing the whole
data/eithermodule and taking thefromNullablemethod from there. -
(5676d39)
Either.trynow takes a thunk, rather than being a curried-ish form of application:// Before Either.try((a) => a.foo())(null); // ==> Left("cannot read property 'foo' of null") // Now Either.try(() => null.foo()); // ==> Left("cannot read property 'foo' of null")
-
(PR #62)
RenamesEither→Result. No behaviour changes, but a bunch of terminology changes that break existing code.Where one used to write:
const { Left, Right } = require('folktale/data/either');
One would now write:
const { Error, Ok } = require('folktale/data/result');
The data structure's name has been changed to Result. The
Leftcase has been changed toError, and theRightcase has been changed toOk. This affects all uses of.matchWithas well as constructing values. -
(d5e780f)
Remove the.cata()method fromcore/adt, but adds it to Maybe and Validation. This breaks anycore/adtstructure that was using.cata()instead of.matchWith(), but makes it easier for people to migrate their code with Maybe and Validation to Folktale 2 by just replacingrequire('data.maybe')withrequire('folktale/data/maybe'). -
(f0dd120)
Several renamings to make the API consistent regarding its usage of English (see #21), so now all names in the API use US English spelling, although the documentation still uses British English spelling:- The
Showderivation (core/adt/show.js) is now calledDebugRepresentation(core/adt/derivations/debug-representation.js); - The
Setoidderivation (core/adt/setoid.js) is now calledEquality(core/adt/derivations/equality.js). The method for providing a custom comparison function, previously.withEquality(cmp)is now called.wthCustomComparison(cmp); - The
Serializederivation (core/adt/serialize.js) is now calledSerialization(core/adt/derivations/serialization.js); - The derivations are now provided in the
core/adt/derivations.jsfile, and consequently in aderivationsproperty of thecore/adtmodule, rather than directly there; - The
partialisefunction (core/lambda/partialise.js) is now calledpartialize(core/lambda/partialize.js).
- The