[racket] another weird typed racket error

From: Eric Dobson (eric.n.dobson at gmail.com)
Date: Sun Apr 20 14:06:51 EDT 2014

The following annotation makes it work for me.

#lang typed/racket

(require plot/typed plot/typed/utils)

(: vsum ((Listof (Vectorof Real)) -> (Vectorof Real)))
(define (vsum vs)
    (apply (ann vector-map (-> (-> Real * Real) (Vectorof Real) *
(Vectorof Real))) + vs))

I'm not sure why apply is giving this error message.

On Sat, Apr 19, 2014 at 8:34 PM, Alexander D. Knauth
<alexander at knauth.org> wrote:
>
>
> Here’s the program:
> #lang typed/racket
>
> (require plot/typed plot/typed/utils)
>
> (: vsum ((Listof (Vectorof Real)) -> (Vectorof Real)))
> (define (vsum vs)
>   (apply vector-map + vs))
>
> It’s giving me this error:
> . Type Checker: Bad arguments to polymorphic function in apply:
> Domain: (a b ... b -> c) (Vectorof a) (Vectorof b) ... b
> Arguments: (case-> (-> Zero) (Zero Zero -> Zero) (One Zero -> One) (Zero One
> -> One) (Positive-Byte Zero -> Positive-Byte) (Zero Positive-Byte ->
> Positive-Byte) (Byte Zero -> Byte) (Zero Byte -> Byte) (Positive-Index Zero
> -> Positive-Index) (Zero Positive-Index -> Positive-Index) (Index Zero ->
> Index) (Zero Index -> Index) (Positive-Fixnum Zero -> Positive-Fixnum) (Zero
> Positive-Fixnum -> Positive-Fixnum) (Nonnegative-Fixnum Zero ->
> Nonnegative-Fixnum) (Zero Nonnegative-Fixnum -> Nonnegative-Fixnum)
> (Negative-Fixnum Zero -> Negative-Fixnum) (Zero Negative-Fixnum ->
> Negative-Fixnum) (Nonpositive-Fixnum Zero -> Nonpositive-Fixnum) (Zero
> Nonpositive-Fixnum -> Nonpositive-Fixnum) (Fixnum Zero -> Fixnum) (Zero
> Fixnum -> Fixnum) (Positive-Byte Positive-Byte -> Positive-Index) (Byte Byte
> -> Index) (Positive-Byte Positive-Byte Positive-Byte -> Positive-Index)
> (Byte Byte Byte -> Index) (Positive-Index Index -> Positive-Fixnum) (Index
> Positive-Index -> Positive-Fixnum) (Positive-Index Index Index ->
> Positive-Fixnum) (Index Positive-Index Index -> Positive-Fixnum) (Index
> Index Positive-Index -> Positive-Fixnum) (Index Index -> Nonnegative-Fixnum)
> (Index Index Inde in: (apply vector-map + vs)
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>


Posted on the users mailing list.