plutus-tx-1.36.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusTx.Either

Synopsis

Documentation

data Either a b Source #

The Either type represents values with two possibilities: a value of type Either a b is either Left a or Right b.

The Either type is sometimes used to represent a value which is either correct or an error; by convention, the Left constructor is used to hold an error value and the Right constructor is used to hold a correct value (mnemonic: "right" also means "correct").

Examples

Expand

The type Either String Int is the type of values which can be either a String or an Int. The Left constructor can be used only on Strings, and the Right constructor can be used only on Ints:

>>> let s = Left "foo" :: Either String Int
>>> s
Left "foo"
>>> let n = Right 3 :: Either String Int
>>> n
Right 3
>>> :type s
s :: Either String Int
>>> :type n
n :: Either String Int

The fmap from our Functor instance will ignore Left values, but will apply the supplied function to values contained in a Right:

>>> let s = Left "foo" :: Either String Int
>>> let n = Right 3 :: Either String Int
>>> fmap (*2) s
Left "foo"
>>> fmap (*2) n
Right 6

The Monad instance for Either allows us to chain together multiple actions which may fail, and fail overall if any of the individual steps failed. First we'll write a function that can either parse an Int from a Char, or fail.

>>> import Data.Char ( digitToInt, isDigit )
>>> :{
    let parseEither :: Char -> Either String Int
        parseEither c
          | isDigit c = Right (digitToInt c)
          | otherwise = Left "parse error"
>>> :}

The following should work, since both '1' and '2' can be parsed as Ints.

>>> :{
    let parseMultiple :: Either String Int
        parseMultiple = do
          x <- parseEither '1'
          y <- parseEither '2'
          return (x + y)
>>> :}
>>> parseMultiple
Right 3

But the following should fail overall, since the first operation where we attempt to parse 'm' as an Int will fail:

>>> :{
    let parseMultiple :: Either String Int
        parseMultiple = do
          x <- parseEither 'm'
          y <- parseEither '2'
          return (x + y)
>>> :}
>>> parseMultiple
Left "parse error"

Constructors

Left a 
Right b 

Instances

Instances details
FromJSON2 Either 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSON2Maybe a → (ValueParser a) → (ValueParser [a]) → Maybe b → (ValueParser b) → (ValueParser [b]) → ValueParser (Either a b) Source #

liftParseJSONList2Maybe a → (ValueParser a) → (ValueParser [a]) → Maybe b → (ValueParser b) → (ValueParser [b]) → ValueParser [Either a b] Source #

liftOmittedField2Maybe a → Maybe b → Maybe (Either a b) Source #

ToJSON2 Either 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON2 ∷ (a → Bool) → (a → Value) → ([a] → Value) → (b → Bool) → (b → Value) → ([b] → Value) → Either a b → Value Source #

liftToJSONList2 ∷ (a → Bool) → (a → Value) → ([a] → Value) → (b → Bool) → (b → Value) → ([b] → Value) → [Either a b] → Value Source #

liftToEncoding2 ∷ (a → Bool) → (a → Encoding) → ([a] → Encoding) → (b → Bool) → (b → Encoding) → ([b] → Encoding) → Either a b → Encoding Source #

liftToEncodingList2 ∷ (a → Bool) → (a → Encoding) → ([a] → Encoding) → (b → Bool) → (b → Encoding) → ([b] → Encoding) → [Either a b] → Encoding Source #

liftOmitField2 ∷ (a → Bool) → (b → Bool) → Either a b → Bool Source #

Bifunctor Either

Since: base-4.8.0.0

Instance details

Defined in Data.Bifunctor

Methods

bimap ∷ (a → b) → (c → d) → Either a c → Either b d Source #

first ∷ (a → b) → Either a c → Either b c Source #

second ∷ (b → c) → Either a b → Either a c Source #

NFData2 Either

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf2 ∷ (a → ()) → (b → ()) → Either a b → () Source #

Hashable2 Either 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt2 ∷ (Int → a → Int) → (Int → b → Int) → IntEither a b → Int Source #

Bitraversable1 Either 
Instance details

Defined in Data.Semigroup.Traversable.Class

Methods

bitraverse1Apply f ⇒ (a → f b) → (c → f d) → Either a c → f (Either b d) Source #

bisequence1Apply f ⇒ Either (f a) (f b) → f (Either a b) Source #

Generic1 (Either a ∷ TypeType) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep1 (Either a) ∷ k → Type Source #

Methods

from1 ∷ ∀ (a0 ∷ k). Either a a0 → Rep1 (Either a) a0 Source #

to1 ∷ ∀ (a0 ∷ k). Rep1 (Either a) a0 → Either a a0 Source #

MonadError e (Either e) 
Instance details

Defined in Control.Monad.Error.Class

Methods

throwError ∷ e → Either e a Source #

catchErrorEither e a → (e → Either e a) → Either e a Source #

(Typeable DefaultUni a, Typeable DefaultUni b, Lift DefaultUni a, Lift DefaultUni b) ⇒ Lift DefaultUni (Either a b) Source # 
Instance details

Defined in PlutusTx.Lift.Instances

Methods

liftEither a b → RTCompile DefaultUni fun (Term TyName Name DefaultUni fun ()) Source #

(Lift a, Lift b) ⇒ Lift (Either a b ∷ Type) 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftQuote m ⇒ Either a b → m Exp Source #

liftTyped ∷ ∀ (m ∷ TypeType). Quote m ⇒ Either a b → Code m (Either a b) Source #

FromJSON a ⇒ FromJSON1 (Either a) 
Instance details

Defined in Data.Aeson.Types.FromJSON

Methods

liftParseJSONMaybe a0 → (ValueParser a0) → (ValueParser [a0]) → ValueParser (Either a a0) Source #

liftParseJSONListMaybe a0 → (ValueParser a0) → (ValueParser [a0]) → ValueParser [Either a a0] Source #

liftOmittedFieldMaybe a0 → Maybe (Either a a0) Source #

ToJSON a ⇒ ToJSON1 (Either a) 
Instance details

Defined in Data.Aeson.Types.ToJSON

Methods

liftToJSON ∷ (a0 → Bool) → (a0 → Value) → ([a0] → Value) → Either a a0 → Value Source #

liftToJSONList ∷ (a0 → Bool) → (a0 → Value) → ([a0] → Value) → [Either a a0] → Value Source #

liftToEncoding ∷ (a0 → Bool) → (a0 → Encoding) → ([a0] → Encoding) → Either a a0 → Encoding Source #

liftToEncodingList ∷ (a0 → Bool) → (a0 → Encoding) → ([a0] → Encoding) → [Either a a0] → Encoding Source #

liftOmitField ∷ (a0 → Bool) → Either a a0 → Bool Source #

Foldable (Either a)

Since: base-4.7.0.0

Instance details

Defined in Data.Foldable

Methods

foldMonoid m ⇒ Either a m → m Source #

foldMapMonoid m ⇒ (a0 → m) → Either a a0 → m Source #

foldMap'Monoid m ⇒ (a0 → m) → Either a a0 → m Source #

foldr ∷ (a0 → b → b) → b → Either a a0 → b Source #

foldr' ∷ (a0 → b → b) → b → Either a a0 → b Source #

foldl ∷ (b → a0 → b) → b → Either a a0 → b Source #

foldl' ∷ (b → a0 → b) → b → Either a a0 → b Source #

foldr1 ∷ (a0 → a0 → a0) → Either a a0 → a0 Source #

foldl1 ∷ (a0 → a0 → a0) → Either a a0 → a0 Source #

toListEither a a0 → [a0] Source #

nullEither a a0 → Bool Source #

lengthEither a a0 → Int Source #

elemEq a0 ⇒ a0 → Either a a0 → Bool Source #

maximumOrd a0 ⇒ Either a a0 → a0 Source #

minimumOrd a0 ⇒ Either a a0 → a0 Source #

sumNum a0 ⇒ Either a a0 → a0 Source #

productNum a0 ⇒ Either a a0 → a0 Source #

Traversable (Either a)

Since: base-4.7.0.0

Instance details

Defined in Data.Traversable

Methods

traverseApplicative f ⇒ (a0 → f b) → Either a a0 → f (Either a b) Source #

sequenceAApplicative f ⇒ Either a (f a0) → f (Either a a0) Source #

mapMMonad m ⇒ (a0 → m b) → Either a a0 → m (Either a b) Source #

sequenceMonad m ⇒ Either a (m a0) → m (Either a a0) Source #

Applicative (Either e)

Since: base-3.0

Instance details

Defined in Data.Either

Methods

pure ∷ a → Either e a Source #

(<*>)Either e (a → b) → Either e a → Either e b Source #

liftA2 ∷ (a → b → c) → Either e a → Either e b → Either e c Source #

(*>)Either e a → Either e b → Either e b Source #

(<*)Either e a → Either e b → Either e a Source #

Functor (Either a)

Since: base-3.0

Instance details

Defined in Data.Either

Methods

fmap ∷ (a0 → b) → Either a a0 → Either a b Source #

(<$) ∷ a0 → Either a b → Either a a0 Source #

Monad (Either e)

Since: base-4.4.0.0

Instance details

Defined in Data.Either

Methods

(>>=)Either e a → (a → Either e b) → Either e b Source #

(>>)Either e a → Either e b → Either e b Source #

return ∷ a → Either e a Source #

MonadFailure (Either a) 
Instance details

Defined in Basement.Monad

Associated Types

type Failure (Either a)

Methods

mFail ∷ Failure (Either a) → Either a ()

NFData a ⇒ NFData1 (Either a)

Since: deepseq-1.4.3.0

Instance details

Defined in Control.DeepSeq

Methods

liftRnf ∷ (a0 → ()) → Either a a0 → () Source #

Hashable a ⇒ Hashable1 (Either a) 
Instance details

Defined in Data.Hashable.Class

Methods

liftHashWithSalt ∷ (Int → a0 → Int) → IntEither a a0 → Int Source #

Applicative (Either a) Source # 
Instance details

Defined in PlutusTx.Applicative

Methods

pure ∷ a0 → Either a a0 Source #

(<*>)Either a (a0 → b) → Either a a0 → Either a b Source #

Foldable (Either c) Source # 
Instance details

Defined in PlutusTx.Foldable

Methods

foldr ∷ (a → b → b) → b → Either c a → b Source #

Functor (Either c) Source # 
Instance details

Defined in PlutusTx.Functor

Methods

fmap ∷ (a → b) → Either c a → Either c b Source #

Traversable (Either c) Source # 
Instance details

Defined in PlutusTx.Traversable

Methods

traverseApplicative f ⇒ (a → f b) → Either c a → f (Either c b) Source #

MonadBaseControl (Either e) (Either e) 
Instance details

Defined in Control.Monad.Trans.Control

Associated Types

type StM (Either e) a

Methods

liftBaseWith ∷ (RunInBase (Either e) (Either e) → Either e a) → Either e a

restoreM ∷ StM (Either e) a → Either e a

(FromJSON a, FromJSON b) ⇒ FromJSON (Either a b) 
Instance details

Defined in Data.Aeson.Types.FromJSON

(ToJSON a, ToJSON b) ⇒ ToJSON (Either a b) 
Instance details

Defined in Data.Aeson.Types.ToJSON

(Data a, Data b) ⇒ Data (Either a b)

Since: base-4.0.0.0

Instance details

Defined in Data.Data

Methods

gfoldl ∷ (∀ d b0. Data d ⇒ c (d → b0) → d → c b0) → (∀ g. g → c g) → Either a b → c (Either a b) Source #

gunfold ∷ (∀ b0 r. Data b0 ⇒ c (b0 → r) → c r) → (∀ r. r → c r) → Constr → c (Either a b) Source #

toConstrEither a b → Constr Source #

dataTypeOfEither a b → DataType Source #

dataCast1Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c (Either a b)) Source #

dataCast2Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c (Either a b)) Source #

gmapT ∷ (∀ b0. Data b0 ⇒ b0 → b0) → Either a b → Either a b Source #

gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → Either a b → r Source #

gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → Either a b → r Source #

gmapQ ∷ (∀ d. Data d ⇒ d → u) → Either a b → [u] Source #

gmapQiInt → (∀ d. Data d ⇒ d → u) → Either a b → u Source #

gmapMMonad m ⇒ (∀ d. Data d ⇒ d → m d) → Either a b → m (Either a b) Source #

gmapMpMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → Either a b → m (Either a b) Source #

gmapMoMonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → Either a b → m (Either a b) Source #

Semigroup (Either a b)

Since: base-4.9.0.0

Instance details

Defined in Data.Either

Methods

(<>)Either a b → Either a b → Either a b Source #

sconcatNonEmpty (Either a b) → Either a b Source #

stimesIntegral b0 ⇒ b0 → Either a b → Either a b Source #

Generic (Either a b) 
Instance details

Defined in GHC.Generics

Associated Types

type Rep (Either a b) ∷ TypeType Source #

Methods

fromEither a b → Rep (Either a b) x Source #

toRep (Either a b) x → Either a b Source #

(Read a, Read b) ⇒ Read (Either a b)

Since: base-3.0

Instance details

Defined in Data.Either

(Show a, Show b) ⇒ Show (Either a b)

Since: base-3.0

Instance details

Defined in Data.Either

Methods

showsPrecIntEither a b → ShowS Source #

showEither a b → String Source #

showList ∷ [Either a b] → ShowS Source #

(NFData a, NFData b) ⇒ NFData (Either a b) 
Instance details

Defined in Control.DeepSeq

Methods

rnfEither a b → () Source #

(Eq a, Eq b) ⇒ Eq (Either a b)

Since: base-2.1

Instance details

Defined in Data.Either

Methods

(==)Either a b → Either a b → Bool Source #

(/=)Either a b → Either a b → Bool Source #

(Ord a, Ord b) ⇒ Ord (Either a b)

Since: base-2.1

Instance details

Defined in Data.Either

Methods

compareEither a b → Either a b → Ordering Source #

(<)Either a b → Either a b → Bool Source #

(<=)Either a b → Either a b → Bool Source #

(>)Either a b → Either a b → Bool Source #

(>=)Either a b → Either a b → Bool Source #

maxEither a b → Either a b → Either a b Source #

minEither a b → Either a b → Either a b Source #

(Hashable a, Hashable b) ⇒ Hashable (Either a b) 
Instance details

Defined in Data.Hashable.Class

Methods

hashWithSaltIntEither a b → Int Source #

hashEither a b → Int Source #

MonoFoldable (Either a b) 
Instance details

Defined in Data.MonoTraversable

Methods

ofoldMapMonoid m ⇒ (Element (Either a b) → m) → Either a b → m Source #

ofoldr ∷ (Element (Either a b) → b0 → b0) → b0 → Either a b → b0 Source #

ofoldl' ∷ (a0 → Element (Either a b) → a0) → a0 → Either a b → a0 Source #

otoListEither a b → [Element (Either a b)] Source #

oall ∷ (Element (Either a b) → Bool) → Either a b → Bool Source #

oany ∷ (Element (Either a b) → Bool) → Either a b → Bool Source #

onullEither a b → Bool Source #

olengthEither a b → Int Source #

olength64Either a b → Int64 Source #

ocompareLengthIntegral i ⇒ Either a b → i → Ordering Source #

otraverse_Applicative f ⇒ (Element (Either a b) → f b0) → Either a b → f () Source #

ofor_Applicative f ⇒ Either a b → (Element (Either a b) → f b0) → f () Source #

omapM_Applicative m ⇒ (Element (Either a b) → m ()) → Either a b → m () Source #

oforM_Applicative m ⇒ Either a b → (Element (Either a b) → m ()) → m () Source #

ofoldlMMonad m ⇒ (a0 → Element (Either a b) → m a0) → a0 → Either a b → m a0 Source #

ofoldMap1ExSemigroup m ⇒ (Element (Either a b) → m) → Either a b → m Source #

ofoldr1Ex ∷ (Element (Either a b) → Element (Either a b) → Element (Either a b)) → Either a b → Element (Either a b) Source #

ofoldl1Ex' ∷ (Element (Either a b) → Element (Either a b) → Element (Either a b)) → Either a b → Element (Either a b) Source #

headExEither a b → Element (Either a b) Source #

lastExEither a b → Element (Either a b) Source #

unsafeHeadEither a b → Element (Either a b) Source #

unsafeLastEither a b → Element (Either a b) Source #

maximumByEx ∷ (Element (Either a b) → Element (Either a b) → Ordering) → Either a b → Element (Either a b) Source #

minimumByEx ∷ (Element (Either a b) → Element (Either a b) → Ordering) → Either a b → Element (Either a b) Source #

oelemElement (Either a b) → Either a b → Bool Source #

onotElemElement (Either a b) → Either a b → Bool Source #

MonoFunctor (Either a b) 
Instance details

Defined in Data.MonoTraversable

Methods

omap ∷ (Element (Either a b) → Element (Either a b)) → Either a b → Either a b Source #

MonoPointed (Either a b) 
Instance details

Defined in Data.MonoTraversable

Methods

opointElement (Either a b) → Either a b Source #

MonoTraversable (Either a b) 
Instance details

Defined in Data.MonoTraversable

Methods

otraverseApplicative f ⇒ (Element (Either a b) → f (Element (Either a b))) → Either a b → f (Either a b) Source #

omapMApplicative m ⇒ (Element (Either a b) → m (Element (Either a b))) → Either a b → m (Either a b) Source #

(Eq a, Eq b) ⇒ Eq (Either a b) Source # 
Instance details

Defined in PlutusTx.Eq

Methods

(==)Either a b → Either a b → Bool Source #

(FromData a, FromData b) ⇒ FromData (Either a b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(ToData a, ToData b) ⇒ ToData (Either a b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(UnsafeFromData a, UnsafeFromData b) ⇒ UnsafeFromData (Either a b) Source # 
Instance details

Defined in PlutusTx.IsData.Instances

(Ord a, Ord b) ⇒ Ord (Either a b) Source # 
Instance details

Defined in PlutusTx.Ord

Methods

compareEither a b → Either a b → Ordering Source #

(<)Either a b → Either a b → Bool Source #

(<=)Either a b → Either a b → Bool Source #

(>)Either a b → Either a b → Bool Source #

(>=)Either a b → Either a b → Bool Source #

maxEither a b → Either a b → Either a b Source #

minEither a b → Either a b → Either a b Source #

(Show a, Show b) ⇒ Show (Either a b) Source # 
Instance details

Defined in PlutusTx.Show

Methods

showsPrecIntegerEither a b → ShowS Source #

showEither a b → BuiltinString Source #

Corecursive (Either a b) 
Instance details

Defined in Data.Functor.Foldable

Methods

embedBase (Either a b) (Either a b) → Either a b Source #

ana ∷ (a0 → Base (Either a b) a0) → a0 → Either a b Source #

apo ∷ (a0 → Base (Either a b) (Either (Either a b) a0)) → a0 → Either a b Source #

postproRecursive (Either a b) ⇒ (∀ b0. Base (Either a b) b0 → Base (Either a b) b0) → (a0 → Base (Either a b) a0) → a0 → Either a b Source #

gpostpro ∷ (Recursive (Either a b), Monad m) ⇒ (∀ b0. m (Base (Either a b) b0) → Base (Either a b) (m b0)) → (∀ c. Base (Either a b) c → Base (Either a b) c) → (a0 → Base (Either a b) (m a0)) → a0 → Either a b Source #

Recursive (Either a b) 
Instance details

Defined in Data.Functor.Foldable

Methods

projectEither a b → Base (Either a b) (Either a b) Source #

cata ∷ (Base (Either a b) a0 → a0) → Either a b → a0 Source #

para ∷ (Base (Either a b) (Either a b, a0) → a0) → Either a b → a0 Source #

gpara ∷ (Corecursive (Either a b), Comonad w) ⇒ (∀ b0. Base (Either a b) (w b0) → w (Base (Either a b) b0)) → (Base (Either a b) (EnvT (Either a b) w a0) → a0) → Either a b → a0 Source #

preproCorecursive (Either a b) ⇒ (∀ b0. Base (Either a b) b0 → Base (Either a b) b0) → (Base (Either a b) a0 → a0) → Either a b → a0 Source #

gprepro ∷ (Corecursive (Either a b), Comonad w) ⇒ (∀ b0. Base (Either a b) (w b0) → w (Base (Either a b) b0)) → (∀ c. Base (Either a b) c → Base (Either a b) c) → (Base (Either a b) (w a0) → a0) → Either a b → a0 Source #

(Serialise a, Serialise b) ⇒ Serialise (Either a b)

Since: serialise-0.2.0.0

Instance details

Defined in Codec.Serialise.Class

(HasBlueprintDefinition a, HasSchemaDefinition a referencedTypes, HasBlueprintDefinition b, HasSchemaDefinition b referencedTypes) ⇒ HasBlueprintSchema (Either a b) referencedTypes Source # 
Instance details

Defined in PlutusTx.IsData.Instances

Methods

schemaSchema referencedTypes Source #

Typeable DefaultUni Either Source # 
Instance details

Defined in PlutusTx.Lift.Instances

(a ~ a', b ~ b') ⇒ Each (Either a a') (Either b b') a b 
Instance details

Defined in Control.Lens.Each

Methods

each ∷ Traversal (Either a a') (Either b b') a b

(a ~ a', b ~ b') ⇒ Each (Either a a') (Either b b') a b

Since: microlens-0.4.11

Instance details

Defined in Lens.Micro.Internal

Methods

eachTraversal (Either a a') (Either b b') a b Source #

(FoldableWithIndex i f, FoldableWithIndex j g) ⇒ FoldableWithIndex (Either i j) (Product f g) 
Instance details

Defined in WithIndex

Methods

ifoldMapMonoid m ⇒ (Either i j → a → m) → Product f g a → m

ifoldMap'Monoid m ⇒ (Either i j → a → m) → Product f g a → m

ifoldr ∷ (Either i j → a → b → b) → b → Product f g a → b

ifoldl ∷ (Either i j → b → a → b) → b → Product f g a → b

ifoldr' ∷ (Either i j → a → b → b) → b → Product f g a → b

ifoldl' ∷ (Either i j → b → a → b) → b → Product f g a → b

(FoldableWithIndex i f, FoldableWithIndex j g) ⇒ FoldableWithIndex (Either i j) (Sum f g) 
Instance details

Defined in WithIndex

Methods

ifoldMapMonoid m ⇒ (Either i j → a → m) → Sum f g a → m

ifoldMap'Monoid m ⇒ (Either i j → a → m) → Sum f g a → m

ifoldr ∷ (Either i j → a → b → b) → b → Sum f g a → b

ifoldl ∷ (Either i j → b → a → b) → b → Sum f g a → b

ifoldr' ∷ (Either i j → a → b → b) → b → Sum f g a → b

ifoldl' ∷ (Either i j → b → a → b) → b → Sum f g a → b

(FoldableWithIndex i f, FoldableWithIndex j g) ⇒ FoldableWithIndex (Either i j) (f :*: g) 
Instance details

Defined in WithIndex

Methods

ifoldMapMonoid m ⇒ (Either i j → a → m) → (f :*: g) a → m

ifoldMap'Monoid m ⇒ (Either i j → a → m) → (f :*: g) a → m

ifoldr ∷ (Either i j → a → b → b) → b → (f :*: g) a → b

ifoldl ∷ (Either i j → b → a → b) → b → (f :*: g) a → b

ifoldr' ∷ (Either i j → a → b → b) → b → (f :*: g) a → b

ifoldl' ∷ (Either i j → b → a → b) → b → (f :*: g) a → b

(FoldableWithIndex i f, FoldableWithIndex j g) ⇒ FoldableWithIndex (Either i j) (f :+: g) 
Instance details

Defined in WithIndex

Methods

ifoldMapMonoid m ⇒ (Either i j → a → m) → (f :+: g) a → m

ifoldMap'Monoid m ⇒ (Either i j → a → m) → (f :+: g) a → m

ifoldr ∷ (Either i j → a → b → b) → b → (f :+: g) a → b

ifoldl ∷ (Either i j → b → a → b) → b → (f :+: g) a → b

ifoldr' ∷ (Either i j → a → b → b) → b → (f :+: g) a → b

ifoldl' ∷ (Either i j → b → a → b) → b → (f :+: g) a → b

(FunctorWithIndex i f, FunctorWithIndex j g) ⇒ FunctorWithIndex (Either i j) (Product f g) 
Instance details

Defined in WithIndex

Methods

imap ∷ (Either i j → a → b) → Product f g a → Product f g b

(FunctorWithIndex i f, FunctorWithIndex j g) ⇒ FunctorWithIndex (Either i j) (Sum f g) 
Instance details

Defined in WithIndex

Methods

imap ∷ (Either i j → a → b) → Sum f g a → Sum f g b

(FunctorWithIndex i f, FunctorWithIndex j g) ⇒ FunctorWithIndex (Either i j) (f :*: g) 
Instance details

Defined in WithIndex

Methods

imap ∷ (Either i j → a → b) → (f :*: g) a → (f :*: g) b

(FunctorWithIndex i f, FunctorWithIndex j g) ⇒ FunctorWithIndex (Either i j) (f :+: g) 
Instance details

Defined in WithIndex

Methods

imap ∷ (Either i j → a → b) → (f :+: g) a → (f :+: g) b

(TraversableWithIndex i f, TraversableWithIndex j g) ⇒ TraversableWithIndex (Either i j) (Product f g) 
Instance details

Defined in WithIndex

Methods

itraverseApplicative f0 ⇒ (Either i j → a → f0 b) → Product f g a → f0 (Product f g b)

(TraversableWithIndex i f, TraversableWithIndex j g) ⇒ TraversableWithIndex (Either i j) (Sum f g) 
Instance details

Defined in WithIndex

Methods

itraverseApplicative f0 ⇒ (Either i j → a → f0 b) → Sum f g a → f0 (Sum f g b)

(TraversableWithIndex i f, TraversableWithIndex j g) ⇒ TraversableWithIndex (Either i j) (f :*: g) 
Instance details

Defined in WithIndex

Methods

itraverseApplicative f0 ⇒ (Either i j → a → f0 b) → (f :*: g) a → f0 ((f :*: g) b)

(TraversableWithIndex i f, TraversableWithIndex j g) ⇒ TraversableWithIndex (Either i j) (f :+: g) 
Instance details

Defined in WithIndex

Methods

itraverseApplicative f0 ⇒ (Either i j → a → f0 b) → (f :+: g) a → f0 ((f :+: g) b)

type Rep1 (Either a ∷ TypeType)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Failure (Either a) 
Instance details

Defined in Basement.Monad

type Failure (Either a) = a
type StM (Either e) a 
Instance details

Defined in Control.Monad.Trans.Control

type StM (Either e) a = a
type Rep (Either a b)

Since: base-4.6.0.0

Instance details

Defined in GHC.Generics

type Element (Either a b) 
Instance details

Defined in Data.MonoTraversable

type Element (Either a b) = b
type Base (Either a b)

Example boring stub for non-recursive data types

Instance details

Defined in Data.Functor.Foldable

type Base (Either a b) = Const (Either a b) ∷ TypeType

isLeftEither a b → Bool Source #

Return True if the given value is a Left-value, False otherwise.

isRightEither a b → Bool Source #

Return True if the given value is a Right-value, False otherwise.

either ∷ (a → c) → (b → c) → Either a b → c Source #

Plutus Tx version of either