]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/ext/boost/tuple/monad.cpp
1 // Copyright Louis Dionne 2013-2016
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
5 #include <boost/hana/ext/boost/tuple.hpp>
7 #include <boost/hana/tuple.hpp>
9 #include <laws/applicative.hpp>
10 #include <laws/base.hpp>
11 #include <laws/functor.hpp>
12 #include <laws/monad.hpp>
14 #include <boost/tuple/tuple.hpp>
15 namespace hana
= boost::hana
;
19 using eq
= hana::test::ct_eq
<i
>;
22 //////////////////////////////////////////////////////////////////////////
23 // Setup for the laws below
24 //////////////////////////////////////////////////////////////////////////
25 auto eq_tuples
= hana::make_tuple(
27 , ::boost::make_tuple(eq
<0>{})
28 , ::boost::make_tuple(eq
<0>{}, eq
<1>{})
31 auto eq_values
= hana::make_tuple(eq
<0>{}, eq
<2>{});
33 auto eq_tuples_tuples
= hana::make_tuple(
35 , ::boost::make_tuple(
36 ::boost::make_tuple(eq
<0>{}))
37 , ::boost::make_tuple(
38 ::boost::make_tuple(eq
<0>{}),
39 ::boost::make_tuple(eq
<1>{}, eq
<2>{}))
40 , ::boost::make_tuple(
41 ::boost::make_tuple(eq
<0>{}),
42 ::boost::make_tuple(eq
<1>{}, eq
<2>{}),
43 ::boost::make_tuple(eq
<3>{}, eq
<4>{}))
46 //////////////////////////////////////////////////////////////////////////
47 // Functor up to Monad
48 //////////////////////////////////////////////////////////////////////////
49 hana::test::TestFunctor
<hana::ext::boost::tuple_tag
>{eq_tuples
, eq_values
};
50 hana::test::TestApplicative
<hana::ext::boost::tuple_tag
>{eq_tuples
};
51 hana::test::TestMonad
<hana::ext::boost::tuple_tag
>{eq_tuples
, eq_tuples_tuples
};