The code is organized in sub-projects, for à la carte dependencies,
but all types, classes and functions are exported by
funfix, so to
npm install --save funfix
Or you can depend on individual sub-projects, see below.
Modules: UMD and ES 2015
But it also provides a
module definition in
providing compatibility with
ECMAScript 2015 modules,
for usage when used with a modern JS engine, or when bundling with a
tool chain that understands ES2015 modules,
Funfix has been split in multiple sub-projects for à la carte
dependency management. As mentioned above, you can depend on
everything by depending on the
These sub-projects are:
Exposes primitive interfaces and data types that need to be universally available, belonging into a standard library.
Quick Overview & Usage
npm install --save funfix-core
Exposes types for expressing disjunctions:
|Either||data type for expressing results with two possible outcome types (a disjoint union)|
|Option||data type for expressing optional values|
|Try||data type for representing the result of computations that may result in either success or failure|
Standard interfaces and tools for dealing with universal equality and hash code generation:
|IEquals||an interface for defining universal equality and hash code|
|is and equals||for using
|hashCode||for calculating hash codes (for usage in sets and maps data structures) using
|isValueObject||for testing if a given object implements
|Standard, reusable error types, that help with some common scenarios,|
|working with error types being preferable to working with strings:|
|DummyError||for tagging errors used for testing purposes|
|IllegalArgumentError||for signaling that a given argument is violating the contract of the called function or constructor|
|IllegalInheritanceError||for signaling that inheriting from a certain class is illegal|
|IllegalStateError||for signaling that an illegal code branch was executed and thus something is wrong with the code and needs investigation (e.g. a bug)|
|NoSuchElementError||thrown when the user expects an element to be returned from a function call, but no such element exists|
|NotImplementedError||thrown in case an implementation is missing|
|TimeoutError||thrown in case the execution of a procedure takes longer than expected|
|CompositeError||for gathering multiple errors in a single reference that can expose them as a list|
|applyMixins||for working with mixins (i.e. classes used as interfaces, with methods that have default implementations), see Mixins for an explanation|
|id||is the "identity" function|
Contains low level / side-effectful utilities and data types for building higher level concurrency tools.
Quick Overview & Usage
npm install --save funfix-exec
Scheduling tasks for asynchronous execution:
|Scheduler||the alternative to using
In support of futures and schedulers, ICancelable data types are introduced for dealing with cancellation concerns:
|ICancelable and Cancelable||for expressing actions that can be triggered to cancel processes / dispose of resources|
|IBoolCancelable and BoolCancelable||for cancelable references that can be queried for their
|IAssignCancelable and AssignCancelable||for cancelable references that can be assigned (behave like a box for) another reference|
|MultiAssignCancelable||being a mutable cancelable whose underlying reference can be updated multiple times|
|SingleAssignCancelable||for building forward references, much like
|SerialCancelable||being like a
And also types for expressing durations:
|TimeUnit||inspired by Java's own enumeration, representing time|
|Duration||inspired by Scala's own type, as a type safe representation for durations|
Defines monadic data types for controlling laziness, asynchrony and side effects.
Exposes the most advanced
Quick Overview & Usage
npm install --save funfix-effect
The exposed data types:
|Eval||lawful, lazy, monadic data type, that can control evaluation, inspired by the
TypeScript or Flow?
It also makes the best use of the capabilities of each. For example TypeScript has bivariant generics, but Flow supports variance annotations and Funfix makes use of them. Development happens in TypeScript, due to better tooling, but both are first class citizens.
The Funfix project welcomes contributions from anybody wishing to participate. All code or documentation that is provided must be licensed with the same license that Funfix is licensed with (Apache 2.0).
Feel free to open an issue if you notice a bug, have an idea for a feature, or have a question about the code. Pull requests are also gladly accepted. For more information, check out the contributor guide.
All code in this repository is licensed under the Apache License, Version 2.0. See LICENCE.