[racket] Typed Racket - Type Check Failures (Bugs???) With Samples

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Fri Aug 3 12:02:53 EDT 2012

On Tue, Jul 31, 2012 at 5:04 PM, Ray Racine <ray.racine at gmail.com> wrote:
> Hi,
>
> I created a github repo which has a few small files which I think
> demonstrate 0, 1 or 3 bugs in Typed Racket.

I finally got a chance to take a look at this, sorry for the delay.

> The three potential bugs.
> 1. The show stopper is found at the very bottom of samples.rkt.

This is not a bug in Typed Racket; you aren't creating enough streams.
 I don't fully understand how iteratees are supposed to work, but
roughly, you're trying to produce and (Iteratee A (Iteratee A D)).
For a `Continue` structure to match this, its `step` function has to
take `(Stream A)` as input, and produce `(Iteratee A (Iteratee A D))`.
 However, the `iter` value that you're producing is of type `(Iteratee
A D)`, which isn't what you want.  Your `tee` function produces an
iteratee that, I think, always stays at the beginning of its argument,
which isn't what you want.

> 2. There is a something, I think, not quite right just above #1 also in
> samples.rkt.  The inferencer appears to rashly and prematurely assume
> (Enumerator Integer A) here is (Enumerator Integer Integer).

What would `A` be bound to here?  Do you want the result to be (All
(A) (Enumerator Integer A))?  If so, you'll need to change the type of
`enumerator/list` to:
    (: enumerator/list (All (D) (Listof D) -> (All (A) (Enumerator D A))))

That will require some other changes in the rest of the `samples.rkt`
file, it looks like.
-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.