{-# LANGUAGE Safe #-}{-Copyright: (c) 2016 Stephen Diehl (c) 20016-2018 Serokell (c) 2018 KowainikLicense: MIT-}-- | Convenient utils to work with 'Applicative'. There were more functions in this module-- (see <https://www.stackage.org/haddock/lts-8.9/protolude-0.1.10/Applicative.html protolude version>)-- but only convenient ans most used are left.module Relude.Applicative ( module Control.Applicative , pass ) whereimport Control.Applicative (Alternative (..), Applicative (..), Const (..), ZipList (..), liftA2, liftA3, optional, (<**>))-- $setup-- >>> import Relude.Monad (Maybe)-- | Shorter alias for @pure ()@.---- >>> pass :: Maybe ()-- Just ()pass :: Applicative f => f ()pass = pure (){-orAlt :: (Alternative f, Monoid a) => f a -> f aorAlt f = f <|> pure memptyorEmpty :: Alternative f => Bool -> a -> f aorEmpty b a = if b then pure a else emptyeitherA :: Alternative f => f a -> f b -> f (Either a b)eitherA a b = (Left <$> a) <|> (Right <$> b)purer :: (Applicative f, Applicative g) => a -> f (g a)purer = pure . pureliftAA2 :: (Applicative f, Applicative g) => (a -> b -> c) -> f (g a) -> f (g b) -> f (g c)liftAA2 = liftA2 . liftA2(<<*>>) :: (Applicative f, Applicative g) => f (g (a -> b)) -> f (g a) -> f (g b)(<<*>>) = liftA2 (<*>)-}