From 5fda25a42e1386e46569ccf606c4922bfb1634c2 Mon Sep 17 00:00:00 2001 From: Sam Caldwell Date: Fri, 17 May 2019 10:34:33 -0400 Subject: [PATCH] more hash operations --- racket/typed/hash.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/racket/typed/hash.rkt b/racket/typed/hash.rkt index 86ae599..777f230 100644 --- a/racket/typed/hash.rkt +++ b/racket/typed/hash.rkt @@ -5,9 +5,11 @@ hash hash-set hash-ref + (typed-out [[hash-ref/failure- : (∀ (K V) (→fn (Hash K V) K V V))] + hash-ref/failure]) hash-has-key? hash-update - (typed-out [[hash-update/failure- : (∀ (K V) (→fn (Hash K V) K (→fn V V) (→fn V) (Hash K V)))] + (typed-out [[hash-update/failure- : (∀ (K V) (→fn (Hash K V) K (→fn V V) V (Hash K V)))] hash-update/failure]) hash-remove hash-map @@ -72,6 +74,9 @@ ;; TODO - hash-union with #:combine ) +(define- (hash-ref/failure- h k err) + (#%app- hash-ref- h k err)) + (define- (hash-update/failure- h k u err) (#%app- hash-update- h k u err))