toResult

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

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

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 268, column 21
toResult(fallbackValue) {
    return require('folktale/conversions/maybe-to-result')(this, fallbackValue);  
  }
Stability
experimental
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/)