# Path: types_builtin.py
# def app_map(data, appTs):
#     apps = {}
#     for tv, at in ezip(data.tvars, appTs):
#         if isinstance(at, TVar) and at.typeVar is tv:
#             continue
#         apps[tv] = at
#     return apps
# 
# def subst(mapping, t):
#     return map_type_vars(lambda st: mapping.get(st.typeVar, st), t)


from base import *
from globs import *
from types_builtin import app_map, subst

# Sure could use graphs here!

VatContents = DT('VatContents', ('copiedExtrinsics', ['*Extrinsic']),
                                ('replacements', {'a': 'a'}),
                                ('transmute', {'a': 'a'}))

VAT = new_env('VAT', VatContents)

Original = new_extrinsic('Original', 'a')

def set_orig(clone, orig):
    # Don't need to recurse since there's only one level of clones
    if has_extrinsic(Original, orig):
        orig = extrinsic(Original, orig)
    add_extrinsic(Original, clone, orig)

def orig_loc(obj):
    # Ugh, I don't like the conditional check...

# Path: types_builtin.py
# def app_map(data, appTs):
#     apps = {}
#     for tv, at in ezip(data.tvars, appTs):
#         if isinstance(at, TVar) and at.typeVar is tv:
#             continue
#         apps[tv] = at
#     return apps
# 
# def subst(mapping, t):
#     return map_type_vars(lambda st: mapping.get(st.typeVar, st), t)


# Path: vat.py
from base import *
from globs import *
from types_builtin import app_map, subst


# Sure could use graphs here!

VatContents = DT('VatContents', ('copiedExtrinsics', ['*Extrinsic']),
                                ('replacements', {'a': 'a'}),
                                ('transmute', {'a': 'a'}))

VAT = new_env('VAT', VatContents)

Original = new_extrinsic('Original', 'a')

def set_orig(clone, orig):
    # Don't need to recurse since there's only one level of clones
    if has_extrinsic(Original, orig):
        orig = extrinsic(Original, orig)
    add_extrinsic(Original, clone, orig)

def orig_loc(obj):
    # Ugh, I don't like the conditional check...

    if has_extrinsic(Original, obj):