Don't special case typechecking of =.

Its type is more useful than the special typing rule.
This commit is contained in:
Vincent St-Amour 2013-02-04 13:03:58 -05:00
parent 9e8cc6af3c
commit 568f401bdc
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))