(module type-name-env mzscheme
  (require (lib "" "syntax") (lib "")
  (provide register-type-name
  ;; a mapping from id -> type (where id is the name of the type)
  (define the-mapping 
  ;; add a name to the mapping
  ;; identifier Type -> void
  (define (register-type-name id type)
    #;(printf "                registering type ~a~n" (syntax-e id))
    (module-identifier-mapping-put! the-mapping id type))
  ;; add a bunch of names to the mapping
  ;; listof[identifier] listof[type] -> void
  (define (register-type-names ids types)
    (for-each register-type-name ids types))
  ;; given an identifier, return the type associated with it
  ;; optional argument is failure continuation - default calls lookup-fail
  ;; identifier (-> error) -> type
  (define lookup-type-name
      [(id) (lookup-type-name id (lambda () (lookup-fail (syntax-e id))))]
      [(id k) (module-identifier-mapping-get the-mapping id k)]))
  ;; map over the-mapping, producing a list
  ;; (id type -> T) -> listof[T]
  (define (type-name-env-map f)
    (module-identifier-mapping-map the-mapping f))