[racket] specifying types for fields in non-polymorphic structures

From: David Van Horn (dvanhorn at cs.umd.edu)
Date: Fri Apr 25 21:49:06 EDT 2014

On 4/25/14, 9:38 PM, Alexander D. Knauth wrote:
> Is there a way of specifying types for fields in non-polymorphic structures?  Like this:
> (struct: posn ([x : Real] [y : Real]))
> (define-type Origin
>   (posn Zero Zero))
> I know this doesn’t work, but is there something that could work like it?

How about this?

(struct: (x y) posn ([x : x] [y : y]))
(define-type Posn (posn Real Real))
(define-type Origin (posn Zero Zero))



Posted on the users mailing list.