-- | Helper functions to handle 'Applicative's module HIndent.Applicative ( whenJust ) where -- | If the first argument is a 'Just' value, this function applies its -- internal value to the function passed as the second argument. Otherwise, -- this function returne a 'pure ()'. whenJust :: (Applicative m) => Maybe a -> (a -> m ()) -> m () whenJust :: forall (m :: * -> *) a. Applicative m => Maybe a -> (a -> m ()) -> m () whenJust Maybe a Nothing a -> m () _ = () -> m () forall a. a -> m a forall (f :: * -> *) a. Applicative f => a -> f a pure () whenJust (Just a x) a -> m () f = a -> m () f a x