prosidyc-0.3.0.0: A DSL for processing Prosidy documents.
Copyright©2020 James Alexander Feldman-Crough
LicenseMPL-2.0
Maintaineralex@fldcr.com
Safe HaskellSafe
LanguageHaskell2010

Data.Either.Valid

Description

 
Synopsis

Documentation

data Valid e a Source #

Like the Either type, but its instances accumulates its errors. As such, there is no Monad instance for Valid.

The Invalid constructor takes precedence over Valid when used with classes that combine two values.

Note: There are a lot of packages that implement this data type, but finding a well-maintained one with minimal dependencies proved difficult.

Constructors

Invalid !e 
Valid !a 

Instances

Instances details
Bifunctor Valid Source # 
Instance details

Defined in Data.Either.Valid

Methods

bimap :: (a -> b) -> (c -> d) -> Valid a c -> Valid b d #

first :: (a -> b) -> Valid a c -> Valid b c #

second :: (b -> c) -> Valid a b -> Valid a c #

Functor (Valid e) Source # 
Instance details

Defined in Data.Either.Valid

Methods

fmap :: (a -> b) -> Valid e a -> Valid e b #

(<$) :: a -> Valid e b -> Valid e a #

Semigroup e => Applicative (Valid e) Source # 
Instance details

Defined in Data.Either.Valid

Methods

pure :: a -> Valid e a #

(<*>) :: Valid e (a -> b) -> Valid e a -> Valid e b #

liftA2 :: (a -> b -> c) -> Valid e a -> Valid e b -> Valid e c #

(*>) :: Valid e a -> Valid e b -> Valid e b #

(<*) :: Valid e a -> Valid e b -> Valid e a #

Monoid e => Alternative (Valid e) Source # 
Instance details

Defined in Data.Either.Valid

Methods

empty :: Valid e a #

(<|>) :: Valid e a -> Valid e a -> Valid e a #

some :: Valid e a -> Valid e [a] #

many :: Valid e a -> Valid e [a] #

(Eq e, Eq a) => Eq (Valid e a) Source # 
Instance details

Defined in Data.Either.Valid

Methods

(==) :: Valid e a -> Valid e a -> Bool #

(/=) :: Valid e a -> Valid e a -> Bool #

(Ord e, Ord a) => Ord (Valid e a) Source # 
Instance details

Defined in Data.Either.Valid

Methods

compare :: Valid e a -> Valid e a -> Ordering #

(<) :: Valid e a -> Valid e a -> Bool #

(<=) :: Valid e a -> Valid e a -> Bool #

(>) :: Valid e a -> Valid e a -> Bool #

(>=) :: Valid e a -> Valid e a -> Bool #

max :: Valid e a -> Valid e a -> Valid e a #

min :: Valid e a -> Valid e a -> Valid e a #

(Show e, Show a) => Show (Valid e a) Source # 
Instance details

Defined in Data.Either.Valid

Methods

showsPrec :: Int -> Valid e a -> ShowS #

show :: Valid e a -> String #

showList :: [Valid e a] -> ShowS #

(Semigroup e, Semigroup a) => Semigroup (Valid e a) Source # 
Instance details

Defined in Data.Either.Valid

Methods

(<>) :: Valid e a -> Valid e a -> Valid e a #

sconcat :: NonEmpty (Valid e a) -> Valid e a #

stimes :: Integral b => b -> Valid e a -> Valid e a #

(Semigroup e, Monoid a) => Monoid (Valid e a) Source # 
Instance details

Defined in Data.Either.Valid

Methods

mempty :: Valid e a #

mappend :: Valid e a -> Valid e a -> Valid e a #

mconcat :: [Valid e a] -> Valid e a #

fromEither :: Either e a -> Valid e a Source #

Convert an Either value to Valid.

toEither :: Valid e a -> Either e a Source #

Convert a Valid value to Either.

valid :: (e -> r) -> (a -> r) -> Valid e a -> r Source #

Consume a Valid by handling errors and valid values.