[plt-scheme] Typed Scheme polymorphic variadic functions
On Tue, Mar 17, 2009 at 3:01 PM, Stevie Strickland <sstrickl at ccs.neu.edu> wrote:
> On Mar 17, 2009, at 2:31 PM, Anthony Cowley wrote:
>>
>> I am now having problems with the union type constructor:
>> (U A ... A)
>> is this also not currently supported?
>
> No, it also isn't. In fact, I think Values may be the only one supported
> right now, though I need to check with Sam and make sure he hasn't added any
> extra ones that I don't know about.
I think that should be reflected in the documentation then. It's a
very powerful type system feature, but the current limitations seem
rather severe.
>> This type almost works, but not quite if I (apply check-all
>> list-of-tests):
>> (: check-all (All (A ...) ((List (-> A) A String) ... A -> Void)))
>
> What you want here makes sense, if I'm reading it correctly, but I think the
> problem is that it can't infer the correct types with which to instantiate
> the dotted type variable A. I'll check and see what kind of types apply
> looks for already -- it's likely that you're giving a polymorphic argument
> (check-all) to a polymorphic function (apply) and thus the inference
> algorithm fails. That sort of case is another area where future work is
> planned.
>
> Stevie
I think it just depends on how the dotted pre-type expansion works,
but it seems reasonable to expect it to unify with a List type since
that what it is purported to be itself.
Anthony