simple example
This commit is contained in:
parent
e7e8f5e174
commit
c66b62cf46
|
@ -0,0 +1,23 @@
|
|||
#lang typed/syndicate/roles
|
||||
|
||||
;; Expected Output
|
||||
;; pong: 8339
|
||||
|
||||
(define-type-alias ds-type
|
||||
(U (Tuple String Int)
|
||||
(Observe (Tuple String ★/t))))
|
||||
|
||||
(dataspace ds-type
|
||||
(spawn ds-type
|
||||
(start-facet echo
|
||||
(fields)
|
||||
(on (asserted (tuple "ping" (bind x Int)))
|
||||
(start-facet _
|
||||
(fields)
|
||||
(assert (tuple "pong" x))))))
|
||||
(spawn ds-type
|
||||
(start-facet serve
|
||||
(fields)
|
||||
(assert (tuple "ping" 8339))
|
||||
(on (asserted (tuple "pong" (bind x Int)))
|
||||
(printf "pong: ~v\n" x)))))
|
Loading…
Reference in New Issue