-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Forward-compatible MonadFail class -- -- This package contains the Control.Monad.Fail module providing -- the MonadFail class that became available in -- base-4.9.0.0 for older base package versions. -- -- This package turns into an empty package when used with GHC versions -- which already provide the Control.Monad.Fail module to make way -- for GHC's own Control.Monad.Fail module. @package fail @version 4.9.0.0 -- | Transitional module providing the MonadFail class and primitive -- instances. -- -- This module can be imported for defining forward compatible -- MonadFail instances: -- --
-- import qualified Control.Monad.Fail as Fail
--
-- instance Monad Foo where
-- (>>=) = {- ...bind impl... -}
--
-- -- Provide legacy fail implementation for when
-- -- new-style MonadFail desugaring is not enabled.
-- fail = Fail.fail
--
-- instance Fail.MonadFail Foo where
-- fail = {- ...fail implementation... -}
--
--
-- See
-- https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail
-- for more details.
module Control.Monad.Fail
-- | When a value is bound in do-notation, the pattern on the left
-- hand side of <- might not match. In this case, this class
-- provides a function to recover.
--
-- A Monad without a MonadFail instance may only be used in
-- conjunction with pattern that always match, such as newtypes, tuples,
-- data types with only a single data constructor, and irrefutable
-- patterns (~pat).
--
-- Instances of MonadFail should satisfy the following law:
-- fail s should be a left zero for >>=,
--
-- -- fail s >>= f = fail s ---- -- If your Monad is also MonadPlus, a popular definition -- is -- --
-- fail _ = mzero --class Monad m => MonadFail m fail :: MonadFail m => String -> m a instance Control.Monad.Fail.MonadFail GHC.Base.Maybe instance Control.Monad.Fail.MonadFail [] instance Control.Monad.Fail.MonadFail GHC.Types.IO instance Control.Monad.Fail.MonadFail Text.ParserCombinators.ReadPrec.ReadPrec instance Control.Monad.Fail.MonadFail Text.ParserCombinators.ReadP.ReadP