type-checking error with immutable vectors in for loop

30 views
Skip to first unread message

bedeke

unread,
Nov 25, 2019, 3:27:32 AM11/25/19
to Racket Users
Hello,

the following doesn't typecheck. Is it a bug? Should I avoid Immutable-Vectors?
#lang typed/racket/base
;DrRacket, version 7.5.0.3 [3m].

(require racket/sequence)

(define-type M (Immutable-Vectorof Number))

(define s
 
(in-list (ann (list (vector-immutable 1 2 3)
                     
(vector-immutable 2 3 4)
                     
(vector-immutable 3 4 5))
               
(Listof M))))

(for/list : (Listof M)
 
([m s])
  m
)

Kr,
Bert

Sam Tobin-Hochstadt

unread,
Nov 25, 2019, 9:12:21 AM11/25/19
to bedeke, Racket Users
This is a situation where the problem is needing more annotations --
if you write:

(for/list : (Listof M)
([m : M s])
m)

it type checks.

Sam
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/1b1bc126-61d4-476f-bbfd-2bb7fce20aae%40googlegroups.com.

Bert De Ketelaere

unread,
Nov 25, 2019, 9:27:32 AM11/25/19
to Sam Tobin-Hochstadt, Racket Users
Thank you,

Bert


From: Sam Tobin-Hochstadt <sa...@cs.indiana.edu>
Sent: Monday, November 25, 2019 15:12
To: bedeke <bed...@hotmail.com>
Cc: Racket Users <racket...@googlegroups.com>
Subject: Re: [racket-users] type-checking error with immutable vectors in for loop
 

wanderley...@gmail.com

unread,
Nov 25, 2019, 9:31:22 AM11/25/19
to Sam Tobin-Hochstadt, Racket Users, bedeke
Is this a situation where the type-checker needs to be enhanced to type-check this code, or there is not enough information to type-check the code?  (I am just curious about that)

--
Abraço,
Wanderley Guimarães
Reply all
Reply to author
Forward
0 new messages