Suppose the following trivial function:
(define/contract (foo func)
(-> (-> any/c ... any/c) #t)
#t)
This is trying (and failing) to express the idea "foo takes a processor function. I don't care what arguments the processor requires (that's the caller's job) but the processor must return a singular result."
What would be the correct contract for foo? I've been through the section on function contracts; the above was my first guess but this fails:
(foo identity)
; foo: contract violation
; expected: a procedure that accepts 0 non-keyword arguments and arbitrarily
; many more
; given: #<procedure:identity>
; identity accepts: 1 argument
; in: the 1st argument of
; (-> (-> any/c ... any/c) #t)
; contract from: (function foo)
; blaming: top-level
; (assuming the contract is correct)
; at: readline-input:8.18
; [,bt for context]
I also tried this, which apparently isn't even legal syntax:
(define/contract (foo func)
(-> (-> any any/c) #t)
#t)
; readline-input:10:33: any: use of 'any' outside the range of an arrow
; contract
; in: any
; [,bt for context]
I think you want unconstrained-domain->