]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hana/test/ext/boost/tuple/monad.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / 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)
4
5 #include <boost/hana/ext/boost/tuple.hpp>
6
7 #include <boost/hana/tuple.hpp>
8
9 #include <laws/applicative.hpp>
10 #include <laws/base.hpp>
11 #include <laws/functor.hpp>
12 #include <laws/monad.hpp>
13
14 #include <boost/tuple/tuple.hpp>
15 namespace hana = boost::hana;
16
17
18 template <int i>
19 using eq = hana::test::ct_eq<i>;
20
21 int main() {
22 //////////////////////////////////////////////////////////////////////////
23 // Setup for the laws below
24 //////////////////////////////////////////////////////////////////////////
25 auto eq_tuples = hana::make_tuple(
26 ::boost::make_tuple()
27 , ::boost::make_tuple(eq<0>{})
28 , ::boost::make_tuple(eq<0>{}, eq<1>{})
29 );
30
31 auto eq_values = hana::make_tuple(eq<0>{}, eq<2>{});
32
33 auto eq_tuples_tuples = hana::make_tuple(
34 ::boost::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>{}))
44 );
45
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};
52 }