Rename Inspect WalkFn aliases

This commit is contained in:
Richard Feldman 2023-08-10 21:14:40 -04:00
parent 390b5fee77
commit 24806fa417
No known key found for this signature in database
GPG Key ID: F1F21AA5B1D9E43B
3 changed files with 13 additions and 14 deletions

View File

@ -49,7 +49,7 @@ GuiFormatter := { nodes : List Elem }
init : {} -> GuiFormatter
init = \{} -> @GuiFormatter { nodes: [] }
list : list, Inspect.ElemWalkFn GuiFormatter list elem, (elem -> Inspector GuiFormatter) -> Inspector GuiFormatter
list : list, Inspect.ElemWalker GuiFormatter list elem, (elem -> Inspector GuiFormatter) -> Inspector GuiFormatter
list = \content, walkFn, toInspector ->
f0 <- Inspect.custom
# Use a temporary buffer for the children nodes
@ -63,7 +63,7 @@ list = \content, walkFn, toInspector ->
addNode f0 (Col nodes)
set : set, Inspect.ElemWalkFn GuiFormatter set elem, (elem -> Inspector GuiFormatter) -> Inspector GuiFormatter
set : set, Inspect.ElemWalker GuiFormatter set elem, (elem -> Inspector GuiFormatter) -> Inspector GuiFormatter
set = \content, walkFn, toInspector ->
f0 <- Inspect.custom
# Use a temporary buffer for the children nodes
@ -77,7 +77,7 @@ set = \content, walkFn, toInspector ->
addNode f0 (Col nodes)
dict : dict, Inspect.KeyValWalkFn GuiFormatter dict key value, (key -> Inspector GuiFormatter), (value -> Inspector GuiFormatter) -> Inspector GuiFormatter
dict : dict, Inspect.KeyValWalker GuiFormatter dict key value, (key -> Inspector GuiFormatter), (value -> Inspector GuiFormatter) -> Inspector GuiFormatter
dict = \d, walkFn, keyToInspector, valueToInspector ->
f0 <- Inspect.custom
# Use a temporary buffer for the children nodes
@ -228,4 +228,3 @@ addNode = \@GuiFormatter { nodes }, node ->
toGui : GuiFormatter -> Elem
toGui = \@GuiFormatter { nodes } -> Col nodes

View File

@ -3,6 +3,8 @@ interface Inspect
Inspect,
InspectFormatter,
Inspector,
KeyValWalker,
ElemWalker,
init,
list,
set,
@ -30,13 +32,11 @@ interface Inspect
apply,
inspect,
toInspector,
KeyValWalkFn,
ElemWalkFn,
]
imports []
KeyValWalkFn state container key value : container, state, (state, key, value -> state) -> state
ElemWalkFn state container elem : container, state, (state, elem -> state) -> state
KeyValWalker state collection key val : collection, state, (state, key, val -> state) -> state
ElemWalker state collection elem : collection, state, (state, elem -> state) -> state
InspectFormatter has
init : {} -> f | f has InspectFormatter
@ -47,9 +47,9 @@ InspectFormatter has
bool : Bool -> Inspector f | f has InspectFormatter
str : Str -> Inspector f | f has InspectFormatter
list : list, ElemWalkFn state list elem, (elem -> Inspector f) -> Inspector f | f has InspectFormatter
set : set, ElemWalkFn state set elem, (elem -> Inspector f) -> Inspector f | f has InspectFormatter
dict : dict, KeyValWalkFn state dict key value, (key -> Inspector f), (value -> Inspector f) -> Inspector f | f has InspectFormatter
list : list, ElemWalker state list elem, (elem -> Inspector f) -> Inspector f | f has InspectFormatter
set : set, ElemWalker state set elem, (elem -> Inspector f) -> Inspector f | f has InspectFormatter
dict : dict, KeyValWalker state dict key value, (key -> Inspector f), (value -> Inspector f) -> Inspector f | f has InspectFormatter
# Note opaque is used for both opaque types and functions.
# The auto deriver for functions probably could put the function type.

View File

@ -43,7 +43,7 @@ LogFormatter := { data : Str }
init : {} -> LogFormatter
init = \{} -> @LogFormatter { data: "" }
list : list, Inspect.ElemWalkFn (LogFormatter, Bool) list elem, (elem -> Inspector LogFormatter) -> Inspector LogFormatter
list : list, Inspect.ElemWalker (LogFormatter, Bool) list elem, (elem -> Inspector LogFormatter) -> Inspector LogFormatter
list = \content, walkFn, toInspector ->
f0 <- Inspect.custom
write f0 "["
@ -62,7 +62,7 @@ list = \content, walkFn, toInspector ->
|> .0
|> write "]"
set : set, Inspect.ElemWalkFn (LogFormatter, Bool) set elem, (elem -> Inspector LogFormatter) -> Inspector LogFormatter
set : set, Inspect.ElemWalker (LogFormatter, Bool) set elem, (elem -> Inspector LogFormatter) -> Inspector LogFormatter
set = \content, walkFn, toInspector ->
f0 <- Inspect.custom
write f0 "{"
@ -81,7 +81,7 @@ set = \content, walkFn, toInspector ->
|> .0
|> write "}"
dict : dict, Inspect.KeyValWalkFn (LogFormatter, Bool) dict key value, (key -> Inspector LogFormatter), (value -> Inspector LogFormatter) -> Inspector LogFormatter
dict : dict, Inspect.KeyValWalker (LogFormatter, Bool) dict key value, (key -> Inspector LogFormatter), (value -> Inspector LogFormatter) -> Inspector LogFormatter
dict = \d, walkFn, keyToInspector, valueToInspector ->
f0 <- Inspect.custom
write f0 "{"