[racket] An error with dates and types

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Sun Aug 21 13:38:38 EDT 2011

Plain require works fine in Typed Racket; there's only a problem if TR
cannot typecheck the resulting code.  You normally only need to use
require/typed to assign types to otherwise-untyped imports.  The error
Norman reported looks like an internal error in TR related to the
contract on date->seconds.  Using require/typed is a workaround
because it avoids typechecking contract-wrapped references.

Carl Eastlund

On Sun, Aug 21, 2011 at 1:16 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> You shouldn't be able to use plain require in Typed Racket.
>
> Try this:
>
> #lang typed/racket
> (require/typed racket/date (date->seconds (date -> Natural)))
> (date->seconds (seconds->date (current-seconds)))
>
>
> On Aug 21, 2011, at 11:06 AM, Norman Gray wrote:
>
>>
>> Greetings.
>>
>> Another typed-racket problem, I'm afraid.
>>
>> With the following script, I get an error message from Typed Racket which is not, I think, really addressed to me.
>>
>> (Is the list generally OK for straight bug reports?  There isn't a bug parade I should be posting this on, is there?)
>>
>> All the best,
>>
>> Norman
>>
>>
>> % cat dates.rkt
>> #lang typed/racket
>> (require (only-in racket/date date->seconds))
>> (date->seconds (seconds->date (current-seconds)))
>> % "/Data/LocalApplications/Racket/5.1.3/bin/racket" dates.rkt
>> for: expected a sequence for i, got something else: (tc-results (list (tc-result Variable-Reference (#0=Top | #0#) -)) #f)
>>
>> === context ===
>> /Data/LocalApplications/Racket/5.1.3/collects/racket/private/for.rkt:445:2: make-sequence
>> /Data/LocalApplications/Racket/5.1.3/collects/typed-scheme/types/utils.rkt:103:2: ret
>> temp871
>> /Data/LocalApplications/Racket/5.1.3/collects/typed-scheme/typecheck/tc-expr-unit.rkt:201:4: loop
>> /Data/LocalApplications/Racket/5.1.3/collects/racket/private/map.rkt:18:11: map
>> parse-loop1141
>> /Data/LocalApplications/Racket/5.1.3/collects/typed-scheme/typecheck/tc-expr-unit.rkt:330:0: tc-expr
>> /Data/LocalApplications/Racket/5.1.3/collects/racket/private/map.rkt:18:11: map
>> temp971
>> /Data/LocalApplications/Racket/5.1.3/collects/typed-scheme/typecheck/tc-expr-unit.rkt:330:0: tc-expr
>> /Data/LocalApplications/Racket/5.1.3/collects/racket/private/map.rkt:18:11: map
>> temp971
>> /Data/LocalApplications/Racket/5.1.3/collects/typed-scheme/typecheck/tc-expr-unit.rkt:330:0: tc-expr
>> parse-loop26
>> dots-loop
>> /Data/LocalApplications/Racket/5.1.3/collects/racket/private/map.rkt:18:11: map
>> ...
>>
>> %
>>
>>
>> --
>> Norman Gray  :  http://nxg.me.uk
>> School of Physics and Astronomy, University of Glasgow, UK



Posted on the users mailing list.