-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Essentially the Maybe type with error messages. -- -- This is a very simple type: -- --
--   data Exceptional x
--     = Failure String
--     | Success x
--   
-- -- It's much like Maybe, except instead of Nothing, we -- have Failure String. -- -- A comparison could also be made to Either String. I made this -- library because I was dissatisfied with the Monad instance -- for Either. In this type, fail = Failure. It's -- rather simple. @package exceptional @version 0.1.4.2 module Control.Exceptional -- | This is basically specialized 'Either String', or Maybe with -- error messages. data Exceptional x [Failure] :: String -> Exceptional x [Success] :: x -> Exceptional x -- | This is fail-safe, so to speak. That is, -- --
--   fail = Failure
--   
-- | Convert Exceptional into another Monad. If you don't -- have proper exception handling in your monad, this can throw errors. -- --
--   runExceptional (Failure s) = fail s
--   runExceptional (Success s) = pure s
--   
runExceptional :: Monad m => Exceptional x -> m x -- | Convert a Maybe to an Exceptional -- --
--   fromMaybe s Nothing = fail s
--   fromMaybe s (Just x) = pure x
--   
fromMaybe :: String -> Maybe a -> Exceptional a -- | Convert an Exceptional into a Maybe. This function -- disregards the error message. -- --
--   toMaybe (Success x) = Just x
--   toMaybe (Failure _) = Nothing
--   
toMaybe :: Exceptional a -> Maybe a -- | Convert an Either String to an Exceptional -- --
--   fromEither (Left s) = fail s
--   fromEither (Right x) = pure x
--   
fromEither :: Either String a -> Exceptional a -- | Convert an Exceptional to an Either String -- --
--   toEither (Failure s) = Left s
--   toEither (Success x) = Right x
--   
toEither :: Exceptional a -> Either String a instance Read x => Read (Exceptional x) instance Show x => Show (Exceptional x) instance Eq x => Eq (Exceptional x) instance Functor Exceptional instance Applicative Exceptional instance Alternative Exceptional instance Monad Exceptional