incipit-base-0.4.0.0: A Prelude for Polysemy – Base Reexports
Safe HaskellSafe-Inferred
LanguageHaskell2010

Incipit.Either

Description

Some utilities for working with Either.

Synopsis

Documentation

leftToMaybe :: Either l r -> Maybe l Source #

Turn Left into Just and Right into Nothing.

rightToMaybe :: Either l r -> Maybe r Source #

Turn Right into Just and Left into Nothing.

maybeToRight :: l -> Maybe r -> Either l r Source #

Turn Just into Right and Nothing into Left with the supplied value.

maybeToLeft :: r -> Maybe l -> Either l r Source #

Turn Just into Left and Nothing into Right with the supplied value.

unify :: Either a a -> a Source #

Extract the value from either side of an Either.

leftA :: Applicative m => (a -> m b) -> Either a b -> m b Source #

Run an applicative action on the Left side of an Either to unify the types.