diff options
Diffstat (limited to 'infer2.scm')
-rw-r--r-- | infer2.scm | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -147,6 +147,12 @@ (make-texp (texp-types body*) `(let ,(map list vars vals*) ,body*))) +(define-matcher (annotate:begin ('begin exps ... last) env) + (define last* (annotate-exp last env)) + (make-texp (texp-types last*) + `(begin ,@(map (lambda (exp) (annotate-exp exp env)) exps) + ,last*))) + (define-matcher (annotate:lambda ('lambda ((? symbol? args) ...) body) env) (define parameter-types (map (lambda (_name) (fresh-type-variable)) args)) (define env* (append (map cons args parameter-types) env)) @@ -171,6 +177,7 @@ annotate:if annotate:values annotate:let + annotate:begin annotate:lambda annotate:call)) @@ -218,6 +225,10 @@ (append (program-constraints body) (append-map program-constraints vals))) +(define-matcher (constrain:begin ((? type? types) ...) + ('begin (? texp? texps) ...)) + (append-map program-constraints texps)) + (define-matcher (constrain:lambda ((? procedure-type? type)) ('lambda ((? symbol? args) ...) (? texp? body))) @@ -237,6 +248,7 @@ (compose-matchers constrain:if constrain:values constrain:let + constrain:begin constrain:lambda constrain:call constrain:other)) |