2018-08-01 15:30:25 +00:00
|
|
|
#lang typed/syndicate/roles
|
|
|
|
|
|
|
|
;; Expected Output
|
|
|
|
;; +GO
|
|
|
|
;; +ready
|
|
|
|
;; -GO
|
|
|
|
;; -ready
|
|
|
|
|
|
|
|
(define-type-alias ds-type
|
|
|
|
(U (Tuple String) (Observe (Tuple ★/t))))
|
|
|
|
|
2019-01-25 15:51:46 +00:00
|
|
|
(run-ground-dataspace ds-type
|
2018-08-01 15:30:25 +00:00
|
|
|
(spawn ds-type
|
|
|
|
(start-facet _
|
|
|
|
(during (tuple "GO")
|
|
|
|
(assert (tuple "ready")))))
|
|
|
|
(spawn ds-type
|
|
|
|
(start-facet flag
|
|
|
|
;; type error when this was mistakenly just "GO"
|
|
|
|
(assert (tuple "GO"))
|
|
|
|
(on (asserted (tuple "ready"))
|
|
|
|
(stop flag))))
|
|
|
|
(spawn ds-type
|
|
|
|
(start-facet obs
|
|
|
|
(during (tuple (bind s String))
|
|
|
|
(on start
|
|
|
|
(printf "+~a\n" s))
|
|
|
|
(on stop
|
|
|
|
(printf "-~a\n" s))))))
|