[racket] An error with dates and types

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon Aug 22 09:50:41 EDT 2011

On Mon, Aug 22, 2011 at 7:32 AM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
> On Sun, Aug 21, 2011 at 9:40 PM, Norman Gray <norman at astro.gla.ac.uk> wrote:
>>  date->seconds has a sort of core-ish feel."
>
> That's correct.  There are two problems here: first, `date->seconds'
> is missing a type, along with most of the rest of the `racket/date'
> library.

Unfortunately, Typed Racket isn't sophisticated enough yet to allow
these functions to have types directly [1].  There's now a
`typed/racket/date' library instead, and this program works correctly:

#lang typed/racket
(require typed/racket/date)
(current-seconds)
(date->seconds (seconds->date (current-seconds)))

>  Second, there's a bug in Typed Racket that causes the error
> you saw.  I hope to fix both shortly.

It turns out that bug was already fixed in HEAD.

[1] `date->seconds' has a contract, and the expansion of contracts
confuses Typed Racket's type checker.  This is something I'm currently
working on fixing, but it's a larger issue.
-- 
sam th
samth at ccs.neu.edu



Posted on the users mailing list.