1 #ifndef META_HS_BIND_HPP
2 #define META_HS_BIND_HPP
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)
12 #include <boost/mpl/at.hpp>
13 #include <boost/mpl/insert.hpp>
14 #include <boost/mpl/pair.hpp>
16 template <class AST, class TopEnv, class Env>
19 template <class V, class TopEnv, class Env>
20 struct bind<ast::value<V>, TopEnv, Env>
22 typedef lazy::value<V> type;
25 template <class Name, class TopEnv, class Env>
26 struct bind<ast::ref<Name>, TopEnv, Env> :
27 bind<typename boost::mpl::at<Env, Name>::type, TopEnv, Env>
30 template <class F, class Arg, class TopEnv, class Env>
31 struct bind<ast::application<F, Arg>, TopEnv, Env>
35 typename bind<F, TopEnv, Env>::type,
36 typename bind<Arg, TopEnv, Env>::type
41 template <class F, class ArgName, class TopEnv, class Env>
42 struct bind<ast::lambda<F, ArgName>, TopEnv, Env>
46 template <class ArgValue>
51 typename boost::mpl::insert<
53 boost::mpl::pair<ArgName, ast::value<ArgValue> >
59 template <class E, class TopEnv, class Env>
60 struct bind<ast::top_bound<E>, TopEnv, Env> : bind<E, TopEnv, TopEnv> {};