<div>#lang typed/racket/base</div><div><div><br></div><div>;; Inputs</div><div>(define-type (Stream D) (U (Datum D) 'Nothing 'EOS))</div><div>(struct: (D) Datum ([iota : D]))</div><div><br></div><div>;; Iteratee</div>
<div>(define-type (Iteratee D A) (U (Done D A) (Continuation D A)))</div><div>(struct: (D A) Done ([accum : A] [stream : (Stream D)]))</div><div>(struct: (D A) Continuation ([resume : ((Stream D) -> (Iteratee D A))]))</div>
</div><div><br></div><div>1. How can I get the recursive nature of Iteratee and Continuation to type check?</div><div>2. Ideally, but not necessary, like to define Continuation as a define-struct/exec: </div><div><br></div>
<div>Thanks,</div><div><br>Ray</div>