kure-2.12.0: Combinators for Strategic Programming

Portabilityghc
Stabilitybeta
MaintainerNeil Sculthorpe <neil@ittc.ku.edu>
Safe HaskellSafe-Inferred

Language.KURE.Combinators.Monad

Contents

Description

This module provides conditional monadic combinators.

Synopsis

Monadic Conditionals

guardMsg :: Monad m => Bool -> String -> m ()Source

Similar to guard, but invokes fail rather than mzero.

guardM :: Monad m => Bool -> m ()Source

As guardMsg, but with a default error message.

guardMsgM :: Monad 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 aSource

if-then-else lifted over a monadic predicate.

whenM :: Monad m => m Bool -> m a -> m aSource

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

unlessM :: Monad m => m Bool -> m a -> m aSource

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