[plt-scheme] typed teaching languages

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Sun Aug 9 18:39:11 EDT 2009

Todd,

I believe the ability to put predicate types in require/typed is
unsound and soon to be unsupported.  Sam can probably say more on that
subject if need be.  I recommend using number? to point Typed Scheme
in the right direction (as in the email I sent a few seconds ago,
which you likely had not received when you sent the below).

Carl Eastlund

On Sun, Aug 9, 2009 at 6:35 PM, Todd O'Bryan<toddobryan at gmail.com> wrote:
> As so often happens, just after sending this message I realized that I
> needed to convince Typed Scheme that real? is a predicate for Number,
> so I added
>
> (require/typed scheme [real? (Any -> Boolean : Number)])
>
> at the top, and it now works.
>
> On Sun, Aug 9, 2009 at 6:28 PM, Todd O'Bryan<toddobryan at gmail.com> wrote:
>> Thank you. I'm now making progress...
>>
>> However, I've hit a Typed Scheme hiccup.
>>
>> (define (positive-real? v)
>>  (and (real? v) (>= v 0)))
>>
>> won't type check because it thinks the second v is just an Any.
>>
>> I tried adding a type annotation (ann v Number) with a begin around
>> the second part of the and, but that didn't help.
>>
>> Anybody know how to give Typed Scheme the hint it needs here?
>>
>> Todd


Posted on the users mailing list.