Hi all,

I'm really having a lot of fun playing with typed racket these days.

But I keep hitting some confusing issues with hash tables.

The following bit of code works fine in #lang racket but chokes on #lang
typed/racket:

(match (hash 'low 5 'high 5)
  [(hash-table ('low (? integer? low))
               ('high (? integer? high)))
   (list low high)])

racket responds with:

Type Checker: Polymorphic function `hash-map' could not be applied to
arguments:
Domains: HashTableTop (-> Any Any c)
         (HashTable a b) (-> a b c)
Arguments: (HashTable Symbol Integer) (All (a) (-> a * (Listof a)))
 in: (match (hash (quote low) 5 (quote high) 5) ((hash-table ((quote
low) (? integer? low)) ((quote high) (? integer? high))) (list low high)))

In an ideal world, I would use (match (bytes->jsexpr
hopefuly-valid-json-bytes) [(hash-table ...)]) to extract typed
parameters from some json input in a reasonable way.  But perhaps I'm
abusing match.

For the moment set that problem aside - why doesn't my match work in
typed racket?  What am I not understanding?

Thanks,

M.e.


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

Reply via email to