diff --git a/collects/tests/typed-racket/succeed/curry.rkt b/collects/tests/typed-racket/succeed/curry.rkt new file mode 100644 index 00000000..49894d74 --- /dev/null +++ b/collects/tests/typed-racket/succeed/curry.rkt @@ -0,0 +1,25 @@ +#lang typed/racket + +(: f2 (Boolean Integer Integer -> Integer)) +(define (f2 add? i1 i2) + (if add? + (+ i1 i2) + (- i1 i2))) + +(: f3 (Boolean Integer Integer Integer -> Integer)) +(define (f3 add? i1 i2 i3) + (if add? + (+ i1 i2 i3) + (- i1 i2 i3))) + +(define f1a (curry f2 #t)) +(define f1b (curry f3 #t)) +(define f2a (curry f2)) +(define f2b (curry f3)) + +(f2 #t 2 3) +(f2 #f 2 1) +(f1a 10 20) +(f1b 10 20 30) +((f2a #t) 10 20) +((f2b #t) 10 20 30) diff --git a/collects/typed-racket/base-env/base-env.rkt b/collects/typed-racket/base-env/base-env.rkt index 83bcd400..95c7c345 100644 --- a/collects/typed-racket/base-env/base-env.rkt +++ b/collects/typed-racket/base-env/base-env.rkt @@ -1772,9 +1772,11 @@ ;; probably the most useful cases -[curry (-poly (a b c) - (cl->* ((a b . -> . c) a . -> . (b . -> . c)) - ((a b . -> . c) . -> . (a . -> . (b . -> . c)))))] +;; doesn't cover cases where we pass multiple of the function's arguments to curry, +;; also doesn't express that the returned function is itself curried +[curry (-polydots (a c b) + (cl->* ((->... (list a) (b b) c) a . -> . (->... '() (b b) c)) + ((->... (list a) (b b) c) . -> . (a . -> . (->... '() (b b) c)))))] ;; mutable pairs [mcons (-poly (a b) (-> a b (-mpair a b)))] [mcar (-poly (a b)