Hi,

this is hopefully easier, but I can't figure out how to `(require/typed 
gregor)` inside a typed racket file. Here are my failed attempts (I want 
time to work, hence I try to import gregor/time):

```
#lang typed/racket

; Try to get time struct from gregor/time
(require/typed gregor/time
               [#:struct time ([hour : Integer] 
                               [minute : Integer]
                               [second : Integer]
                               [nanosecond : Integer])])

; This just checks that the time structure isn't in gregor
(require/typed gregor
               [#:struct time ([hour : Integer] 
                               [minute : Integer]
                               [second : Integer]
                               [nanosecond : Integer])]
               [current-time (->* () (#:tz String) time)])
```

These fail with errors of the kind 

"
only-in: identifier `struct:time' not included in nested require spec
at: gregor
in: (only-in gregor struct:time (time time2))
"

So, maybe I am wrong to think that time is a struct. But when I print one 
in the REPL, it says #<time ...>, which I thought would mean it's a struct.

My next step was to check the type of it in the REPL with typed racket... 
but that doesn't work since requiring gregor in a REPL with typed/racket 
leads to the same errors (obviously, since how would it know anything 
more...). 

Hence, I fire up DrRacket, following the trail to the definition of the 
time structure and I find that the structure itself is never provided out, 
but only used to define the function `time?` and others. But that makes me 
wonder: how can I define the type for time so that I can use gregor inside 
typed/racket if I can't import the structure (which in my understanding 
defines the type of time)? I can't figure out what thing `(current-time)` 
is, apparently  `(struct Time (hms ns) ...)` but I don't see any contracts 
on hms or ns to figure out what they are... but even if I did, would I 
define my own structure `(struct my-time ([hms : HMS] [ns : NS])` and use 
that? 

Cheers,
Marc

PS: If any Vim users our there can tell me how to jump to definitions of 
required libraries I'd be ever so happy.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/fddb26f2-31d9-4228-b44f-73ea30d98220%40googlegroups.com.

Reply via email to