MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
clos.h File Reference
#include "mim/world.h"
#include "mim/plug/clos/autogen.h"
Include dependency graph for clos.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mim::plug::clos::ClosLit
 Wrapper around a Def that can be used to match closures (see isa_clos_lit). More...
 

Namespaces

namespace  mim
 
namespace  mim::plug
 
namespace  mim::plug::clos
 The clos Plugin
 

Functions

Closures
ClosLit mim::plug::clos::isa_clos_lit (Ref def, bool fn_isa_lam=true)
 Tries to match a closure literal.
 
Ref mim::plug::clos::clos_pack (Ref env, Ref fn, Ref ct=nullptr)
 Pack a typed closure. This assumes that fn expects the environment as its Clos_Env_Paramth argument.
 
std::tuple< Ref, Ref, Refmim::plug::clos::clos_unpack (Ref c)
 Deconstruct a closure into (env_type, function, env).
 
Ref mim::plug::clos::clos_apply (Ref closure, Ref args)
 Apply a closure to arguments.
 
Ref mim::plug::clos::apply_closure (Ref closure, Defs args)
 
template<class N >
std::tuple< const Extract *, N * > mim::plug::clos::ca_isa_var (Ref def)
 Checks is def is the variable of a mut of type N.
 
Closure Types
const Sigmamim::plug::clos::isa_clos_type (Ref def)
 
Sigmamim::plug::clos::clos_type (const Pi *pi)
 Creates a typed closure type from pi.
 
const Pimim::plug::clos::clos_type_to_pi (Ref ct, Ref new_env_type=nullptr)
 Convert a closure type to a Pi, where the environment type has been removed or replaced by new_env_type (if new_env_type != nullptr)
 

Closure Environment

static constexpr size_t mim::plug::clos::Clos_Env_Param = 1_u64
 Describes where the environment is placed in the argument list.
 
size_t mim::plug::clos::shift_env (size_t i)
 
size_t mim::plug::clos::skip_env (size_t i)
 
Ref mim::plug::clos::ctype (World &w, Defs doms, Ref env_type=nullptr)
 
Ref mim::plug::clos::clos_insert_env (size_t i, Ref env, std::function< Ref(size_t)> f)
 
Ref mim::plug::clos::clos_insert_env (size_t i, Ref env, Ref a)
 
Ref mim::plug::clos::clos_insert_env (Ref env, Ref tup_or_sig)
 
Ref mim::plug::clos::clos_remove_env (size_t i, std::function< Ref(size_t)> f)
 
Ref mim::plug::clos::clos_remove_env (size_t i, Ref def)
 
Ref mim::plug::clos::clos_remove_env (Ref tup_or_sig)
 
Ref mim::plug::clos::clos_sub_env (Ref tup_or_sig, Ref new_env)