monad.hpp 861 B

12345678910111213141516171819202122232425262728293031
  1. /*!
  2. @file
  3. Defines `boost::hana::Monad`.
  4. @copyright Louis Dionne 2013-2016
  5. Distributed under the Boost Software License, Version 1.0.
  6. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  7. */
  8. #ifndef BOOST_HANA_CONCEPT_MONAD_HPP
  9. #define BOOST_HANA_CONCEPT_MONAD_HPP
  10. #include <boost/hana/fwd/concept/monad.hpp>
  11. #include <boost/hana/chain.hpp>
  12. #include <boost/hana/config.hpp>
  13. #include <boost/hana/core/default.hpp>
  14. #include <boost/hana/core/tag_of.hpp>
  15. #include <boost/hana/flatten.hpp>
  16. BOOST_HANA_NAMESPACE_BEGIN
  17. template <typename M>
  18. struct Monad {
  19. using Tag = typename tag_of<M>::type;
  20. static constexpr bool value = !is_default<flatten_impl<Tag>>::value ||
  21. !is_default<chain_impl<Tag>>::value;
  22. };
  23. BOOST_HANA_NAMESPACE_END
  24. #endif // !BOOST_HANA_CONCEPT_MONAD_HPP