984     (c) Dennis Gosnell, 2016BSD-style (see LICENSE file)cdep.illabout@gmail.com experimentalPOSIXSafeA monadic version of  .   leftAction ===  leftAction  (fromEitherM (\s -> [length s]) $ Right 5[5]7fromEitherM (\s -> [length s]) $ Left ("foo" :: String)[3]A 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... 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 errorA ed version of .A monadic version of .   nothingAction ===  nothingAction  fromMaybeM [] $ Just 5[5]fromMaybeM [] Nothing[]A 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... 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") NothinghelloA ed version of .  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. A ed version of  .  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. A ed version of  .  Similar to .fromEither show $ Left 5"5"fromEither show $ Right "hello""hello"A ed version of  .A ed version of . 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" Similar to  , but for !..import Control.Monad.Except (ExceptT(ExceptT))*collapseExceptT (ExceptT $ pure (Right 3))3/collapseExceptT (ExceptT $ pure (Left "hello"))"hello"    "      !"#$%&'()*+,'from-sum-0.2.1.0-Dx2zWbvz0Nd55p215TqWmkControl.FromSumbase Data.Maybe fromMaybe fromEitherM fromEitherOrM fromEitherM_fromEitherOrM_ fromMaybeM fromMaybeOrM fromMaybeM_ fromMaybeOrM_ fromEitherMMfromEitherOrMM fromMaybeMM fromMaybeOrMM fromEither fromEitherOr fromMaybeOrcollapseEithercollapseExceptT Data.EithereitherGHC.BasepureflipEitherLeftmemptyconst$ghc-prim GHC.TypesIOMonoid ApplicativemaybeMaybeNothingidtransformers-0.5.2.0Control.Monad.Trans.ExceptExceptT