In typed Racket I define a hashtable:
(: vector-to-contract (HashTable TType CContract))
(define vector-to-contract
(make-hash
(cast '(
(_bytes . bytes?)
(_s8vector . s8vector?)
(_u16vector . u16vector?)
(_s16vector . s16vector?)
(_u32vector . u32vector?)
(_s32vector . s32vector?)
(_u64vector . u64vector?)
(_s64vector . s64vector?)
(_f32vector . f32vector?)
(_f64vector . f64vector?))
(Listof (Pair TType CContract))
)
))
And then I try to look something up in it:
( hash-ref vector-to-contract (cast '_bytes TType) (cast 'other CContract))
and I am informed that I cannot, it seems, look up a value of type
TType in a hastable whose type indicates it looks up things of type
TType:
Type Checker: Polymorphic function `hash-ref' could not be applied to arguments:
Types: HashTableTop a (-> c) -> Any
HashTableTop a False -> Any
HashTableTop a -> Any
Arguments: (HashTable TType CContract) TType CContract
Expected result: AnyValues
in: (hash-ref vector-to-contract (cast (quote _bytes) TType) (cast
(quote other) CContract))
How *does* one use hashtables in typed Racket?
-- hendrik
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/racket-users/20200421143453.lauuqi3pb4fdgyhh%40topoi.pooq.com.