This commit is contained in:
Tony Garnock-Jones 2018-10-21 01:04:05 +01:00
parent db563fc309
commit 02181354dd
1 changed files with 8 additions and 8 deletions

View File

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