[racket] the type of range

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Wed Jul 16 14:32:03 EDT 2014

Thanks for the report! Those are spon on.

One comment: the missing Integer case is subsumed by the subsequent Real
case, and so would be redundant. Larger types lead to slower
typechecking, so we try to avoid redundant cases.

Would you like to submit a pull request fixing those? The relevant code
is in `pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/base-env/base-env-numeric.rkt`

If you prefer, I can also do the changes myself (giving you full credit,
of course. :) ).

Vincent

At Tue, 15 Jul 2014 21:37:57 -0400,
Alexander D. Knauth wrote:
> 
> The type of range is this:
> > (case->
> >  (-> Nonpositive-Integer Null)
> Why isn’t this (-> Nonpositive-Real Null) ?
> >  (-> One (List One))
> This is wrong, because (range 1) produces ‘(0), not ‘(1).
> It should be (-> One (List Zero)).
> >  (-> Byte (Listof Byte))
> >  (-> Index (Listof Index))
> >  (-> Fixnum (Listof Fixnum))
> Why isn’t this (-> Fixnum (Listof Nonnegative-Fixnum)) ?
> And why isn’t there a (-> Integer (Listof Nonnegative-Integer)) case in here?
> >  (-> Real (Listof Integer))
> Why isn’t this (-> Real (Listof Nonnegative-Integer)) ?
> 
> >  (->* (Positive-Integer Byte) (Integer) (Listof Positive-Byte))
> >  (->* (Nonnegative-Integer Byte) (Integer) (Listof Byte))
> >  (->* (Positive-Integer Index) (Integer) (Listof Positive-Index))
> >  (->* (Nonnegative-Integer Index) (Integer) (Listof Index))
> >  (->* (Nonnegative-Integer Nonnegative-Fixnum)
> >       (Integer)
> >       (Listof Nonnegative-Fixnum))
> >  (->* (Positive-Integer Fixnum) (Nonnegative-Integer) (Listof Positive-Fixnum))
> >  (->* (Nonnegative-Integer Fixnum)
> >       (Nonnegative-Integer)
> >       (Listof Nonnegative-Fixnum))
> >  (->* (Nonnegative-Integer Nonnegative-Integer)
> >       (Integer)
> >       (Listof Nonnegative-Integer))
> >  (->* (Positive-Integer Integer)
> >       (Nonnegative-Integer)
> >       (Listof Positive-Integer))
> >  (->* (Nonnegative-Integer Integer)
> >       (Nonnegative-Integer)
> >       (Listof Nonnegative-Integer))
> >  (->* (Integer Real) (Integer) (Listof Integer))
> >  (->* (Exact-Rational Real) (Exact-Rational) (Listof Exact-Rational))
> >  (->* (Flonum Real) (Flonum) (Listof Flonum))
> >  (->* (Single-Flonum Real) (Single-Flonum) (Listof Single-Flonum))
> >  (->* (Inexact-Real Real) (Inexact-Real) (Listof Inexact-Real))
> >  (->* (Real Real) (Real) (Listof Real)))



Posted on the users mailing list.