[racket] TR: Polymorphic types
Hi all,
In playing with TR this evening, I found
> (define-type (Foo A)
> (U A
> (List 'foo (Foo A))))
>
> (define-predicate foo? Foo)
generates the error “Type Foo could not be converted to a contract: cannot generate contract for non-function polymorphic type”. I’ve read the page with caveats about inference and polymorphic types, but since the example is about using a function rather than defining a predicate, I’m not clear on how (if at all) the technique could be adapted for this.
(What I was actually doing, by the way, was seeing if I could port the JSON library to TR. I ran into the problem of the null element being of arbitrary type.)
Best,
jmj