3 Forward declares `boost::hana::extract`.
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_EXTRACT_HPP
11 #define BOOST_HANA_FWD_EXTRACT_HPP
13 #include <boost/hana/config.hpp>
14 #include <boost/hana/core/when.hpp>
17 BOOST_HANA_NAMESPACE_BEGIN
18 //! Extract a value in a given comonadic context.
19 //! @ingroup group-Comonad
21 //! Given a value inside a comonadic context, extract it from that
22 //! context, performing whatever effects are mandated by that context.
23 //! This can be seen as the dual operation to the `lift` method of the
24 //! Applicative concept.
29 //! Given a Comonad `W`, the signature is
31 //! \mathtt{extract} : W(T) \to T
35 //! The value to be extracted inside a comonadic context.
40 //! @include example/extract.cpp
41 #ifdef BOOST_HANA_DOXYGEN_INVOKED
42 constexpr auto extract = [](auto&& w) -> decltype(auto) {
43 return tag-dispatched;
46 template <typename W, typename = void>
47 struct extract_impl : extract_impl<W, when<true>> { };
50 template <typename W_>
51 constexpr decltype(auto) operator()(W_&& w) const;
54 constexpr extract_t extract{};
56 BOOST_HANA_NAMESPACE_END
58 #endif // !BOOST_HANA_FWD_EXTRACT_HPP