This happens because for treats in-range specially, so the expanded code 
doesn’t use in-range at all, and TR doesn’t recognize that it originally came 
from a use of in-range.

This fixes it:
#lang typed/racket
(for ([i (identity (in-range 0 1 1/10))])
  (display i))

And this also fixes it:
#lang typed/racket
(for ([i (in-range (ann 0 Exact-Rational) 1 1/10)])
  (display i))


On May 24, 2015, at 1:36 PM, Antonio Menezes Leitao 
<[email protected]> wrote:

> Hi,
> 
> The following code triggers a type error:
> 
> (for ([i (in-range 0 1 1/10)])
>   (display i))
> 
> Type Checker: type mismatch
>   expected: Integer
>   given: Exact-Rational in: (for ((i (in-range 0 1 1/10))) (display i))
> 
> Note that, in Racket, in-range expect Numbers as arguments (and not Integers).
> 
> The following one works fine:
> 
> (for ([i (range 0 1 1/10)])
>   (display i))
> 
> Is this the intended behavior?
> 
> Best,
> António.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-dev/CAJQmiZXfD_8sTauRy07mY8QA9aQwsT_89o-%3D6u-PE3b9K0GKgw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/4B26BC02-C80B-4EB5-8B51-9474E88B4D84%40knauth.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to