If I understand it correctly this is the correct way to annotate functions defined in a letrec in Typed Racket:
#lang typed/racket
(letrec ((is-even? (lambda ((n : Nonnegative-Integer))
: Boolean
(or (zero? n)
(is-odd? (sub1 n)))))
(is-odd? (lambda ((n : Nonnegative-Integer))
: Boolean
(and (not (zero? n))
(is-even? (sub1 n))))))
(is-odd? 11))
However this gives the error message:
Type Checker: insufficient type information to typecheck. please add more
type annotations in: is-odd?
A workaround is this:
(local ((: is-even? : Nonnegative-Integer -> Boolean)
(define (is-even? n)
(or (zero? n)
(is-odd? (sub1 n))))
(: is-odd? : Nonnegative-Integer -> Boolean)
(define (is-odd? n)
(and (not (zero? n))
(is-even? (sub1 n)))))
(is-odd? 11))
Also forms of the legacy notation work such as this question but I would expect to be able to annotate letrec using current notation too.