[racket] What am I doing wrong in this typed racket program?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Tue Sep 18 17:53:38 EDT 2012

The problem here is that `Any` is a special contract which isn't a
"chaperone contract", and `set/c` requires chaperone contracts.

It's not obvious to me if this can be detected statically, but you can
work around this by changing `Any` to some other type.

Sam

On Tue, Sep 18, 2012 at 5:44 PM, Tony Garnock-Jones <tonyg at ccs.neu.edu> wrote:
> Hi all,
>
> What could I be doing wrong here?
>
>     #lang typed/racket
>     (provide (struct-out foo))
>     (struct: foo ([bar : (Setof Any)]))
>
> Racket 5.3.0.24 complains about it ("racket problem.rkt"):
>
>     set/c: contract violation
>       expected: chaperone-contract?
>       given: #<make-contract>
>       context...:
>        /Users/tonyg/src/racket-typed-matrix/problem.rkt: [running body]
>
> The complaint vanishes if I comment out the provide, remove the bar
> field, or change the bar field's type to Any/Integer/etc.
>
>   Tony
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users



-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.