Skip to content

Commit 6cffbfa

Browse files
committed
checkpoint: example fix for msgpack failure
1 parent 2ef852a commit 6cffbfa

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

typed-racket-lib/typed-racket/static-contracts/combinators/structural.rkt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,10 @@
160160
((vectorof/sc (#:invariant)) vectorof #:chaperone)
161161
((promise/sc (#:covariant)) promise-not-name/c #:chaperone)
162162
((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)
167167
((box/sc (#:invariant)) box/c #:chaperone)
168168
((parameter/sc (#:contravariant) (#:covariant)) parameter/c #:chaperone)
169169
((sequence/sc . (#:covariant)) sequence/c #:impersonator)
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#lang racket/base
22

33
(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)
55

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))))

0 commit comments

Comments
 (0)