Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
clos.h File Reference
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  thorin::plug::clos::ClosLit
 Wrapper around a Def that can be used to match closures (see isa_clos_lit). More...
 

Namespaces

namespace  thorin
 
namespace  thorin::plug
 
namespace  thorin::plug::clos
 The clos Plugin
 

Functions

Closures
ClosLit thorin::plug::clos::isa_clos_lit (Ref def, bool fn_isa_lam=true)
 Tries to match a closure literal.
 
Ref thorin::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, Refthorin::plug::clos::clos_unpack (Ref c)
 Deconstruct a closure into (env_type, function, env).
 
Ref thorin::plug::clos::clos_apply (Ref closure, Ref args)
 Apply a closure to arguments.
 
Ref thorin::plug::clos::apply_closure (Ref closure, Defs args)
 
template<class N >
std::tuple< const Extract *, N * > thorin::plug::clos::ca_isa_var (Ref def)
 Checks is def is the variable of a mut of type N.
 
Closure Types
const Sigmathorin::plug::clos::isa_clos_type (Ref def)
 Returns def if def is a closure and nullptr otherwise.
 
Sigmathorin::plug::clos::clos_type (const Pi *pi)
 Creates a typed closure type from pi.
 
const Pithorin::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

tup_or_sig should generally be a Tuple, Sigma or Var.

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