# Path: native.py
# DIGEST_INDEX = {}
# HEADERS = {'form': '\xe5\xa4\xa9\x00', 'normal': '\xe7\xa5\x9e\x00'}
# def _write(b):
# def _write_ref(node, t):
# def _encode_int(n):
# def _encode_float(f):
# def _encode_str(s):
# def _serialize_node(node, t):
# def _inspect_node(node, t):
# def inspect(module):
# def serialize(module):
#     def write_header():
# 
# 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 bedrock import *
from globs import *
from hashlib import sha256
from native import ModuleMeta, HEADERS, DIGEST_INDEX
from types_builtin import app_map, subst
import os
    assert filename[:5] == 'mods/'
    f = file('cache/%s' % (filename[5:],), 'rb')
    atom_count = _read_int(f)
    dep_count = _read_int(f)
    deps = []
    for i in xrange(dep_count):
        hash_len = _read_int(f)
        assert hash_len == 64, "Weird hash length?!"
        deps.append(f.read(hash_len))
    f.close()
    return ModuleMeta(atom_count, deps)

def _read_module(filename):
    meta = read_meta(filename)

    deps = []
    for h in meta.deps:
        dep = LOADED_MODULES.get(h)
        if dep is None:
            dep = deserialize(h)
        deps.append(dep)

    f = file(filename, 'rb')
    module = Module(None, None)
    ownMap = {}
    forwardRefs = {}
    def go():
        header = f.read(4)
        if header == HEADERS['form']:
            module.rootType = t_DT(DtList)

# Path: native.py
# DIGEST_INDEX = {}
# HEADERS = {'form': '\xe5\xa4\xa9\x00', 'normal': '\xe7\xa5\x9e\x00'}
# def _write(b):
# def _write_ref(node, t):
# def _encode_int(n):
# def _encode_float(f):
# def _encode_str(s):
# def _serialize_node(node, t):
# def _inspect_node(node, t):
# def inspect(module):
# def serialize(module):
#     def write_header():
# 
# 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: deserialize.py
from base import *
from bedrock import *
from globs import *
from hashlib import sha256
from native import ModuleMeta, HEADERS, DIGEST_INDEX
from types_builtin import app_map, subst
import os

    assert filename[:5] == 'mods/'
    f = file('cache/%s' % (filename[5:],), 'rb')
    atom_count = _read_int(f)
    dep_count = _read_int(f)
    deps = []
    for i in xrange(dep_count):
        hash_len = _read_int(f)
        assert hash_len == 64, "Weird hash length?!"
        deps.append(f.read(hash_len))
    f.close()
    return ModuleMeta(atom_count, deps)

def _read_module(filename):
    meta = read_meta(filename)

    deps = []
    for h in meta.deps:
        dep = LOADED_MODULES.get(h)
        if dep is None:
            dep = deserialize(h)
        deps.append(dep)

    f = file(filename, 'rb')
    module = Module(None, None)
    ownMap = {}
    forwardRefs = {}
    def go():
        header = f.read(4)
        if header == HEADERS['form']:
            module.rootType = t_DT(DtList)

        elif header == HEADERS['normal']: