There are two problems here, both of which stem from the same confusion. You're using a generic type, ListGenFunction
, without telling Typed Racket (or the reader of your program) what particular type you're using it with.
For example, f
isn't an arbitrary ListGenFunction
, it's a ListGenFunction
that works specifically on numbers. So you should write:
(: f (ListGenFunction Integer))
and
(: locf (ListGenLocFunction Integer))
Similarly, you should give generate-list
a type like this:
(: generate-list
(All (A)
((ListGenFunction A) (ListGenLocFunction A) Integer -> (Listof A))))
This is just like how you explicitly say that you're producing a (Listof A)
, not just a Listof
.