/*! @file Defines `boost::hana::then`. @copyright Louis Dionne 2013-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_THEN_HPP #define BOOST_HANA_THEN_HPP #include #include #include #include #include #include namespace boost { namespace hana { //! @cond template constexpr decltype(auto) then_t::operator()(Before&& before, Xs&& xs) const { using M = typename hana::tag_of::type; using Then = BOOST_HANA_DISPATCH_IF(then_impl, hana::Monad::value && hana::Monad::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::Monad::value, "hana::then(before, xs) requires 'before' to be a Monad"); static_assert(hana::Monad::value, "hana::then(before, xs) requires 'xs' to be a Monad"); #endif return Then::apply(static_cast(before), static_cast(xs)); } //! @endcond template struct then_impl> : default_ { template static constexpr decltype(auto) apply(Xs&& xs, Ys&& ys) { return hana::chain(static_cast(xs), hana::always(static_cast(ys))); } }; }} // end namespace boost::hana #endif // !BOOST_HANA_THEN_HPP