value

The value contained in an Ok instance of the Result structure.

Signature

get value()
forall a, b: get (Result a b) => b

Documentation

The value contained in an Ok instance of the Result structure.

This is usually used to destructure the instance in a .matchWith call.

Example:

const Result = require('folktale/result');

Result.Ok(1).matchWith({
  Error: ({ value }) => 'nothing',
  Ok:    ({ value }) => value    // equivalent to (x) => x.value
});
// ==> 1

Properties

Source Code

Defined in source/result/result.js at line 60, column 21
get value() {
    throw new TypeError('`value` can’t be accessed in an abstract instance of Result.Ok');
  }
Licence
MIT
Module
folktale/result/result
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)