[racket] Typed Racket: (Parameterof (HashTable ...))

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Feb 14 21:29:00 EST 2014

On 2014-02-14 20:17:44 -0500, Greg Hendershott wrote:
> This is an error:
>
>     (: ph (Parameterof (HashTable Symbol String)))
>     (define ph (make-parameter (make-hash)))

Here's one way to get this to typecheck:

  (: ph (Parameterof (HashTable Symbol String)))
  (define ph (make-parameter (ann (make-hash) (HashTable Symbol String))))

but it is annoying to have to put a seemingly redundant type annotation
there.

I'm guessing the problem is that the expected type from the annotation
of ph is not propagated correctly while the type inference system tries
to infer the concrete type for `make-parameter`. It looks like
something we could fix, but it might not be an obvious fix.

Cheers,
Asumu

Posted on the users mailing list.