[racket] Typed Racket: Parametricity foils equality checking?
I can't tell whether this is a bug. In the program below, remove-duplicates doesn't remove duplicates. This looks like an attempt to preserve parametricity a la theorems for free, but I don't think that TR actually tries to guarantee parametricity in this sense. I'm guessing that the values in the list are being wrapped in contracts that prevent 'eq?'-checking; I thought that chaperones were supposed to... no, I shouldn't even finish that sentence.
Anyhow, I'm just writing to make sure that this isn't a bug. It's certainly not the behavior that I would naively expect. I can certainly work around the bug by substituting a more specific type for remove-duplicates, as in the commented-out version.
John
#lang typed/racket
(require/typed racket
[remove-duplicates (All (T) (Listof T) -> (Listof T))]
#;[remove-duplicates ((Listof Symbol) -> (Listof Symbol))])
(remove-duplicates '(a b c a d)) ;; => produces '(a b c a d)--that is, a list with duplicates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4370 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20121101/1c5116b2/attachment-0001.p7s>