> On May 27, 2016, at 1:50 PM, Alex Knauth <alexan...@knauth.org> wrote:
> 
> 
>> On May 27, 2016, at 4:24 PM, 'John Clements' via Racket Users 
>> <racket-users@googlegroups.com> wrote:
>> 
>> I have a funny case in TR where occurrence typing loses information about 
>> the type of a term:
>> 
>> #lang typed/racket
>> 
>> (: expand (Sexp -> Sexp))
>> (define (expand s)
>> (match s
>>   [(list (? symbol? id) a ...)
>>    s]))
>> 
>> This fails to type check, because the occurrence of ā€™sā€™ in the rhs of the 
>> match is no longer known to be an Sexp.
> 
> In the latest snapshot versions, this type-checks. It might be because of the 
> addition of Andrew Kent's intersection types, because according to DrRacket 
> the type of the `s` in the body is:
> 
> (Pairof Symbol (U Null (Pairof Sexp (āˆ© Sexp (Listof Any)))))
> 
> which is a subtype of Sexp.
> 
> For previous versions, a workaround I've used is to add an extra 
> `my-identity` function to fool it it so that it doesn't realize that I'm 
> applying a predicate to `s` or matching on it.

Excellent! Many thanks for both the workaround and the good news about 
intersection types!

John



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to