Movatterモバイル変換


[0]ホーム

URL:


base-4.12.0.0: Basic libraries

Copyright(C) 2015 David Luposchainsky
(C) 2015 Herbert Valerio Riedel
LicenseBSD-style (see the file LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell2010

Control.Monad.Fail

Description

Transitional module providing theMonadFail class and primitive instances.

This module can be imported for defining forward compatibleMonadFail instances:

import qualified Control.Monad.Fail as Failinstance Monad Foo where  (>>=) = {- ...bind impl... -}  -- Provide legacyfail implementation for when  -- new-style MonadFail desugaring is not enabled.  fail = Fail.failinstance Fail.MonadFail Foo where  fail = {- ...fail implementation... -}

Seehttps://prime.haskell.org/wiki/Libraries/Proposals/MonadFail for more details.

Since: 4.9.0.0

Synopsis

Documentation

classMonad m =>MonadFail mwhereSource#

When a value is bound indo-notation, the pattern on the left hand side of<- might not match. In this case, this class provides a function to recover.

AMonad without aMonadFail 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 ofMonadFail should satisfy the following law:fail s should be a left zero for>>=,

fail s >>= f  =  fail s

If yourMonad is alsoMonadPlus, a popular definition is

fail _ = mzero

Since: 4.9.0.0

Methods

fail ::String -> m aSource#

Instances
MonadFail []Source#

Since: 4.9.0.0

Instance details

Defined inControl.Monad.Fail

Methods

fail ::String -> [a]Source#

MonadFailMaybeSource#

Since: 4.9.0.0

Instance details

Defined inControl.Monad.Fail

Methods

fail ::String ->Maybe aSource#

MonadFailIOSource#

Since: 4.9.0.0

Instance details

Defined inControl.Monad.Fail

Methods

fail ::String ->IO aSource#

MonadFailReadPSource#

Since: 4.9.0.0

Instance details

Defined inText.ParserCombinators.ReadP

Methods

fail ::String ->ReadP aSource#

MonadFailReadPrecSource#

Since: 4.9.0.0

Instance details

Defined inText.ParserCombinators.ReadPrec

MonadFail (ST s)Source#

Since: 4.11.0.0

Instance details

Defined inGHC.ST

Methods

fail ::String ->ST s aSource#

MonadFail (ST s)Source#

Since: 4.10

Instance details

Defined inControl.Monad.ST.Lazy.Imp

Methods

fail ::String ->ST s aSource#

MonadFail f =>MonadFail (Ap f)Source#

Since: 4.12.0.0

Instance details

Defined inData.Monoid

Methods

fail ::String ->Ap f aSource#

Produced byHaddock version 2.20.0


[8]ページ先頭

©2009-2025 Movatter.jp