Hi all,

I noticed something weird today when playing around with typed racket (and
flirting with the idea of using it in production).

If I do something like:

-> (ann (cons 'a 1) (Pairof Any Any))
- : (Pairof Any Any)
'(a . 1)

That works as expected.  As does:

-> (define t (cons 'a 1))
-> (ann t (Pairof Any Any))
- : (Pairof Any Any)
'(a . 1)

Now, if I do

-> (ann (hash 'a 1 'b "cat") (HashTable Any Any))
- : (HashTable Any Any)
'#hash((a . 1) (b . "cat"))

That also works as expected.  Things get weird if I do:

-> (define t* (hash 'a 1 'b "cat"))
-> (ann t* (HashTable Any Any))

This gives a type mismatch error:

; readline-input:30:5: Type Checker: type mismatch
;   expected: (HashTable Any Any)
;   given: (HashTable Symbol (U String One))
;   in: t*


Am I being completely daft here?  Is there some hidden knowledge
required to use
hash tables here?

Note that the following also does not work:

-> (ann t* (HashTable Symbol (U String Integer)))
; readline-input:31:5: Type Checker: type mismatch
;   expected: (HashTable Symbol (U Integer String))
;   given: (HashTable Symbol (U String One))
;   in: t*

Regards,

Matthew Eric

-- 
Matthew Eric Bassett | http://mebassett.info

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to