Safe Haskell | Trustworthy |
---|
Effects which fail.
Documentation
Fail
represents effects which can fail. This is akin to the Maybe monad.
die :: Member Fail r => Eff r ()Source
Makes an effect fail, preventing future effects from happening.
ignoreFail :: Eff (Fail :> r) a -> Eff r ()Source
Ignores a failure event. Since the event can fail, you cannot inspect its
return type, because it has none on failure. To inspect it, use runFail
.
:: Eff r a | The computation to run on failure. |
-> Eff (Fail :> r) a | The computation which can fail. |
-> Eff r a |
Given a computation to run on failure, and a computation that can fail, this function runs the computation that can fail, and if it fails, gets the return value from the other computation. This hides the fact that a failure even happened, and returns a default value for when it does.