4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::monad Namespace Reference

Monad typeclass and related functions. More...

Classes

struct  instance
 Used to implement a monad instance. More...
 
struct  instance< fcppt::either::object< Failure, Success > >
 
struct  instance< fcppt::optional::object< Arg > >
 

Typedefs

template<typename Type , typename Value >
using constructor = typename fcppt::monad::instance<Type>::template constructor<Value>::type
 Applies the constructor of a monad.
 
template<typename Type >
using inner_type = typename fcppt::monad::instance<Type>::template inner_type<Type>::type
 Extracts the type a monadic constructor was used with.
 

Functions

template<typename Arg , typename Function >
std::invoke_result_t< Function, fcppt::move_if_rvalue_type< Arg, fcppt::monad::inner_type< std::remove_cvref_t< Arg > > > > bind (Arg &&_arg, Function const &_function)
 Monadic bind.
 
template<typename Value , typename... Lambdas>
auto chain (Value &&_value, Lambdas const &..._lambdas)
 Chains multiple bind calls.
 
template<typename Value , typename... Lambdas>
auto do_ (Value &&_value, Lambdas const &..._lambdas)
 Do-notation for monads.
 
template<typename Type , typename Value >
fcppt::monad::constructor< Type, std::remove_cvref_t< Value > > return_ (Value &&_value)
 Monadic return.
 

Detailed Description

Monad typeclass and related functions.