# from-sum

Combinators for working with Maybe and Either https://github.com/cdepillabout/from-sum

 LTS Haskell 15.0: 0.2.3.0 Stackage Nightly 2020-02-17: 0.2.3.0 Latest on Hackage: 0.2.3.0

See all snapshots from-sum appears in

#### Module documentation for 0.2.3.0

This version can be pinned in stack with:from-sum-0.2.3.0@sha256:b2c64e1e2073f6cfb9b69a6205606042d9dcb3b2742a7d598f574ba62f5de4ad,1321
• Control

# Control.FromSum

This Haskell module exports the fromEitherM and fromMaybeM convenience functions.

fromMaybeM :: m a -> Maybe a -> m a

fromEitherM :: (e -> m a) -> Either e a -> m a

fromEitherM leftAction eitherValue is the same as either leftAction pure eitherValue.

fromMaybeM nothingAction maybeValue is the same as maybe nothingAction pure maybeValue.

## Usage

>>> import Control.FromSum (fromEitherM, fromMaybeM)
>>> fromMaybeM [] \$ Just 5
[5]
>>> fromMaybeM [] Nothing
[]
>>> fromEitherM (\s -> [length s]) \$ Right 5
[5]
>>> fromEitherM (\s -> [length s]) \$ Left "foo"
[3]

## 0.2.3.0

• Add functions collapseErrExceptT, liftEitherExceptT, fromEitherExceptT, fromEitherOrExceptT, fromEitherMExceptT, fromEitherOrMExceptT, fromMaybeExceptT, fromMaybeOrExceptT, fromMaybeMExceptT, fromMaybeOrMExceptT, guardExceptT, and guardMExceptT. These functions help convert Maybe, Either, and Bool to ExceptT. #2

## 0.2.2.0

• Added new functions maybeToEither, maybeToEitherOr, and eitherToMaybe for converting between Maybe and Either. #1
Depends on 2 packages(full list with versions):
Used by 1 package in nightly-2020-02-14(full list with versions):