File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed
typed-racket-lib/typed-racket
static-contracts/combinators Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 160
160
((vectorof/sc (#:invariant )) vectorof #:chaperone )
161
161
((promise/sc (#:covariant )) promise-not-name/c #:chaperone )
162
162
((syntax/sc (#:covariant #:flat )) syntax/c #:flat )
163
- ((hash/sc (#:invariant #:flat ) (#:invariant )) hash/c #:chaperone )
164
- ((mutable-hash/sc (#:invariant #:flat ) (#:invariant )) mutable-hash/c #:chaperone )
165
- ((immutable-hash/sc (#:covariant #:flat ) (#:covariant )) immutable-hash/c #:flat )
166
- ((weak-hash/sc (#:invariant #:flat ) (#:invariant )) weak-hash/c #:chaperone )
163
+ ((hash/sc (#:invariant ) (#:invariant )) tr- hash/c #:chaperone )
164
+ ((mutable-hash/sc (#:invariant ) (#:invariant )) mutable-hash/c #:chaperone )
165
+ ((immutable-hash/sc (#:covariant ) (#:covariant )) immutable-hash/c #:flat )
166
+ ((weak-hash/sc (#:invariant ) (#:invariant )) weak-hash/c #:chaperone )
167
167
((box/sc (#:invariant )) box/c #:chaperone )
168
168
((parameter/sc (#:contravariant ) (#:covariant )) parameter/c #:chaperone )
169
169
((sequence/sc . (#:covariant )) sequence/c #:impersonator )
Original file line number Diff line number Diff line change 1
1
#lang racket/base
2
2
3
3
(require racket/contract)
4
- (provide mutable-hash/c immutable-hash/c weak-hash/c)
4
+ (provide tr-hash/c mutable-hash/c immutable-hash/c weak-hash/c)
5
5
6
- (define (mutable-hash/c k v) (and/c hash? (not/c hash-weak?) (hash/c k v #:immutable #f )))
7
- (define (immutable-hash/c k v) (hash/c k v #:immutable #t ))
8
- (define (weak-hash/c k v) (and/c hash? hash-weak? (hash/c k v #:immutable #f )))
6
+ (define (mutable-hash/c k v)
7
+ (and/c hash? (not/c hash-weak?) (tr-hash/c k v #:immutable #f )))
8
+
9
+ (define (immutable-hash/c k v)
10
+ (tr-hash/c k v #:immutable #t ))
11
+
12
+ (define (weak-hash/c k v)
13
+ (and/c hash? hash-weak? (tr-hash/c k v #:immutable #f )))
14
+
15
+ (define (tr-hash/c k v #:immutable [immutable 'dont-care ])
16
+ (if (flat-contract? k)
17
+ (hash/c k v #:immutable immutable)
18
+ (and/c hash? hash-equal? (hash/c k v #:immutable immutable))))
You can’t perform that action at this time.
0 commit comments