[plt-scheme] A new version of Typed Scheme
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