[racket] define-type on List and Listof

From: Alexander D. Knauth (alexander at knauth.org)
Date: Tue Jun 17 20:48:03 EDT 2014

Could you represent it with something like (All (a …) (List a … a))?  

>From reading the documentation it seems like it should work, but
When I tried it, I got this:

#lang typed/racket

(define-type MyList (All (a ...) (List a ... a)))

(ann '(1 2 3) (MyList 1 2 3))

. Type Checker: Type MyList cannot be applied, arguments were: (One 2 3) in: (MyList 1 2 3)

On Jun 17, 2014, at 8:33 PM, J. Ian Johnson <ianj at ccs.neu.edu> wrote:

> I imagine it's because there are no variable-arity type constructors in TR, and (List A ...) is fancy syntax for (Pairof A (Pairof ...  '()) ...) if that notation makes any sense.
> -Ian
> ----- Original Message -----
> From: "Spencer Florence" <spencer at florence.io>
> To: "racket" <users at racket-lang.org>
> Sent: Tuesday, June 17, 2014 5:32:55 PM GMT -05:00 US/Canada Eastern
> Subject: [racket] define-type on List and Listof
> 
> 
> 
> Hi all, 
> 
> I'm trying to rename some types in typed/racket but something odd is happening: 
> 
> 
> (define-type A Listof) 
> 
> works but: 
> 
> 
> (define-type B List) 
> 
> errors with "Type Checker: parse error in type; type name `List' is unbound in: List" 
> 
> Is this a bug or am I missing something? 
> 
> --Spencer 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.