[plt-scheme] A new version of Typed Scheme

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Wed Feb 24 14:18:43 EST 2010

That was not a tested example, but I've hit it before.

Jay

On Wed, Feb 24, 2010 at 12:08 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Wed, Feb 24, 2010 at 1:55 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>> I think it would be nice to go through common problems doing
>> conversion.
>
> This is a good suggestion, but ...
>
>> A simple thing I can think of that hits me every time is
>> that I think a function will work like:
>>
>> (: f (All (A) (A -> (Listof A))))
>> (define (f a)
>>  ...)
>>
>> but f calls some polymorphic function and ts can't infer that the
>> parameter is A, so I have to re-write it to:
>>
>> (define: (A) (f [a : A]) : (Listof A)
>>  ...)
>>
>> to get the A in scope.
>
> `A' is in scope in both of these definitions:
>
> #lang typed/scheme
>
> (: f (All (A) (A -> (Listof A))))
> (define (f a)
>  (list ((inst values A) a)))
>
> works fine for me.
>
> --
> sam th
> samth at ccs.neu.edu
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

"The glory of God is Intelligence" - D&C 93


Posted on the users mailing list.