Don't special case typechecking of =.

Its type is more useful than the special typing rule.

original commit: 568f401bdcea778acfa8c1b80f18b23e9e9c9345
This commit is contained in:
Vincent St-Amour 2013-02-04 13:03:58 -05:00
parent 916a8bf3e2
commit 327c55a28b
2 changed files with 10 additions and 3 deletions

View File

@ -0,0 +1,6 @@
#lang typed/racket
(: f : Nonnegative-Integer -> Boolean)
(define (f x)
(cond [(= 0 x) #t]
[else (f (sub1 x))])) ; here, x is Positive-Integer

View File

@ -19,9 +19,10 @@
(export tc-app-eq^)
;; comparators that inform the type system
;; `=' is not included. Its type is more useful than this typing rule.
(define-syntax-class comparator
#:literals (eq? equal? eqv? = string=? symbol=? memq member memv)
(pattern eq?) (pattern equal?) (pattern eqv?) (pattern =) (pattern string=?) (pattern symbol=?)
#:literals (eq? equal? eqv? string=? symbol=? memq member memv)
(pattern eq?) (pattern equal?) (pattern eqv?) (pattern string=?) (pattern symbol=?)
(pattern member) (pattern memq) (pattern memv))
@ -46,7 +47,7 @@
(define-syntax-rule (alt nm pred ...)
(and (free-identifier=? #'nm comparator) (or (pred val) ...)))
(or (alt symbol=? symbol?)
(alt string=? string?)
(alt string=? string?)
(alt eq? eq?-able)
(alt eqv? eqv?-able)
(alt equal? equal?-able)))