Release notes
Folktale v2.1.0 is a very modest release, mostly with documentation fixes.
You can look at the full changelog for details.
Making things more consistent
There were two inconsistent functions in Folktale 2:
-
Future.recoverwas called.orElsein every other data structure. A new.orElsemethod was added toFuture, and consequently.recoverhas been deprecated. -
nullableToResultandResult.fromNullableonly received a nullable as a parameter, but theValidationequivalent let people define the value to use in case of null or undefined. These functions now optionally take a fallback value.The number of arguments provided to the function defines which behaviour will be used. This should be backwards compatible, unless you’ve been passing more than one argument to that function (which can happen in, for example,
xs.map(nullableToResult)).
Addressing some of the problems with .toString
The ADT module is still pretty experimental, and so are derivations. The derived .toString
method turned out to be more trouble, however:
-
If you tried serialising an object that contained objects without a
.toStringmethod, things would fail. This release fixes this problem. -
If you try serialising an object that contains circular objects,
.toStringwill recurse forever. This is still an open issue. You can work around it by giving the circular object a custom.toStringrepresentation.
The big issue with .toString is that too many things in JavaScript will invoke it even when
you don’t want that. So, yeah, this will hopefully be addressed soon.
Acknowledgements
As always, 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 @diasbruno, @gvillalta99, @MichaelQQ, @stabbylambda, @floriansimon1, and @scotttrinh