
This allows the types generated by the struct form, as well as #:struct clauses of require/typed, to be specified explicitly using a #:type-name option. This allows the name of a struct and the type it is assigned to be different. Closes #261
13 lines
240 B
Racket
13 lines
240 B
Racket
#lang typed/racket/base
|
|
|
|
(struct (A) s ([f : A]) #:type-name S)
|
|
|
|
(define si : (S String) (s "foo"))
|
|
(ann (s-f si) String)
|
|
|
|
(define-struct/exec exec ()
|
|
[(λ (e x) (add1 x)) : (Exec Real -> Real)]
|
|
#:type-name Exec)
|
|
|
|
((ann (exec) Exec) 3)
|