[racket] applying polymorphic functions in TR
Does this help:
(define-values (case1_x case1_y case1_z case1_w)
((inst time-apply Integer Integer) (lambda () 10) '()))
(define-values (case2_x case2_y case2_z case2_w)
((inst time-apply Integer Integer) (lambda (x) 10) '(10)))
(define-values (case3_x case3_y case3_z case3_w)
((inst time-apply Integer String String) (lambda (x y) 10) '("hello" "world")))
On Feb 16, 2014, at 9:53 AM, Bloch Stephen wrote:
> OK, I figured out an annotation to get vector-map to work. Now I'm trying to use time-apply, and I don't understand why it's not type-checking.
>
> > (:print-type time-apply)
>
> (All (b a ...) (case-> ((-> b) Null -> (values (List b) Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer))
> ((a ... a -> b) (List a ... a) -> (values (List b) Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer))))
>
> > (define-type A Integer) ; or whatever
>
> > (define-type B String)
>
> > (ann time-apply ((A A -> B) (List A A) -> (Values (List B) Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer)))
>
> . Type Checker: Expected ((Integer Integer -> String) (List Integer Integer) -> (values (List String) Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer)), but got (All (b a ...) (case-> ((-> b) Null -> (values (List b) Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer)) ((a ... a -> b) (List a ... a) -> (values (List b) Nonnegative-Integer Nonnegative-Integer Nonnegative-Integer)))) in: time-apply
>
> Why doesn't the type I gave it match the second case of time-apply's type?
>
>
> Stephen Bloch
> sbloch at adelphi.edu
> GPG key at http://adelphi.edu/sbloch/sbloch.pubkey.asc
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140216/43bc3e04/attachment.html>