]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/metaparse/example/meta_hs/example_in_haskell.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / metaparse / example / meta_hs / example_in_haskell.hpp
CommitLineData
7c673cae
FG
1#ifndef EXAMPLE_IN_HASKELL_HPP
2#define EXAMPLE_IN_HASKELL_HPP
3
4// Copyright Abel Sinkovics (abel@sinkovics.hu) 2012.
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8
9#include <boost/config.hpp>
10
b32b8144 11#if BOOST_METAPARSE_STD < 2011
7c673cae
FG
12
13// We have to fall back on the handcrafted one
14#include <example_handcrafted.hpp>
15
16#else
17
18#define BOOST_MPL_LIMIT_STRING_SIZE 50
19#define BOOST_METAPARSE_LIMIT_STRING_SIZE BOOST_MPL_LIMIT_STRING_SIZE
20
21#include <meta_hs.hpp>
22#include <double_number.hpp>
23
24#include <boost/metaparse/string.hpp>
25
26#include <boost/mpl/int.hpp>
27
28#ifdef _STR
29# error _STR already defined
30#endif
31#define _STR BOOST_METAPARSE_STRING
32
33typedef
34 meta_hs
35 ::import1<_STR("f"), double_number>::type
36 ::import<_STR("val"), boost::mpl::int_<11> >::type
37
38 ::define<_STR("fib n = if n<2 then 1 else fib(n-2) + fib(n-1)")>::type
39 ::define<_STR("fact n = if n<1 then 1 else n * fact(n-1)")>::type
40 ::define<_STR("times4 n = f (f n)")>::type
41 ::define<_STR("times11 n = n * val")>::type
42 metafunctions;
43
44typedef metafunctions::get<_STR("fib")> fib;
45typedef metafunctions::get<_STR("fact")> fact;
46typedef metafunctions::get<_STR("times4")> times4;
47typedef metafunctions::get<_STR("times11")> times11;
48
49#endif
50
51#endif
52
53