Continuations don’t return. In a set-oriented type system this means their 
result type is the empty set: 

#lang typed/racket

(define-type EmptySet (U))

(: d-or-s (U False (-> Number EmptySet)))
(define d-or-s #f)

(: double-or-same (-> Number Number))
(define (double-or-same x)
 (call/cc (lambda ({c : (-> Number EmptySet)})
            (set! d-or-s c)
            (+ x x))))


> On Aug 29, 2016, at 2:18 PM, Sourav Datta <soura.ja...@gmail.com> wrote:
> 
> Hey everyone,
> 
> I am a beginner in Racket and recently learned the basic concepts of 
> continuations. I like Racket's support of multiple types of continuations as 
> opposed one type in Scheme. Recently I also started learning about typed 
> Racket. My problem is, I am not sure how I can annotate a continuation in a 
> typed racket program. For example, when trying to annotate the below code:
> 
> #lang racket
> 
> (define d-or-s #f)
> 
> (define (double-or-same x)
>  (call/cc (lambda (c)
>             (set! d-or-s c)
>             (+ x x))))
> 
> in typed racket, I can see that double-or-same function can have type 
> (Integer -> Integer). But what should be the type of the variable do-or-s? If 
> it is Any, then it cannot be called like a function after the continuation is 
> set to it. So basically my question is how can we type annotate different 
> types of continuations starting from a simple one like the above? Also a 
> pointer to the relevant section in typed racket docs would be great.
> 
> Thanks!
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to