module Unison.Util.Alternative ( whenM, ) where import Control.Applicative (Alternative (empty)) whenM :: (Monad m, Alternative m) => m Bool -> a -> m a whenM :: forall (m :: * -> *) a. (Monad m, Alternative m) => m Bool -> a -> m a whenM m Bool m a a = do Bool b <- m Bool m if Bool b then a -> m a forall a. a -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure a a else m a forall a. m a forall (f :: * -> *) a. Alternative f => f a empty