checkpoint: example fix for msgpack failure

This commit is contained in:
Ben Greenman 2017-10-06 15:18:47 -04:00
parent 2ef852ae91
commit 6cffbfa6d8
2 changed files with 18 additions and 8 deletions

View File

@ -160,10 +160,10 @@
((vectorof/sc (#:invariant)) vectorof #:chaperone)
((promise/sc (#:covariant)) promise-not-name/c #:chaperone)
((syntax/sc (#:covariant #:flat)) syntax/c #:flat)
((hash/sc (#:invariant #:flat) (#:invariant)) hash/c #:chaperone)
((mutable-hash/sc (#:invariant #:flat) (#:invariant)) mutable-hash/c #:chaperone)
((immutable-hash/sc (#:covariant #:flat) (#:covariant)) immutable-hash/c #:flat)
((weak-hash/sc (#:invariant #:flat) (#:invariant)) weak-hash/c #:chaperone)
((hash/sc (#:invariant) (#:invariant)) tr-hash/c #:chaperone)
((mutable-hash/sc (#:invariant) (#:invariant)) mutable-hash/c #:chaperone)
((immutable-hash/sc (#:covariant) (#:covariant)) immutable-hash/c #:flat)
((weak-hash/sc (#:invariant) (#:invariant)) weak-hash/c #:chaperone)
((box/sc (#:invariant)) box/c #:chaperone)
((parameter/sc (#:contravariant) (#:covariant)) parameter/c #:chaperone)
((sequence/sc . (#:covariant)) sequence/c #:impersonator)

View File

@ -1,8 +1,18 @@
#lang racket/base
(require racket/contract)
(provide mutable-hash/c immutable-hash/c weak-hash/c)
(provide tr-hash/c mutable-hash/c immutable-hash/c weak-hash/c)
(define (mutable-hash/c k v) (and/c hash? (not/c hash-weak?) (hash/c k v #:immutable #f)))
(define (immutable-hash/c k v) (hash/c k v #:immutable #t))
(define (weak-hash/c k v) (and/c hash? hash-weak? (hash/c k v #:immutable #f)))
(define (mutable-hash/c k v)
(and/c hash? (not/c hash-weak?) (tr-hash/c k v #:immutable #f)))
(define (immutable-hash/c k v)
(tr-hash/c k v #:immutable #t))
(define (weak-hash/c k v)
(and/c hash? hash-weak? (tr-hash/c k v #:immutable #f)))
(define (tr-hash/c k v #:immutable [immutable 'dont-care])
(if (flat-contract? k)
(hash/c k v #:immutable immutable)
(and/c hash? hash-equal? (hash/c k v #:immutable immutable))))