[racket] Typed racket and hash table

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Fri Jun 27 15:55:46 EDT 2014

On Fri, 27 Jun 2014 15:49:14 -0400
Sam Tobin-Hochstadt <samth at cs.indiana.edu>
wrote:

> On Fri, Jun 27, 2014 at 3:32 PM, Manfred Lotz
> <manfred.lotz at arcor.de> wrote:
> >
> > Argument 3:
> >   Expected: (-> b)
> >   Given:    False
> 
> 
> This is the key part of the error message: you have to provide a
> function as the third argument, and you provided `#f`. I'd just change
> that to (lambda () #f).
> 
> Sam

Ok, I did this but still not enough.

test.rkt:10:14: Type Checker: Polymorphic function `hash-ref!' could
not be applied to arguments: Argument 1:
  Expected: (HashTable a b)
  Given:    (HashTable Nonnegative-Integer (Listof String))
Argument 2:
  Expected: a
  Given:    Nonnegative-Integer
Argument 3:
  Expected: (-> b)
  Given:    (-> False)

  in: (hash-ref! my-hash size (lambda () #f))
  context...:
   /home/manfred/racket/share/pkgs/typed-racket-lib/typed-racket/typecheck/tc-toplevel.rkt:249:0:
  type-check /home/manfred/racket/share/pkgs/typed-racket-lib/typed-racket/tc-setup.rkt:40:0:
  tc-setup /home/manfred/racket/share/pkgs/typed-racket-lib/typed-racket/typed-racket.rkt:25:4
   standard-module-name-resolver


Thanks, Manfred



Posted on the users mailing list.