[racket] typing a function
Type inference here does not want to annoy users by assigning a singleton type to the f binding, since this can cause more problems. You'll need to change (define f -1) to (define: f : -1 -1) if you really want this to type.
-Ian
----- Original Message -----
From: "Pierpaolo Bernardi" <olopierpa at gmail.com>
To: users at racket-lang.org
Sent: Wednesday, November 21, 2012 12:34:29 PM GMT -05:00 US/Canada Eastern
Subject: Re: [racket] typing a function
Another puzzle. Why the following, as written, does not type:
========
#lang typed/racket
(define-type sex (U -1 0 1))
(struct: sexomino
((n : sex)
(e : sex)
(s : sex)
(o : sex)))
(: sexomini (Listof sexomino))
(define sexomini
(let ()
(define n 0)
(define f -1)
(define m 1)
(define s sexomino)
(list (s n m n n) (s f f n n))))
========
while it works if I change the last line to:
(list (s n m n n) (s -1 -1 n n))))
?
Cheers
P.
____________________
Racket Users list:
http://lists.racket-lang.org/users