of

Constructs a Future holding a successful value.

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
stable
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/)