[racket-dev] typed/racket for loops?
No annotations are needed here, even:
#lang typed/racket
(: p (Listof Integer))
(define p
(for/list ([i (in-range 30)]) i))
The other problem is why doesn't it know that `in-range' produces
Naturals; I'll look into that.
On Tue, Jun 7, 2011 at 12:24 PM, Hari Prashanth <krhari at ccs.neu.edu> wrote:
> Its a bad error message I believe.
>
> (: p (Listof Fixnum))
> (define p
> (for/list: : (Listof Fixnum) ([i : Fixnum (in-range 30)]) i))
>
>
> ----- Original Message -----
> From: "John Clements" <clements at brinckerhoff.org>
> To: "Sam Tobin-Hochstadt" <samth at ccs.neu.edu>
> Cc: "dev" <dev at racket-lang.org>
> Sent: Tuesday, June 7, 2011 3:10:58 PM (GMT-0500) Auto-Detected
> Subject: [racket-dev] typed/racket for loops?
>
> I can't get typed racket to work with for loops, e.g.:
>
> #lang typed/racket
>
> (: p (Listof Natural))
> (define p
> (for/list: : Natural ([i (in-range 30)]) i))
>
> ==> Type Checker: Error in macro expansion -- untyped variable: for-loop in: (for/list: : Natural ((i (in-range 30))) i)
>
>
> Am I doing something silly here? I tried annotating the type of the loop variable 'i', with no change in the error message.
>
> John
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/dev
>
--
sam th
samth at ccs.neu.edu