Browse Source

Tweaks

fruit
Tony Garnock-Jones 4 years ago
parent
commit
02181354dd
  1. 16
      syndicate/HOWITWORKS.md

16
syndicate/HOWITWORKS.md

@ -181,7 +181,7 @@ Information from each indexed event handler's skeleton's shape is laid @@ -181,7 +181,7 @@ Information from each indexed event handler's skeleton's shape is laid
out along edges connecting trie nodes.
Every node contains a "continuation", which embodies information from
a skeleton's constant map and capture map, as well as handler callback
a skeleton's constant map and capture map alongside handler callback
functions and caches of currently-asserted values.
Index = Bag(V) × Node
@ -192,7 +192,9 @@ functions and caches of currently-asserted values. @@ -192,7 +192,9 @@ functions and caches of currently-asserted values.
Continuation = 𝒫(V) × ([H] ⟼ [V] ⟼ Leaf)
Leaf = 𝒫(V) × ([H] ⟼ Handler)
Handler = Bag([V]) × 𝒫(EventType -> [V] -> V)
Handler = Bag([V]) × 𝒫(Callback)
Callback = EventType -> [V] -> V
EventType ::= "+" | "-" | "!"
Bag(τ) = τ ⟼ 𝐍 -- bag of τ values
@ -303,9 +305,8 @@ cases where handlers are dynamically installed. @@ -303,9 +305,8 @@ cases where handlers are dynamically installed.
sequence of captured values matching existing assertions in the
index.[^function-pointer-equality]
addHandler :: Index -> (S × [H×V] × [H]) -> (EventType -> [V] -> V) -> 1
addHandler index k f =
let (s, constantMap, captureMap) = k
addHandler :: Index -> (S × [H×V] × [H]) -> Callback -> 1
addHandler index (s, constantMap, captureMap) f =
let (_, root) = index
let (cache, table) = extend root s
let constLocs = [h | (h,v) ∈ constantMap]
@ -337,9 +338,8 @@ cases where handlers are dynamically installed. @@ -337,9 +338,8 @@ cases where handlers are dynamically installed.
**Definition.** The `removeHandler` procedure removes an event handler
from an index.
removeHandler :: Index -> (S × [H×V] × [H]) -> (EventType -> [V] -> V) -> 1
removeHandler index k f =
let (s, constantMap, captureMap) = k
removeHandler :: Index -> (S × [H×V] × [H]) -> Callback -> 1
removeHandler index (s, constantMap, captureMap) f =
let (_, root) = index
let (cache, table) = extend root s
let constLocs = [h | (h,v) ∈ constantMap]

Loading…
Cancel
Save