kure-2.16.12: Combinators for Strategic Programming

Copyright(c) 2012--2014 The University of Kansas
LicenseBSD3
MaintainerNeil Sculthorpe <neil@ittc.ku.edu>
Stabilitybeta
Portabilityghc
Safe HaskellSafe-Inferred
LanguageHaskell2010

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 a Source

if-then-else lifted over a monadic predicate.

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

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

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

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