module Agda.Utils.Applicative
       ( (?*>)
       , (?$>)
       )
       where

import Control.Applicative

-- | Guard: return the action @f@ only if the boolean is @True@
(?*>) :: Alternative f => Bool -> f a -> f a
Bool
b ?*> :: Bool -> f a -> f a
?*> f a
f = if Bool
b then f a
f else f a
forall (f :: * -> *) a. Alternative f => f a
empty

-- | Guard: return the value @a@ only if the boolean is @True@
(?$>) :: Alternative f => Bool -> a -> f a
Bool
b ?$> :: Bool -> a -> f a
?$> a
a = Bool
b Bool -> f a -> f a
forall (f :: * -> *) a. Alternative f => Bool -> f a -> f a
?*> a -> f a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
a