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:

makes-foo.rkt:

#lang typed/racket

(provide (struct-out Foo)
         get-a-foo)

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

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


uses-foo.rkt:

#lang racket

(require "makes-foo.rkt")

(define a (get-a-foo))


This doesn’t typecheck (at least not in version  6.11.0.2--2017-11-05, 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?


John





-- 
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 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to