From: Siraaj Khandkar Date: Mon, 22 Mar 2021 00:25:58 +0000 (-0400) Subject: Add some more type annotations X-Git-Tag: 0.13.0~2 X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=a9511f7c90c15ec37a4f5d5ffb3f602f7277b0ec;p=tt.git Add some more type annotations --- diff --git a/tt.rkt b/tt.rkt index 6914d7a..0bea719 100644 --- a/tt.rkt +++ b/tt.rkt @@ -36,13 +36,15 @@ [uri : Url]) #:type-name Feed) +(: concurrent-filter-map (∀ (α β) (-> Natural (-> α β) (Listof α)))) (define (concurrent-filter-map num-workers f xs) ; TODO preserve order of elements OR communicate that reorder is expected ; TODO switch from mailboxes to channels (define (make-worker id f) (define parent (current-thread)) (λ () - (define self (current-thread)) + (define self : Thread (current-thread)) + (: work (∀ (α) (-> α))) (define (work) (thread-send parent (cons 'next self)) (match (thread-receive) @@ -52,6 +54,7 @@ (when y (thread-send parent (cons 'result y))) (work))])) (work))) + (: dispatch (∀ (α β) (-> (Listof Nonnegative-Integer) (Listof α) (Listof β)))) (define (dispatch ws xs ys) (if (empty? ws) ys