typed-racket/typed-racket-test/succeed/struct-custom-type.rkt
Alexis King a3ca5aeefc Allow the types created for structs to be specified manually
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
2015-12-30 13:12:05 -08:00

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)