mpc
Haskell-like feature supports in C++
mpc::applicatives Namespace Reference

Methods deducible from other methods of applicative . More...

Variables

constexpr partial< detail::fmap_opfmap {}
 fmap :: (a -> b) -> f a -> f b More...
 
constexpr auto seq_apply = mpc::liftA2 % identity
 seq_apply :: f (a -> b) -> f a -> f b More...
 
constexpr partial< detail::liftA2_opliftA2 {}
 liftA2 :: (a -> b -> c) -> f a -> f b -> f c More...
 
constexpr auto discard2nd = mpc::liftA2 % constant
 discard2nd :: f a -> f b -> f a More...
 
constexpr auto discard1st = mpc::liftA2 % (flip % constant)
 discard1st :: f a -> f b -> f b More...
 
constexpr partial< detail::discard1st_opt_opdiscard1st_opt {}
 discard1st :: f a -> f b -> f b More...
 

Detailed Description

Methods deducible from other methods of applicative .

Variable Documentation

◆ discard1st

constexpr auto mpc::applicatives::discard1st = mpc::liftA2 % (flip % constant)
inlineconstexpr

discard1st :: f a -> f b -> f b

(*>) in Haskell

discard1st = liftA2 (flip constant)
constexpr partial< detail::liftA2_op > liftA2
liftA2 :: (a -> b -> c) -> f a -> f b -> f c
Definition: applicative.hpp:173
constexpr auto discard1st
discard1st :: f a -> f b -> f b
Definition: applicative.hpp:191

◆ discard1st_opt

constexpr partial<detail::discard1st_opt_op> mpc::applicatives::discard1st_opt {}
inlineconstexpr

discard1st :: f a -> f b -> f b

(*>) in Haskell

Use this method if you have an optimized replace2nd.

constexpr auto seq_apply
seq_apply :: f (a -> b) -> f a -> f b
Definition: applicative.hpp:170
constexpr partial< detail::replace2nd_op > replace2nd
replace2nd :: a -> f b -> f a
Definition: functor.hpp:53
constexpr partial< std::identity > identity
Identity mapping.
Definition: identity.hpp:11

◆ discard2nd

constexpr auto mpc::applicatives::discard2nd = mpc::liftA2 % constant
inlineconstexpr

discard2nd :: f a -> f b -> f a

(<*) in Haskell

constexpr auto discard2nd
discard2nd :: f a -> f b -> f a
Definition: applicative.hpp:182
constexpr partial< detail::constant_op > constant
Returns a unary function always returning the first input.
Definition: constant.hpp:21

◆ fmap

constexpr partial<detail::fmap_op> mpc::applicatives::fmap {}
inlineconstexpr

fmap :: (a -> b) -> f a -> f b

fmap f x = (pure f) `seq_apply` x
constexpr partial< detail::fmap_op > fmap
fmap :: (a -> b) -> f a -> f b
Definition: applicative.hpp:161
constexpr partial< detail::pure_op< F > > pure
pure :: a -> f a
Definition: applicative.hpp:96

◆ liftA2

constexpr partial<detail::liftA2_op> mpc::applicatives::liftA2 {}
inlineconstexpr

liftA2 :: (a -> b -> c) -> f a -> f b -> f c

liftA2 f x y = f `fmap` x `seq_apply` y

◆ seq_apply

constexpr auto mpc::applicatives::seq_apply = mpc::liftA2 % identity
inlineconstexpr

seq_apply :: f (a -> b) -> f a -> f b

(<*>) in Haskell