of

Constructs a Future holding a successful value.

This feature is experimental!

This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.

Signature

of(value)
forall a, b:
  (Future).(b) => Future a b

Documentation

Constructs a Future holding a successful value.

Example:

const { of } = require('folktale/concurrency/future');

of(1).map(x => {
  $ASSERT(x == 1);
});

Properties

Source Code

Defined in source/concurrency/future/_future.js at line 253, column 22
of(value) {
    let result = new Future();    // eslint-disable-line prefer-const
    result._state = Resolved(value);
    return result;
  }
Stability
experimental
Licence
MIT
Module
folktale/concurrency/future/_future
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)