Thanks ... was show stopper.<br><br><div class="gmail_quote">On Wed, Aug 1, 2012 at 1:45 PM, Sam Tobin-Hochstadt <span dir="ltr"><<a href="mailto:samth@ccs.neu.edu" target="_blank">samth@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This looks like something that should work -- I'm not sure why TR<br>
thinks that `Nothing` is the right type to infer for the second<br>
parameter to the `Collection` type. However, changing the last line<br>
to:<br>
<br>
(((inst Collection-append D C) coll) elem))<br>
<br>
makes it typecheck.<br>
<div><div class="h5"><br>
On Wed, Aug 1, 2012 at 12:17 PM, Ray Racine <<a href="mailto:ray.racine@gmail.com">ray.racine@gmail.com</a>> wrote:<br>
> The following gives an error of "Expected Nothing, but got D in elem."<br>
> Type checking error?<br>
><br>
> #lang typed/racket/base<br>
><br>
> (struct: (D C) Collection ([append : (D -> Void)]<br>
> [build : (-> C)]))<br>
><br>
> (: List-Builder (All (D) -> (Collection D (Listof D))))<br>
> (define (List-Builder)<br>
><br>
> (: lst (Listof D))<br>
> (define lst '())<br>
><br>
> (Collection (λ: ((datum : D))<br>
> (set! lst (cons datum lst)))<br>
> (λ () lst)))<br>
><br>
> (: build-Collection (All (D C) (Collection D C)-> C))<br>
> (define (build-Collection collection)<br>
> ((Collection-build collection)))<br>
><br>
> (: append-Collection (All (D C) (Collection D C) D -> Void))<br>
> (define (append-Collection coll elem)<br>
> ((Collection-append coll) elem))<br>
><br>
><br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
sam th<br>
<a href="mailto:samth@ccs.neu.edu">samth@ccs.neu.edu</a><br>
</font></span></blockquote></div><br>