3 Forward declares `boost::hana::extend`.
5 @copyright Louis Dionne 2013-2016
6 Distributed under the Boost Software License, Version 1.0.
7 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
10 #ifndef BOOST_HANA_FWD_EXTEND_HPP
11 #define BOOST_HANA_FWD_EXTEND_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Comonadic application of a function to a comonadic value.
19 //! @ingroup group-Comonad
21 //! Given a comonadic value and a function accepting a comonadic input,
22 //! `extend` returns the result of applying the function to that input
23 //! inside the comonadic context.
28 //! Given a Comonad `W` and a function of type \f$ W(T) \to U \f$, the
31 //! \mathtt{extend} : W(T) \times (W(T) \to U) \to W(U)
35 //! A comonadic value to call the function with.
38 //! A function of signature \f$ W(T) \to U \f$ to be applied to its
39 //! comonadic argument inside the comonadic context.
44 //! @include example/extend.cpp
45 #ifdef BOOST_HANA_DOXYGEN_INVOKED
46 constexpr auto extend = [](auto&& w, auto&& f) -> decltype(auto) {
47 return tag-dispatched;
50 template <typename W, typename = void>
51 struct extend_impl : extend_impl<W, when<true>> { };
54 template <typename W_, typename F>
55 constexpr decltype(auto) operator()(W_&& w, F&& f) const;
58 constexpr extend_t extend{};
60 BOOST_HANA_NAMESPACE_END
62 #endif // !BOOST_HANA_FWD_EXTEND_HPP