Re: [racket-users] hash-ref in typed Racket

2020-11-25 Thread Tim Jervis
For the record, this seems to work fine: #lang typed/racket (require/typed racket [hash-ref ((Immutable-HashTable Symbol (U (-> String) String)) Symbol (U String (-> String))

Re: [racket-users] hash-ref in typed Racket

2020-11-25 Thread Sam Tobin-Hochstadt
That particular pattern, with `(U String (-> String))`, will work, but your generalized version would be wrong if it worked. Consider: ``` (: unsound : (Immutable-HashTable Symbol (-> String)) -> String) (define (unsound h) ((hash-ref h (gensym) (lambda () "x" (unsound (hash)) ``` This pro