word: make word generics broadly available
This commit is contained in:
parent
1e75a43674
commit
b3d6503924
32
word.rkt
32
word.rkt
|
@ -28,24 +28,6 @@
|
||||||
(define (word-output w) #f)
|
(define (word-output w) #f)
|
||||||
(define (word-return w) w)])
|
(define (word-return w) w)])
|
||||||
|
|
||||||
(module+ generics
|
|
||||||
(provide
|
|
||||||
(contract-out
|
|
||||||
[word-fps
|
|
||||||
(-> word? flonum?)]
|
|
||||||
[word-label
|
|
||||||
(-> word? flonum? string?)]
|
|
||||||
[word-evt
|
|
||||||
(-> word? evt?)]
|
|
||||||
[word-event
|
|
||||||
(-> word? any/c word?)]
|
|
||||||
[word-tick
|
|
||||||
(-> word? word?)]
|
|
||||||
[word-output
|
|
||||||
(-> word? any/c)]
|
|
||||||
[word-return
|
|
||||||
(-> word? any/c)])))
|
|
||||||
|
|
||||||
(define (default b f d) (if b (f b) d))
|
(define (default b f d) (if b (f b) d))
|
||||||
(struct *word (fps label evt event tick output return)
|
(struct *word (fps label evt event tick output return)
|
||||||
#:methods gen:word
|
#:methods gen:word
|
||||||
|
@ -193,6 +175,20 @@
|
||||||
(contract-out
|
(contract-out
|
||||||
[word?
|
[word?
|
||||||
(-> any/c word?)]
|
(-> any/c word?)]
|
||||||
|
[word-fps
|
||||||
|
(-> word? flonum?)]
|
||||||
|
[word-label
|
||||||
|
(-> word? flonum? string?)]
|
||||||
|
[word-evt
|
||||||
|
(-> word? evt?)]
|
||||||
|
[word-event
|
||||||
|
(-> word? any/c word?)]
|
||||||
|
[word-tick
|
||||||
|
(-> word? word?)]
|
||||||
|
[word-output
|
||||||
|
(-> word? any/c)]
|
||||||
|
[word-return
|
||||||
|
(-> word? any/c)]
|
||||||
[word (->* () ((or/c #f word?)
|
[word (->* () ((or/c #f word?)
|
||||||
#:fps real?
|
#:fps real?
|
||||||
#:label (or/c string? (-> real? string?))
|
#:label (or/c string? (-> real? string?))
|
||||||
|
|
Loading…
Reference in New Issue