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

From: Erik Silkensen (eriksilkensen at gmail.com)
Date: Wed Aug 8 15:00:18 EDT 2012


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?


Posted on the users mailing list.