    {- monadic stuff
     -
     - Copyright 2010-2012 Joey Hess <id@joeyh.name>
     -
     - License: BSD-2-clause
     -}

    {-# OPTIONS_GHC -fno-warn-tabs #-}

    module Utility.Monad where

    {- if with a monadic conditional. -}
    ifM :: Monad m => m Bool -> (m a, m a) -> m a
    ifM :: forall (m :: * -> *) a. Monad m => m Bool -> (m a, m a) -> m a
    ifM m Bool
    cond (m a
    thenclause, m a
    elseclause) = do
    	c <- m Bool
    cond
    	if c then thenclause else elseclause

    {- do nothing -}
    noop :: Monad m => m ()
    noop :: forall (m :: * -> *). Monad m => m ()
    noop = () -> m ()
    forall a. a -> m a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()