[racket] Typed racket and sync/timeout
Greetings, all.
I'm getting a Typed Racket error
Type Checker: untyped identifier sync/timeout imported from module <typed/racket> in: sync/timeout
(in DrRacket 5.3.3)
Should I expect sync/timeout to be typed?
I'm trying to supply the missing type with
(require/typed racket/async-channel
;[#:opaque Async-Channel async-channel?]
[#:struct (async-channel evt) ()]
[async-channel-put (Async-Channel Any -> Void)]
[make-async-channel (-> Async-Channel)])
(require/typed racket
[#:opaque Event evt?]
[sync/timeout ((U False Nonnegative-Real) Event * -> Any)])
Using the [#:opaque Async-Channel async-channel?] appears to work fine in isolation, but I don't seem to be able to declare that async-channel is a subtype of evt (which I think I need, otherwise I get errors such as "Type Checker: Expected Event, but got Async-Channel in: ...").
However the above produces:
../../../../../Data/LocalApplications/Racket/5.3.3/collects/typed-racket/typed-racket.rkt:40:4: syntax-local-value: not defined as syntax
identifier: #<syntax:/checkouts/me/code/ldap-client/src/ldap-client.rkt:32:40 evt>
>
(line 32 of ldap-client is the #:struct line).
I'm not sure what that error message is telling me, but that doesn't look like something I can fix.
I can get round this by declaring sync/timeout to return async-channel (which it always will, in my case), but that's obviously not a general solution.
Best wishes,
Norman
--
Norman Gray : http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK