The following gives an error of "Expected Nothing, but got D in elem."
Type checking error?
#lang typed/racket/base
(struct: (D C) Collection ([append : (D -> Void)]
[build : (-> C)]))
(: List-Builder (All (D) -> (Collection D (Listof D))))
(define (List-Builder)
(: lst (Listof D))
(define lst '())
(Collection (λ: ((datum : D))
(set! lst (cons datum lst)))
(λ () lst)))
(: build-Collection (All (D C) (Collection D C)-> C))
(define (build-Collection collection)
((Collection-build collection)))
(: append-Collection (All (D C) (Collection D C) D -> Void))
(define (append-Collection coll elem)
((Collection-append coll) elem))
____________________
Racket Users list:
http://lists.racket-lang.org/users