[racket-dev] using 'sort' in typed/racket?

From: John Clements (clements at brinckerhoff.org)
Date: Sat Aug 20 11:55:21 EDT 2011

I can't seem to make typed racket happy about using 'sort':

#lang typed/racket

((ann sort ((Listof Integer) (Integer Integer -> Boolean) -> (Listof Integer)))
 '(3 5 4) (ann < (Integer Integer -> Boolean)))


Type Checker: Expected ((Listof Integer) (Integer Integer -> Boolean) -> (Listof Integer)), but got (All (a b) (case-lambda ((Listof a) (a a -> Boolean) [#:cache-keys? Boolean] -> (Listof a))((Listof a) (b b -> Boolean) [#:cache-keys? Boolean] #:key (a -> b) -> (Listof a)))) in: sort

As far as I can tell, the type I specify is an instantiation of the given type for sort; my best guess is that the problem is that the type 'b' doesn't appear unless I use the #:key argument. My attempts to specify a #:key explicitly went even more horribly wrong.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4624 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20110820/69602d32/attachment.p7s>

Posted on the dev mailing list.