(module init-envs mzscheme
(provide (all-defined))
(require "type-env.ss" "type-name-env.ss" "type-environments.ss" "base-env.ss")
(define (initialize-type-name-env)
(for-each (lambda (nm/ty) (register-type-name (car nm/ty) (cadr nm/ty))) initial-type-names))
(define (initialize-type-env)
(for-each (lambda (nm/ty) (register-type (car nm/ty) (cadr nm/ty))) initial-env))
(require (lib "pconvert.ss") "types.ss" "planet-requires.ss" "types-aux.ss")
(require-for-template (lib "pconvert.ss"))
(require-for-template (lib "shared.ss"))
(require-for-template mzscheme "types.ss" "types-aux.ss")
(require-for-template "prims.ss" (lib "match.ss"))
(require-libs)
(define (converter v basic sub)
(if (union? v)
`(Un ,@(map sub (set:elements (union-elems v))))
(basic v)))
(define (bound-in-this-module id)
(let ([binding (identifier-binding id)])
(if (and (list? binding) (module-path-index? (car binding)))
(let-values ([(mp base) (module-path-index-split (car binding))])
(not mp))
#f)))
(define (tname-env-init-code)
(define (f id ty)
(if (bound-in-this-module id)
#`(register-type-name #'#,id #,(datum->syntax-object #'here (print-convert ty)))
#f))
(parameterize ((current-print-convert-hook converter)
(show-sharing #f)
(booleans-as-true/false #f))
(with-syntax ([registers (filter (lambda (x) x) (type-name-env-map f))])
#'(begin (begin-for-syntax . registers)))))
(define (env-init-code)
(define (f id ty)
(if (bound-in-this-module id)
#`(register-type #'#,id #,(datum->syntax-object #'here (print-convert ty)))
#f))
(parameterize ((current-print-convert-hook converter)
(show-sharing #f)
(booleans-as-true/false #f))
(with-syntax ([registers (filter (lambda (x) x) (type-env-map f))])
#'(begin (begin-for-syntax . registers)))))
)