[racket] Typed Racket can't filter non-false yet?

From: John Clements (clements at brinckerhoff.org)
Date: Mon Jan 30 15:54:47 EST 2012

On Jan 30, 2012, at 12:53 PM, Sam Tobin-Hochstadt wrote:

> On Mon, Jan 30, 2012 at 3:37 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> On Mon, Jan 30, 2012 at 3:22 PM, John Clements
>> <clements at brinckerhoff.org> wrote:
>>> Am I missing something obvious in either of these?
>> 
>> No.  Typed Racket doesn't have type subtraction, which is what you
>> need in the first case. I'm not sure why the second case isn't working
>> right; I think the type of `filter' is a little too restrictive.
> 
> Thinking more about the second case, the problem is that you want the
> type of `pair?' to be:
> 
> (All (A) (A -> Boolean : A \intersect (Pairof Any Any))
> 
> But the type of `pair?' is:
> 
> (Any -> Boolean : (Pairof Any Any))

Yes, I agree, and intersection types occurred to me in this case too.  I assume you're speaking hypothetically: TR doesn't support intersections, does it?

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120130/dde5d436/attachment.p7s>

Posted on the users mailing list.