[racket] Typed racket and keywords

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Thu Feb 21 10:18:46 EST 2013

At Wed, 20 Feb 2013 20:49:02 -0700,
Neil Toronto wrote:
> 
> Well, you can't do it like that, but you can like this:
> 
> #lang typed/racket
> 
> (: test0 (Integer [#:zero Integer] -> Boolean))
> (define (test0 x #:zero [v 0])
>    (= x v))
> 
> I think the `Keyword' type is for symbols that happen to be keywords:
> 
>    (cast '#:zero Keyword)
> 
> I believe there is currently no way to type a function that has required 
> keywords; i.e. they have to be optional.

Mandatory keywords work too.

    (: test1 (Integer #:zero Integer -> Boolean))
    (define (test1 x #:zero v)
      (= x v))

Vincent

Posted on the users mailing list.