[racket] Polymorphic types

From: Alexander D. Knauth (alexander at knauth.org)
Date: Sat Jan 17 21:26:56 EST 2015

There is a typed/json module in the snapshot build.
But for that they just use ‘null instead of an arbitrary type.

On Jan 17, 2015, at 9:20 PM, Jordan Johnson <jmj at fellowhuman.com> wrote:

> 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
> 
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.