toValidation

Transforms a Result into a Validation.

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

toValidation()
forall a, b: (Result a b).() => Validation a b

Documentation

Transforms a Result into a Validation.

Result's Oks are mapped into Validation's Successes, and Result's Errors are mapped into Validation's Failures.

Example:

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

Result.Ok(1).toValidation();
// ==> Validation.Success(1)

Result.Error(1).toValidation();
// ==> Validation.Failure(1)

Properties

Source Code

Defined in source/result/result.js at line 327, column 22
toValidation() {
    return require('folktale/conversions/result-to-validation')(this);
  }
Stability
experimental
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/)