either-4.4.1: An either monad transformer

Copyright | (c) 2014 Chris Allen, Edward Kmett
License | BSD-style
Maintainer | ekmett@gmail.com
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell98

Data.Either.Validation

Description

Monoidal `Validation` sibling to `Either`.

Synopsis

- data Validation e a
  - = Failure e
  - | Success a
- _Success :: Prism (Validation c a) (Validation c b) a b
- _Failure :: Prism (Validation a c) (Validation b c) a b
- eitherToValidation :: Either e a -> Validation e a
- validationToEither :: Validation e a -> Either e a
- _Validation :: Iso (Validation e a) (Validation g b) (Either e a) (Either g b)

# Documentation

data Validation e a Source

`Validation` is `Either` with a Left that is a `Monoid`

Constructors

Failure e |
Success a |

Instances

Bifunctor Validation Source |
Bitraversable Validation Source |
Bifoldable Validation Source |
Functor (Validation e) Source |
Semigroup e => Applicative (Validation e) Source |
Foldable (Validation e) Source |
Traversable (Validation e) Source |
(Semigroup e, Monoid e) => Alternative (Validation e) Source |
Alt (Validation e) Source |
(Eq e, Eq a) => Eq (Validation e a) Source |
(Ord e, Ord a) => Ord (Validation e a) Source |
(Show e, Show a) => Show (Validation e a) Source |
Monoid e => Monoid (Validation e a) Source |
Semigroup e => Semigroup (Validation e a) Source |

_Success :: Prism (Validation c a) (Validation c b) a b Source

_Failure :: Prism (Validation a c) (Validation b c) a b Source

eitherToValidation :: Either e a -> Validation e a Source

validationToEither :: Validation e a -> Either e a Source

_Validation :: Iso (Validation e a) (Validation g b) (Either e a) (Either g b) Source

`Validation` is isomorphic to `Either`