It looks to me like TR can’t generate contracts for prefab structs in a way 
that I would expect it to. Specifically, here’s a TR file and a Racket file 
that uses a TR-defined prefab structure:


#lang typed/racket

(provide (struct-out Foo)

(struct Foo ([a : String]) #:prefab)

(define (get-a-foo)
  (Foo "oeuth”))


#lang racket

(require "makes-foo.rkt")

(define a (get-a-foo))

This doesn’t typecheck (at least not in version, tell me 
if I should just upgrade), with the message:

Type Checker: could not convert type to a contract;
 contract generation not supported for this type
  identifier: get-a-foo
  type: (-> Foo) in: (get-a-foo)

My first thought was that this was related to mutability, but the docs and my 
experiments suggest that prefab structures are default-immutable, and that this 
is reflected in a way that should be visible to the type-checker. Am I missing 
something, or is this just something that we haven’t yet had time to implement?


You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to