eithers-0.1.0: Collection of functions for dealing with Either values.

Safe HaskellSafe-Inferred

Eithers

Description

Functions for dealing with Either values.

Synopsis

Documentation

mapEither :: (a -> b1) -> (b -> b2) -> Either a b -> Either b1 b2Source

A map for Either values.

mapLeft :: (a -> b1) -> Either a b2 -> Either b1 b2Source

Map over the left side.

mapRight :: (b -> b2) -> Either b1 b -> Either b1 b2Source

Map over the right side.

leftToMaybe :: Either a b -> Maybe aSource

Maybe get the left side of an Either.

rightToMaybe :: Either a b -> Maybe bSource

Maybe get the right side of an Either.

isLeft :: Either a b -> BoolSource

Is a value Left?

isRight :: Either a b -> BoolSource

Is a value Right?

fromLeft :: a -> Either a b -> aSource

Extract the left value or a default.

fromRight :: b -> Either a b -> bSource

Extract the right value or a default.

whenRight :: Monad m => Either a b -> (b -> m c) -> m ()Source

When a value is Right, do something with it, monadically.

whenLeft :: Monad m => Either a b -> (a -> m c) -> m ()Source

When a value is Left, do something with it, monadically.