[racket] constructing a boolean that's a filter for a given type? could be automatic?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Jan 30 16:04:00 EST 2012

And what do you say to this: 

> I admit that that error just makes my eyes glaze over, but I'm pretty sure that the problem here is that TR can't reduce this filter type, and just needs a cleverness injection.

-- Matthias

On Jan 30, 2012, at 3:54 PM, Sam Tobin-Hochstadt wrote:

> On Mon, Jan 30, 2012 at 3:48 PM, John Clements
> <clements at brinckerhoff.org> wrote:
>> Looking at this, though, it seems to me that it might be simpler just to ask TR to construct a filter for a given type, and it occurs to me that this might already be built-in.  If so, I can't find it in the documentation.
> What you want is `define-predicate':
> #lang typed/racket
> (define-type GradeElement
> (Pair Bytes Null))
> ;; this line is not required
> (: grade-element? (Any -> Boolean : GradeElement))
> (define-predicate grade-element? GradeElement)
> Docs here: http://docs.racket-lang.org/ts-reference/special-forms.html#%28form._%28%28lib._typed-racket/base-env/prims..rkt%29._define-predicate%29%29
> -- 
> sam th
> samth at ccs.neu.edu
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

Posted on the users mailing list.