On Sat, Jan 17, 2015 at 9:20 PM, Jordan Johnson <j...@fellowhuman.com> wrote: > Hi all, > > In playing with TR this evening, I found > >> (define-type (Foo A) >> (U A >> (List 'foo (Foo A)))) >> >> (define-predicate foo? Foo) > > generates the error “Type Foo could not be converted to a contract: cannot > generate contract for non-function polymorphic type”. I’ve read the page with > caveats about inference and polymorphic types, but since the example is about > using a function rather than defining a predicate, I’m not clear on how (if > at all) the technique could be adapted for this.
No, it can't be adapted. That error message is an instance of this caveat: http://docs.racket-lang.org/ts-guide/caveats.html#%28part._.Typed-untyped_interaction_and_contract_generation%29 which applies to `define-predicate` as well. There's no way to check if something is a `Foo`, because Typed Racket wouldn't know what you meant for `A` to be. Sam ____________________ Racket Users list: http://lists.racket-lang.org/users