Data.Either.Validation

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

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

Constructors

Failure e |
Success a |

Instances

Bifunctor Validation |
Bitraversable Validation |
Bifoldable Validation |
Functor (Validation e) |
Semigroup e => Applicative (Validation e) |
Foldable (Validation e) |
Traversable (Validation e) |
(Semigroup e, Monoid e) => Alternative (Validation e) |
Alt (Validation e) |
(Eq e, Eq a) => Eq (Validation e a) |
(Ord e, Ord a) => Ord (Validation e a) |
(Show e, Show a) => Show (Validation e a) |
Monoid e => Monoid (Validation e a) |
Semigroup e => Semigroup (Validation e 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)

`Validation` is isomorphic to `Either`