Correct and incorrect uses of dotted identity

original commit: bec9c11fd4d61bceb966b06e5a9517d286af9ca4
This commit is contained in:
Sam Tobin-Hochstadt 2008-06-20 13:07:42 -04:00
parent 8a6adc82da
commit f2b3eadd88
3 changed files with 22 additions and 11 deletions

View File

@ -0,0 +1,11 @@
#lang typed-scheme
;; I don't believe the below should work, but it points out where that internal error is coming from.
(: f (All (a ...) ((a ... a -> Integer) -> (a ... a -> Integer))))
(define (f x) x)
(: g (All (b ...) ( -> (b ... b -> Integer))))
(define (g) (lambda xs 0))
(f (g))

View File

@ -13,11 +13,6 @@
((f z) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18)
#; #{(f z) :: (Integer * -> Integer)}
(f z)
;; I don't believe the below should work, but it points out where that internal error is coming from.
(: g (All (b ...) ( -> (b ... b -> Integer))))
(define (g) (lambda xs 0))
(f (g))
#{(f z) :: (Integer * -> Integer)}

View File

@ -1,5 +1,6 @@
#lang typed-scheme
#;
(apply (plambda: (a ...) [ys : (a ... a -> Number) *]
(lambda: [zs : a ... a]
(map (lambda: ([y : (a ... a -> Number)])
@ -9,7 +10,7 @@
(lambda: ([x : Number] [y : Number]) (- x y))
(lambda: ([x : Number] [y : Number]) (* x y))
(lambda: ([x : Number] [y : Number]) (/ x y))))
#;
((apply (plambda: (a ...) [ys : (a ... a -> Number) *]
(lambda: [zs : a ... a]
(map (lambda: ([y : (a ... a -> Number)])
@ -21,10 +22,14 @@
(lambda: ([x : Number] [y : Number]) (/ x y))))
3 4)
(apply (plambda: (a ...) [ys : (a ... a -> Number) *]
(lambda: [zs : a ... a]
(map (lambda: ([y : (a ... a -> Number)])
(apply y zs))
ys)))
(list + - * /))
(apply (plambda: (a ...) [ys : (a ... a -> Number) *]
(lambda: [zs : a ... a]
(map (lambda: ([y : (a ... a -> Number)])
(apply y zs))
ys)))
#{(error 'foo) :: (Listof Number)}))
(list + - * /))