[racket] how to define-predicate for a recursive type?

From: Eric Dobson (endobson at cs.brown.edu)
Date: Wed Aug 8 23:37:08 EDT 2012

No, my change does not solve that, but I'll try looking into it. The
issue is in how recursive contracts are generated.



On Wed, Aug 8, 2012 at 12:11 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> I think this will be fixed soon, once I merge Eric's pull request
> https://github.com/plt/racket/pull/121 .
>
> Sam
>
> On Wed, Aug 8, 2012 at 3:00 PM, Erik Silkensen <eriksilkensen at gmail.com> wrote:
>> Hi,
>>
>> The code
>>
>> #lang typed/racket
>>
>> (define-type IntList (Rec List (Pair Integer (U List Null))))
>> (define-predicate int-list? IntList)
>>
>>> (int-list? '(1 2 3))
>>
>> gives the runtime error:
>>
>> recursive-contract: expected a flat contract or a value that can be coerced into one, got #<impersonator-recursive-contract>
>>
>> Is there a way to generate a predicate for a type like this?
>>
>> Thanks,
>> Erik
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users
>
>
>
> --
> sam th
> samth at ccs.neu.edu
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.