kure-2.18.6: Combinators for Strategic Programming
Copyright(c) 2012--2021 The University of Kansas
LicenseBSD3
MaintainerNeil Sculthorpe <neil.sculthorpe@ntu.ac.uk>
Stabilitybeta
Portabilityghc
Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.KURE.Combinators.Monad

Description

This module provides conditional monadic combinators.

Synopsis

Monadic Conditionals

guardMsg :: MonadFail m => Bool -> String -> m () Source #

Similar to guard, but invokes fail rather than mzero.

guardM :: MonadFail m => Bool -> m () Source #

As guardMsg, but with a default error message.

guardMsgM :: MonadFail m => m Bool -> String -> m () Source #

As guardMsg, but with an m Bool as argument.

ifM :: Monad m => m Bool -> m a -> m a -> m a Source #

if-then-else lifted over a monadic predicate.

whenM :: MonadFail m => m Bool -> m a -> m a Source #

If the monadic predicate holds then perform the monadic action, else fail.

unlessM :: MonadFail m => m Bool -> m a -> m a Source #

If the monadic predicate holds then fail, else perform the monadic action.