(: foo : -> Integer)
(define (foo)
(let/cc r
(r 1)))
The above program will report
Type Checker: Cannot apply expression of type Any, since it is not a function type in: (r 1)
How to let type checker knows the type of r
?
(: foo : -> Integer)
(define (foo)
(let/cc r
(r 1)))
The above program will report
Type Checker: Cannot apply expression of type Any, since it is not a function type in: (r 1)
How to let type checker knows the type of r
?
You need to annotate the binding of r
:
#lang typed/racket
(: foo : -> Integer)
(define (foo)
(let/cc r : Integer
(r 1)))
Oh! I was trying something like r : (-> Integer Integer)
A regular continuation returns nothing, so the type of r is actually (-> Integer Nothing)
. However, since we know r
is always a function and it always returns nothing, you just need to give the input type.