!CAc     (c) Dennis Gosnell, 2016BSD-style (see LICENSE file)cdep.illabout@gmail.com experimentalPOSIXSafe@from-sumA monadic version of  .   leftAction ===  leftAction  (fromEitherM (\s -> [length s]) $ Right 5[5]7fromEitherM (\s -> [length s]) $ Left ("foo" :: String)[3]from-sumA ed version of .*fromEitherOrM (Right 5) $ \s -> [length s][5],This can be nice to use as an error handler.FfromEitherOrM (Right 5) $ \s -> putStrLn ("error: " ++ s) >> undefined5IfromEitherOrM (Left "foo") $ \s -> putStrLn ("error: " ++ s) >> undefined error: foo...from-sum Similar to , but only run the monadic  leftAction if the  argument is . Otherwise, return  .   leftAction ===  leftAction (   ) ;fromEitherM_ (\err -> putStrLn err >> pure "bye") $ Right 5""MfromEitherM_ (\err -> putStrLn err >> pure "bye") $ Left "there was an error"there was an error"bye"WThis can be convenient when you want to run some sort of logging function whenever an  is +. If you imagine the logging function is b ->  '()', then the effective type of  becomes  :: (e ->  '()') ->  e a ->  '()', because '()' has a  instance, and  , has an  instance.1fromEitherM_ putStrLn $ Left "there was an error"there was an errorfrom-sumA ed version of .from-sumA monadic version of .   nothingAction ===   nothingAction  fromMaybeM [] $ Just 5[5]fromMaybeM [] Nothing[]from-sumA ed version of .fromMaybeOrM (Just 5) [][5],This can be nice to use as an error handler.CfromMaybeOrM (Just 5) $ putStrLn "some error occurred" >> undefined5DfromMaybeOrM (Nothing) $ putStrLn "some error occurred" >> undefinedsome error occurred...from-sum Similar to , but only run the monadic  nothingAction if the ! argument is ". Otherwise, return  .   nothingAction ===   nothingAction (   ) 5fromMaybeM_ (putStrLn "hello" >> pure "bye") $ Just 5""4fromMaybeM_ (putStrLn "hello" >> pure "bye") Nothinghello"bye"VThis can be convenient when you want to run some sort of logging function whenever a ! is "+. If you imagine the logging function is  '()', then the effective type of  becomes  ::  '()' -> ! a ->  '()', because '()' has a  instance, and  , has an  instance.&fromMaybeM_ (putStrLn "hello") Nothinghellofrom-sumA ed version of . from-sum Similar to  but the " argument is also a monadic value.3fromEitherMM (\s -> [length s]) [Right 5, Right 10][5,10]CfromEitherMM (\s -> [length s]) [Left ("foo" :: String), Right 100][3,100]NOTE: I don't particularly like the name of this function. If you have a suggestion for a better name, please submit a PR or issue. from-sumA ed version of  . from-sum Similar to  but the !" argument is also a monadic value.fromMaybeMM [] [Just 6, Just 5][6,5](fromMaybeMM [] [Just 6, Nothing, Just 7][6,7]NOTE: I don't particularly like the name of this function. If you have a suggestion for a better name, please submit a PR or issue. from-sumA ed version of  . from-sum Similar to .fromEither show $ Left 5"5"fromEither show $ Right "hello""hello"from-sumA ed version of  .from-sumA ed version of .from-sum Collapse an  a a to an a. Defined as   #..Note: Other libraries export this function as  fromEither , but our  # function is slightly more general.collapseEither (Right 3)3collapseEither (Left "hello")"hello"from-sum Similar to  , but for $.4import Control.Monad.Trans.Except (ExceptT(ExceptT))*collapseExceptT (ExceptT $ pure (Right 3))3/collapseExceptT (ExceptT $ pure (Left "hello"))"hello"from-sum Convert a ! to an .If the ! is %, then return the value in &.maybeToEither 3 $ Just "hello" Right "hello"If the ! is ", then use the given e as .maybeToEither 3 NothingLeft 3from-sumA ed version of . maybeToEitherOr (Just "hello") 3 Right "hello"maybeToEitherOr Nothing 3Left 3from-sum Convert an  to a !.A & value becomes %.eitherToMaybe $ Right 3Just 3A  value becomes ".eitherToMaybe $ Left "bye"Nothing  '      !"#$%&'()*)+,-./)012'from-sum-0.2.2.0-JJioJyzxnnAD8WrqjqTG3aControl.FromSumbase Data.Maybe fromMaybe fromEitherM fromEitherOrM fromEitherM_fromEitherOrM_ fromMaybeM fromMaybeOrM fromMaybeM_ fromMaybeOrM_ fromEitherMMfromEitherOrMM fromMaybeMM fromMaybeOrMM fromEither fromEitherOr fromMaybeOrcollapseEithercollapseExceptT maybeToEithermaybeToEitherOr eitherToMaybe Data.EithereitherGHC.BasepureflipEitherLeftmemptyconst$ghc-prim GHC.TypesIOMonoid Applicativemaybe GHC.MaybeMaybeNothingidtransformers-0.5.5.0Control.Monad.Trans.ExceptExceptTJustRight