The from-sum package

[Tags:bsd3, library, test]

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.1.0, 0.1.2.0, 0.2.0.0, 0.2.1.0
Dependencies base (>=4.6 && <5), mtl [details]
License BSD3
Copyright 2016 Dennis Gosnell
Author Dennis Gosnell
Maintainer cdep.illabout@gmail.com
Category Control
Home page https://github.com/cdepillabout/from-sum
Source repository head: git clone git@github.com:cdepillabout/from-sum.git
Uploaded Thu Nov 17 07:29:40 UTC 2016 by cdepillabout
Distributions LTSHaskell:0.2.1.0, NixOS:0.2.1.0, Stackage:0.2.1.0, Tumbleweed:0.2.1.0
Downloads 211 total (17 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2016-11-17 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for from-sum

Readme for from-sum-0.2.1.0

Control.FromSum

Build Status Hackage Stackage LTS Stackage Nightly

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]