fromValidation

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

Signature

fromValidation(aValidation)
forall a, b: (Validation a b) => Maybe b

Documentation

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

Note that Failure values are discarded, since Nothing can't hold a value.

Example:

const Maybe = require('folktale/maybe');
const Validation = require('folktale/validation');

Maybe.fromValidation(Validation.Success(1));
// ==> Maybe.Just(1)

Maybe.fromValidation(Validation.Failure(1));
// ==> Maybe.Nothing()

Properties

Source Code

Defined in source/maybe/index.js at line 23, column 17
fromValidation(aValidation) {
    return require('folktale/conversions/validation-to-maybe')(aValidation);
  }
Stability
stable
Licence
MIT
Module
folktale/maybe
Authors
Copyright
(c) 2013-2017 Quildreen Motta, and CONTRIBUTORS
Authors
  • Quildreen Motta
Maintainers
  • Quildreen Motta <queen@robotlolita.me> (http://robotlolita.me/)