-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Forward-compatible MonadFail class
--   
--   This package contains the <a>Control.Monad.Fail</a> module providing
--   the <a>MonadFail</a> class that became available in
--   <a>base-4.9.0.0</a> for older <tt>base</tt> package versions.
--   
--   This package turns into an empty package when used with GHC versions
--   which already provide the <a>Control.Monad.Fail</a> module to make way
--   for GHC's own <a>Control.Monad.Fail</a> module.
@package fail
@version 4.9.0.0


-- | Transitional module providing the <a>MonadFail</a> class and primitive
--   instances.
--   
--   This module can be imported for defining forward compatible
--   <a>MonadFail</a> instances:
--   
--   <pre>
--   import qualified Control.Monad.Fail as Fail
--   
--   instance Monad Foo where
--     (&gt;&gt;=) = {- ...bind impl... -}
--   
--     -- Provide legacy <a>fail</a> implementation for when
--     -- new-style MonadFail desugaring is not enabled.
--     fail = Fail.fail
--   
--   instance Fail.MonadFail Foo where
--     fail = {- ...fail implementation... -}
--   </pre>
--   
--   See
--   <a>https://prime.haskell.org/wiki/Libraries/Proposals/MonadFail</a>
--   for more details.
module Control.Monad.Fail

-- | When a value is bound in <tt>do</tt>-notation, the pattern on the left
--   hand side of <tt>&lt;-</tt> might not match. In this case, this class
--   provides a function to recover.
--   
--   A <a>Monad</a> without a <a>MonadFail</a> 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 (<tt>~pat</tt>).
--   
--   Instances of <a>MonadFail</a> should satisfy the following law:
--   <tt>fail s</tt> should be a left zero for <a>&gt;&gt;=</a>,
--   
--   <pre>
--   fail s &gt;&gt;= f  =  fail s
--   </pre>
--   
--   If your <a>Monad</a> is also <tt>MonadPlus</tt>, a popular definition
--   is
--   
--   <pre>
--   fail _ = mzero
--   </pre>
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
