Portability | portable |
---|---|

Stability | provisional |

Maintainer | gcross@haskell.org |

Functions for probing and unwrapping values inside of Either.

- isLeft :: Either a b -> Bool
- isRight :: Either a b -> Bool
- fromLeft :: Either a b -> a
- fromRight :: Either a b -> b
- mapBoth :: (a -> c) -> (b -> d) -> Either a b -> Either c d
- mapLeft :: (a -> c) -> Either a b -> Either c b
- mapRight :: (b -> c) -> Either a b -> Either a c
- eitherM :: Monad m => Either a b -> (a -> m c) -> (b -> m c) -> m c
- whenLeft :: Monad m => Either a b -> (a -> m ()) -> m ()
- whenRight :: Monad m => Either a b -> (b -> m ()) -> m ()
- unlessLeft :: Monad m => Either a b -> (b -> m ()) -> m ()
- unlessRight :: Monad m => Either a b -> (a -> m ()) -> m ()

# Documentation

mapBoth :: (a -> c) -> (b -> d) -> Either a b -> Either c dSource

The `mapBoth`

function takes two functions and applies the first if iff the value
takes the form 'Left _' and the second if the value takes the form 'Right _'.

mapLeft :: (a -> c) -> Either a b -> Either c bSource

The `mapLeft`

function takes a function and applies it to an Either value
iff the value takes the form 'Left _'.

mapRight :: (b -> c) -> Either a b -> Either a cSource

The `mapLeft`

function takes a function and applies it to an Either value
iff the value takes the form 'Left _'.