# How to deal with \`let/cc\` in typed racket?

**URL:** <https://racket.discourse.group/t/how-to-deal-with-let-cc-in-typed-racket/795>\
**Category:** Questions & Answers\
**Created:** [March 14, 2022, 6:24am UTC](https://racket.discourse.group/t/how-to-deal-with-let-cc-in-typed-racket/795 "2022-03-14T06:24:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannypsnl](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dannypsnl/32/917_2.png) [@dannypsnl](https://racket.discourse.group/u/dannypsnl)\
**Post date:** [March 14, 2022, 6:24am UTC](https://racket.discourse.group/t/how-to-deal-with-let-cc-in-typed-racket/795/1 "2022-03-14T06:24:17Z")

</div>

```scheme
(: foo : -> Integer)
(define (foo)
  (let/cc r
    (r 1)))

```

The above program will report

```scheme
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`?

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [March 14, 2022, 4:32pm UTC](https://racket.discourse.group/t/how-to-deal-with-let-cc-in-typed-racket/795/2 "2022-03-14T16:32:17Z")

</div>

You need to annotate the binding of `r`:

```scheme
#lang typed/racket

(: foo : -> Integer)
(define (foo)
  (let/cc r : Integer
    (r 1)))

```

---

<div class="post-metadata">

**Author:** ![dannypsnl](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dannypsnl/32/917_2.png) [@dannypsnl](https://racket.discourse.group/u/dannypsnl)\
**Post date:** [March 15, 2022, 12:09am UTC](https://racket.discourse.group/t/how-to-deal-with-let-cc-in-typed-racket/795/3 "2022-03-15T00:09:48Z")

</div>

Oh! I was trying something like `r : (-> Integer Integer)`

---

<div class="post-metadata">

**Author:** ![capfredf](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/capfredf/32/935_2.png) [@capfredf](https://racket.discourse.group/u/capfredf)\
**Post date:** [March 16, 2022, 2:29am UTC](https://racket.discourse.group/t/how-to-deal-with-let-cc-in-typed-racket/795/4 "2022-03-16T02:29:11Z")

</div>

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.
