While it does work, there is definitely a loss of informative intent in the sense of the "documentation" to the human reader provided by the type signatures. If define-type is strictly an aliasing then the original construction should work and its failure a bug. Do you agree? If so I'll open a bug report.<div>
<br></div><div>Thanks again.</div><div><br></div><div>Ray<br><br><div class="gmail_quote">On Thu, Jul 19, 2012 at 6:51 PM, Ray Racine <span dir="ltr"><<a href="mailto:ray.racine@gmail.com" target="_blank">ray.racine@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nice. Thank you.<div class="HOEnZb"><div class="h5"><br><br>On Thursday, July 19, 2012, Carl Eastlund <<a href="mailto:cce@ccs.neu.edu" target="_blank">cce@ccs.neu.edu</a>> wrote:<br>
> This works if you expand the use of Iteratee within the definition of<br>> Continuation. Mutually-recursive polymorphic types are problematic,<br>
> but Continuation is only actually singly-recursive. You can still<br>> have the definition Iteratee for outside use.<br>><br>> Carl Eastlund<br>><br>> #lang typed/racket/base<br>><br>> ;; Inputs<br>
> (define-type (Stream D) (U (Datum D) 'Nothing 'EOS))<br>> (struct: (D) Datum ([iota : D]))<br>><br>> ;; Iteratee<br>> (define-type (Iteratee D A) (U (Done D A) (Continuation D A)))<br>> (struct: (D A) Done ([accum : A] [stream : (Stream D)]))<br>
> (struct: (D A) Continuation ([resume : ((Stream D) -> (U (Done D A)<br>> (Continuation D A)))]))<br>><br>><br>> On Thu, Jul 19, 2012 at 6:07 PM, Ray Racine <<a href="mailto:ray.racine@gmail.com" target="_blank">ray.racine@gmail.com</a>> wrote:<br>
>> #lang typed/racket/base<br>>><br>>> ;; Inputs<br>>> (define-type (Stream D) (U (Datum D) 'Nothing 'EOS))<br>>> (struct: (D) Datum ([iota : D]))<br>>><br>>> ;; Iteratee<br>
>> (define-type (Iteratee D A) (U (Done D A) (Continuation D A)))<br>>> (struct: (D A) Done ([accum : A] [stream : (Stream D)]))<br>>> (struct: (D A) Continuation ([resume : ((Stream D) -> (Iteratee D A))]))<br>
>><br>>> 1. How can I get the recursive nature of Iteratee and Continuation to type<br>>> check?<br>>> 2. Ideally, but not necessary, like to define Continuation as a<br>>> define-struct/exec:<br>
>><br>>> Thanks,<br>>><br>>> Ray<br>>
</div></div></blockquote></div><br></div>