diff --git a/typed-map-lib/typed-map/main.rkt b/typed-map-lib/typed-map/main.rkt index 8f3963e..15074a2 100644 --- a/typed-map-lib/typed-map/main.rkt +++ b/typed-map-lib/typed-map/main.rkt @@ -85,4 +85,4 @@ upcast-result))))))] [(_ f init-acc lᵢ ...) (with-syntax ([(argᵢ ...) (generate-temporaries #'(lᵢ ...))]) - #'(foldr (λ (argᵢ ... arg-acc) (f argᵢ ... arg-acc)) init-acc lᵢ ...))])) + #'(foldl (λ (argᵢ ... arg-acc) (f argᵢ ... arg-acc)) init-acc lᵢ ...))])) diff --git a/typed-map-test/typed-map/test/gh-bug-2.rkt b/typed-map-test/typed-map/test/gh-bug-2.rkt new file mode 100644 index 0000000..951fe0f --- /dev/null +++ b/typed-map-test/typed-map/test/gh-bug-2.rkt @@ -0,0 +1,9 @@ +#lang typed/racket +(require typed-map + typed/rackunit) + +(check-equal? (foldl (λ (x [acc : (Rec R (U Null (Pairof R Positive-Index)))]) + (cons acc (add1 x))) + '() + '(1 2 3)) + '(((() . 2) . 3) . 4)) \ No newline at end of file