<div>The following gives an error of "Expected Nothing, but got D in elem." Type checking error?</div><div><br></div><div>#lang typed/racket/base</div><div><br></div><div>(struct: (D C) Collection ([append : (D -> Void)]</div>
<div> [build : (-> C)]))</div><div><br></div><div>(: List-Builder (All (D) -> (Collection D (Listof D))))</div><div>(define (List-Builder)</div><div> </div><div> (: lst (Listof D))</div>
<div> (define lst '())</div><div> </div><div> (Collection (ë: ((datum : D))</div><div> (set! lst (cons datum lst)))</div><div> (ë () lst)))</div><div> </div><div>(: build-Collection (All (D C) (Collection D C)-> C))</div>
<div>(define (build-Collection collection)</div><div> ((Collection-build collection)))</div><div><br></div><div>(: append-Collection (All (D C) (Collection D C) D -> Void))</div><div>(define (append-Collection coll elem)</div>
<div> ((Collection-append coll) elem))</div><div><br></div>