Hello,

I had some trouble finding my bugs in the following similar programs:


#lang typed/racket/base

(struct H ([I : (HashTable Integer Number)]))
(define J (cast 1 Nonnegative-Integer))
(define K (H (make-immutable-hash (list (cons J J)))))

(struct-copy H K [I (make-immutable-hash (list (cons J J)))])

;make-immutable-hash is type (HashTable Integer Integer) which is not 
compatible with (HashTable Integer Number)

(struct U ([V : (HashTable Nonnegative-Integer Integer)]))
(define W (cast 1 Nonnegative-Integer))
(define Y (cast 2 Integer))
(define X (U (make-immutable-hash (list (cons W Y)))))

(struct-copy U X [V (make-immutable-hash (list (cons W Y)))])

;make-immutable-hash is of type (HashTable Integer Integer) while (list (cons W 
Y)) is of the right type: (Listof (Pairof Nonnegative-Integer Integer))


In my program the problem was because of unions (I tried updating with a hash 
with only 1 of the union types)


Kind regards,

Bert

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