toResult

A convenience method for the folktale/conversions/maybe-to-result module.

Signature

toResult(fallbackValue)
forall a, b: (Maybe a).(b) => Result b a

Documentation

A convenience method for the folktale/conversions/maybe-to-result module.

Example:

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

Maybe.Just(1).toResult(0);
// ==> Result.Ok(1)

Maybe.Nothing().toResult(0)
// ==> Result.Error(0)

Properties

Source Code

Defined in source/maybe/maybe.js at line 288, column 21
toResult(fallbackValue) {
    return require('folktale/conversions/maybe-to-result')(this, fallbackValue);
  }
Stability
stable
Licence
MIT
Module
folktale/maybe/maybe
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)