[racket] A Typed Racket question

From: Vincent St-Amour (stamourv at ccs.neu.edu)
Date: Fri May 3 09:55:03 EDT 2013

At Fri, 03 May 2013 20:29:42 +1200,
Сергей Самойленко wrote:
> 
> Hello!
> 
> Type checker returns an error while translating this piece of code:
> 
> (: permutations ((Listof Index) ->  (Listof (Listof Index))))
> (define (permutations lst)
>   (cond
>     [(empty? lst) '(())]
>     [else (for*/list: : (Listof (Listof Index)) 
>             ([x : Index (in-list lst)]
>              [y : (Listof Index) (in-list (permutations (remq x lst)))])
>             (cons x y))]))
> 
> 'Type Checker: Error in macro expansion -- insufficient type information to typecheck. please add more type annotations in: (for*/list: : (Listof (Listof Index)) ((x : Index (in-list lst)) (y : (Listof Index) (in-list (remq x lst)))) (cast (cons x y) (Listof Index)))'
> 
> Is it possible to give more type annotations in this case?

It's not. The error message is misleading.

This bug is fixed in the next version of Racket (due any time now). You
can try a prerelease build here:

  http://pre.racket-lang.org/release/installers/

Vincent


Posted on the users mailing list.