2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-15 01:02:10 +00:00
Files
hana/test/monad/mcd_join.cpp
2014-06-23 15:37:29 -04:00

33 lines
780 B
C++

/*
@copyright Louis Dionne 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#include <boost/hana/monad.hpp>
#include <boost/hana/detail/laws.hpp>
#include <boost/hana/detail/static_assert.hpp>
#include "minimal.hpp"
using namespace boost::hana;
namespace boost { namespace hana {
template <>
struct Monad::instance<MinimalMonad> : Monad::join_mcd {
template <typename M>
static constexpr auto join_impl(M m)
{ return m.value; }
};
}}
int main() {
BOOST_HANA_STATIC_ASSERT(detail::laws<Monad>(
monad<int>{1},
2,
[](auto x) { return monad<int>{x + 1}; },
[](auto x) { return monad<int>{x * 2}; }
));
}