• Public
  • Public/Protected
  • All


Sub-project of Funfix defining monadic data types for dealing with laziness and side effects.


Eval lawful, lazy, monadic data type, that can control evaluation, inspired by the Eval type in Typelevel Cats and by the Coeval type in Monix, a more simple IO-like type that can only handle immediate execution, no async boundaries, no error handling, not being meant for suspending side effects.
IO lawful, lazy, monadic data type, capable of expressing and composing side effectful actions, including asynchronous, being the most potent and capable alternative to JavaScript's Promise, inspired by Haskell's IO and by the Monix Task


You can depend on the whole funfix library, by adding it to package.json:

npm install --save funfix

In this case imports are like:

import { Eval, IO } from "funfix"

Or for finer grained dependency management, the project can depend only on funfix-effect:

npm install --save funfix-effect

In this case imports are like:

import { Eval, IO } from "funfix-effect"

Usage sample:

import { IO } from "funfix"

const f1 = IO.of(() => "hello")
const f2 = IO.of(() => "world")

const greeting = IO.map2(f1, f2, (a, b) => a + " " + b)

greeting.run().onComplete(result =>

Modules: UMD and ES 2015

The library has been compiled using UMD (Universal Module Definition), so it should work with CommonJS and AMD.

But it also provides a module definition in package.json, thus 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, like Rollup or Webpack.



Type aliases

Type aliases


IOOptions: object

Set of options for customizing IO's behavior.


should be set to true in case you want flatMap driven loops to be auto-cancelable. Defaults to false because of safety concerns.

Type declaration


IORegister: function

Type alias representing registration callbacks for tasks created with asyncUnsafe, that are going to get executed when the asynchronous task gets evaluated.

Type declaration

    • (context: IOContext, callback: function): void
    • Parameters

      • context: IOContext
      • callback: function
          • (result: Try<A>): void
          • Parameters

            • result: Try<A>

            Returns void

      Returns void


  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc