[racket] Typed Racket: Infinite Subtypes?

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Jun 10 15:27:29 EDT 2011

I'll try to respond more comprehensively about the more general
question, but for this:

On Fri, Jun 10, 2011 at 2:12 PM, Richard Lawrence
<richard.lawrence at berkeley.edu> wrote:
> And if it isn't possible, the cleanest workaround I can think of is to
> tag all Variable values, like:
> (define-type Variable (Pair 'var Symbol))
> (define-predicate variable? Variable)

Just use a struct:

(struct: variable ([s : Symbol]))

Now you have `variable' and `variable?' and `variable-s', and there's
no confusion with pairs.  That's how I'd write this code.
sam th
samth at ccs.neu.edu

Posted on the users mailing list.