data-foldapp-0.1.1.0: Fold function applications. Framework for variadic functions.

Data.FoldApp.Identity

Description

Specialised functions for folds of function applications. The converter has been specialised to the identity converter.

Synopsis

# Documentation

type FoldlApp p r f = FoldlApp (~) p r f Source #

Data.FoldApp.FoldlApp with the identity converter chosen.

type FoldrApp p r f = FoldrApp (~) p r f Source #

Data.FoldApp.FoldrAPp with the identity converter chosen.

foldlApp :: forall p r f. FoldlApp p r f => (r -> p -> r) -> r -> f Source #

Left-associative fold of function applications.

foldlMApp :: forall m p r f. (Monad m, FoldlApp p (m r) f) => (r -> p -> m r) -> r -> f Source #

Monadic left-associative fold of function applications.

foldrApp :: forall p r f. FoldrApp p r f => (p -> r -> r) -> r -> f Source #

Right-associative fold of function applications.

foldrMApp :: forall m p r f. (Monad m, FoldrApp p (m r) f) => (p -> r -> m r) -> r -> f Source #

Monadic right-associative fold of function applications.

class Applicative m => Monad (m :: * -> *) #

The Monad class defines the basic operations over a monad, a concept from a branch of mathematics known as category theory. From the perspective of a Haskell programmer, however, it is best to think of a monad as an abstract datatype of actions. Haskell's do expressions provide a convenient syntax for writing monadic expressions.

Instances of Monad should satisfy the following laws:

• return a >>= k  =  k a
• m >>= return  =  m
• m >>= (\x -> k x >>= h)  =  (m >>= k) >>= h

Furthermore, the Monad and Applicative operations should relate as follows:

• pure = return
• (<*>) = ap

The above laws imply:

• fmap f xs  =  xs >>= return . f
• (>>) = (*>)

and that pure and (<*>) satisfy the applicative functor laws.

The instances of Monad for lists, Maybe and IO defined in the Prelude satisfy these laws.

Minimal complete definition

(>>=)

Instances

 Monad [] Since: 2.1 Methods(>>=) :: [a] -> (a -> [b]) -> [b] #(>>) :: [a] -> [b] -> [b] #return :: a -> [a] #fail :: String -> [a] # Since: 2.1 Methods(>>=) :: Maybe a -> (a -> Maybe b) -> Maybe b #(>>) :: Maybe a -> Maybe b -> Maybe b #return :: a -> Maybe a #fail :: String -> Maybe a # Since: 2.1 Methods(>>=) :: IO a -> (a -> IO b) -> IO b #(>>) :: IO a -> IO b -> IO b #return :: a -> IO a #fail :: String -> IO a # Since: 4.9.0.0 Methods(>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b #(>>) :: NonEmpty a -> NonEmpty b -> NonEmpty b #return :: a -> NonEmpty a #fail :: String -> NonEmpty a # Since: 4.8.0.0 Methods(>>=) :: Dual a -> (a -> Dual b) -> Dual b #(>>) :: Dual a -> Dual b -> Dual b #return :: a -> Dual a #fail :: String -> Dual a # Since: 4.8.0.0 Methods(>>=) :: Sum a -> (a -> Sum b) -> Sum b #(>>) :: Sum a -> Sum b -> Sum b #return :: a -> Sum a #fail :: String -> Sum a # Since: 4.8.0.0 Methods(>>=) :: Product a -> (a -> Product b) -> Product b #(>>) :: Product a -> Product b -> Product b #return :: a -> Product a #fail :: String -> Product a # Methods(>>=) :: First a -> (a -> First b) -> First b #(>>) :: First a -> First b -> First b #return :: a -> First a #fail :: String -> First a # Methods(>>=) :: Last a -> (a -> Last b) -> Last b #(>>) :: Last a -> Last b -> Last b #return :: a -> Last a #fail :: String -> Last a # Methods(>>=) :: Seq a -> (a -> Seq b) -> Seq b #(>>) :: Seq a -> Seq b -> Seq b #return :: a -> Seq a #fail :: String -> Seq a # Monoid a => Monad ((,) a) Since: 4.9.0.0 Methods(>>=) :: (a, a) -> (a -> (a, b)) -> (a, b) #(>>) :: (a, a) -> (a, b) -> (a, b) #return :: a -> (a, a) #fail :: String -> (a, a) # Monad m => Monad (WrappedMonad m) Methods(>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b #(>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b #return :: a -> WrappedMonad m a #fail :: String -> WrappedMonad m a # ArrowApply a => Monad (ArrowMonad a) Since: 2.1 Methods(>>=) :: ArrowMonad a a -> (a -> ArrowMonad a b) -> ArrowMonad a b #(>>) :: ArrowMonad a a -> ArrowMonad a b -> ArrowMonad a b #return :: a -> ArrowMonad a a #fail :: String -> ArrowMonad a a # Monad (State s) Methods(>>=) :: State s a -> (a -> State s b) -> State s b #(>>) :: State s a -> State s b -> State s b #return :: a -> State s a #fail :: String -> State s a # Monad f => Monad (Alt * f) Methods(>>=) :: Alt * f a -> (a -> Alt * f b) -> Alt * f b #(>>) :: Alt * f a -> Alt * f b -> Alt * f b #return :: a -> Alt * f a #fail :: String -> Alt * f a # (Applicative f, Monad f) => Monad (WhenMissing f x) Equivalent to ReaderT k (ReaderT x (MaybeT f)). Methods(>>=) :: WhenMissing f x a -> (a -> WhenMissing f x b) -> WhenMissing f x b #(>>) :: WhenMissing f x a -> WhenMissing f x b -> WhenMissing f x b #return :: a -> WhenMissing f x a #fail :: String -> WhenMissing f x a # Monad ((->) LiftedRep LiftedRep r) Since: 2.1 Methods(>>=) :: (LiftedRep -> LiftedRep) r a -> (a -> (LiftedRep -> LiftedRep) r b) -> (LiftedRep -> LiftedRep) r b #(>>) :: (LiftedRep -> LiftedRep) r a -> (LiftedRep -> LiftedRep) r b -> (LiftedRep -> LiftedRep) r b #return :: a -> (LiftedRep -> LiftedRep) r a #fail :: String -> (LiftedRep -> LiftedRep) r a # (Monad f, Applicative f) => Monad (WhenMatched f x y) Equivalent to ReaderT Key (ReaderT x (ReaderT y (MaybeT f))) Methods(>>=) :: WhenMatched f x y a -> (a -> WhenMatched f x y b) -> WhenMatched f x y b #(>>) :: WhenMatched f x y a -> WhenMatched f x y b -> WhenMatched f x y b #return :: a -> WhenMatched f x y a #fail :: String -> WhenMatched f x y a # (Applicative f, Monad f) => Monad (WhenMissing f k x) Equivalent to  ReaderT k (ReaderT x (MaybeT f)) . Methods(>>=) :: WhenMissing f k x a -> (a -> WhenMissing f k x b) -> WhenMissing f k x b #(>>) :: WhenMissing f k x a -> WhenMissing f k x b -> WhenMissing f k x b #return :: a -> WhenMissing f k x a #fail :: String -> WhenMissing f k x a # (Monad f, Applicative f) => Monad (WhenMatched f k x y) Equivalent to  ReaderT k (ReaderT x (ReaderT y (MaybeT f)))  Methods(>>=) :: WhenMatched f k x y a -> (a -> WhenMatched f k x y b) -> WhenMatched f k x y b #(>>) :: WhenMatched f k x y a -> WhenMatched f k x y b -> WhenMatched f k x y b #return :: a -> WhenMatched f k x y a #fail :: String -> WhenMatched f k x y a #