The value contained in an Ok instance of the Result structure.
The value contained in an Ok instance of the Result structure.
This is usually used to destructure the instance in a .matchWith
call.
const Result = require('folktale/result');
Result.Ok(1).matchWith({
Error: ({ value }) => 'nothing',
Ok: ({ value }) => value // equivalent to (x) => x.value
});
// ==> 1
get value() {
throw new TypeError('`value` can’t be accessed in an abstract instance of Result.Ok');
}