[racket] typed racket cps, state machines

From: Alexander D. Knauth (alexander at knauth.org)
Date: Sun Sep 7 08:20:17 EDT 2014

On Sep 6, 2014, at 11:41 PM, Anthony Carrico <acarrico at memebeam.org> wrote:

> On 09/06/2014 02:00 PM, Matthias Felleisen wrote:
>> 
>> p.s. I have figured out the syntax. I am not sure what you want with
>> 'loop' but in any case, this all type checks.
> 
> It is just a very degenerate case of my problems, with everything else gone, an infinite loop nested in the most basic polymorphic type I could think of.
> 
>> On Sep 6, 2014, at 1:58 PM, Matthias Felleisen wrote:
>>> This type checks fine in v6.1 though I can't read the dang syntax
>>> and I thought I was someone who should be able to do just that :-)
> 
> LOL
> 
> I had been using, Racket v6.0.0.5, but here is a machine with 6.0.1, and actually I just downloaded 6.1. All give the same answer:
> 
> $ racket --version
> Welcome to Racket v6.1.
> 
> $ cat loop.rkt
> #lang typed/racket/base
> 
> (define #:∀ (V) (fn (r : V)) : V
> (define (loop) : Void (loop))
> r)
> 
> $ racket loop.rkt
> loop.rkt:4:10: Type Checker: insufficient type information to typecheck. please add more type annotations
>  in: loop
>  context...:
>   /home/acarrico/src/racket/collects/racket/private/map.rkt:21:13: map
> /home/acarrico/src/racket/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-let-unit.rkt:147:26

Well, that doesn’t type check for me on v6.1.0.5, but using (: loop : [-> Void]) fixes it:
#lang typed/racket/base

(: fn : (All (V) [V -> V]))
(define (fn r)
  (: loop : [-> Void])
  (define (loop) (loop))
  r)


> 
> 
> ...etc.
> 
> -- 
> Anthony Carrico
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users



Posted on the users mailing list.