Added optional arg to type-infer/syn for local env
Added undocumented feature to type-infer/syn. An optional argument can be used to locally extend gamma attempting to infer the type.
This commit is contained in:
parent
63bbb50752
commit
7b10648eb9
|
@ -246,9 +246,13 @@
|
|||
(define (cur-equal? e1 e2)
|
||||
(and (judgment-holds (equivalent ,(delta) ,(eval-cur e1) ,(eval-cur e2))) #t))
|
||||
|
||||
(define (type-infer/syn syn)
|
||||
(let ([t (type-infer/term (eval-cur syn))])
|
||||
(and t (datum->cur syn t))))
|
||||
;; TODO: Document local-env
|
||||
(define (type-infer/syn syn #:local-env [env '()])
|
||||
(parameterize ([gamma (for/fold ([gamma (gamma)])
|
||||
([(x t) (in-dict env)])
|
||||
(extend-Γ/syn (thunk gamma) x t))])
|
||||
(let ([t (type-infer/term (eval-cur syn))])
|
||||
(and t (datum->cur syn t)))))
|
||||
|
||||
(define (type-check/syn? syn type)
|
||||
(type-check/term? (eval-cur syn) (eval-cur type)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user